Changeset 17338
- Timestamp:
- 10/18/19 16:27:56 (5 years ago)
- Location:
- branches/2521_ProblemRefactoring
- Files:
-
- 1 added
- 6 deleted
- 5 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj
r17225 r17338 160 160 <Compile Include="MultiObjective\CrowdingCalculator.cs" /> 161 161 <Compile Include="MultiObjective\DominationCalculator.cs" /> 162 <Compile Include="MultiObjective\GenerationalDistanceCalculator.cs" /> 162 163 <Compile Include="MultiObjective\HypervolumeCalculator.cs" /> 163 164 <Compile Include="Results\IResultParameter.cs" /> -
branches/2521_ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Optimization-3.3/Multi-objective/CrowdingTest.cs
r17262 r17338 1 //#region License Information2 / //* HeuristicLab3 //* Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)4 //*5 //* This file is part of HeuristicLab.6 //*7 //* HeuristicLab is free software: you can redistribute it and/or modify8 //* it under the terms of the GNU General Public License as published by9 //* the Free Software Foundation, either version 3 of the License, or10 //* (at your option) any later version.11 //*12 //* HeuristicLab is distributed in the hope that it will be useful,13 //* but WITHOUT ANY WARRANTY; without even the implied warranty of14 //* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the15 //* GNU General Public License for more details.16 //*17 //* You should have received a copy of the GNU General Public License18 //* along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.19 //*/20 //#endregion21 //using System;22 //using Microsoft.VisualStudio.TestTools.UnitTesting;23 //using HeuristicLab.Optimization;1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 using System; 22 using Microsoft.VisualStudio.TestTools.UnitTesting; 23 using HeuristicLab.Optimization; 24 24 25 //namespace HeuristicLab.Analysis.Tests {26 //[TestClass]27 //public class CrowdingTest {25 namespace HeuristicLab.Optimization.Tests { 26 [TestClass] 27 public class CrowdingTest { 28 28 29 //[TestMethod]30 //[ExpectedException(typeof(ArgumentException))]31 // [TestCategory("Analysis.MultiObjective")]32 //[TestProperty("Time", "short")]33 //public void CrowdingTestEmptyFront() {34 //double[][] front = { };29 [TestMethod] 30 [ExpectedException(typeof(ArgumentException))] 31 [TestCategory("Optimization.MultiObjective")] 32 [TestProperty("Time", "short")] 33 public void CrowdingTestEmptyFront() { 34 double[][] front = { }; 35 35 36 //CrowdingCalculator.CalculateCrowding(front);37 //}36 CrowdingCalculator.CalculateCrowding(front); 37 } 38 38 39 //[TestMethod]40 // [TestCategory("Analysis.MultiObjective")]41 //[TestProperty("Time", "short")]42 //public void CrowdingTestSamePoint() {39 [TestMethod] 40 [TestCategory("Optimization.MultiObjective")] 41 [TestProperty("Time", "short")] 42 public void CrowdingTestSamePoint() { 43 43 44 //double[] point = new double[2];45 //point[0] = 0.5;46 //point[1] = 0.5;44 double[] point = new double[2]; 45 point[0] = 0.5; 46 point[1] = 0.5; 47 47 48 //double[] point1 = new double[2];49 //point1[0] = 0.5;50 //point1[1] = 0.5;51 //double[][] front = { point, point1 };52 // double dist = Crowding.Calculate(front, new double[,] { { 0, 1 }, { 0, 1 } });53 //Assert.AreEqual(double.PositiveInfinity, dist);54 //}48 double[] point1 = new double[2]; 49 point1[0] = 0.5; 50 point1[1] = 0.5; 51 double[][] front = { point, point1 }; 52 double dist = CrowdingCalculator.CalculateCrowding(front); 53 Assert.AreEqual(double.PositiveInfinity, dist); 54 } 55 55 56 //[TestMethod]57 // [TestCategory("Analysis.MultiObjective")]58 //[TestProperty("Time", "short")]59 //public void CrowdingTestSinglePoint() {60 //double[] point = new double[2];61 //point[0] = 0;62 //point[1] = 0;63 //double[][] front = { point };64 // double dist = Crowding.Calculate(front, new double[,] { { 0, 1 }, { 0, 1 } });65 //Assert.AreEqual(double.PositiveInfinity, dist);66 //}56 [TestMethod] 57 [TestCategory("Optimization.MultiObjective")] 58 [TestProperty("Time", "short")] 59 public void CrowdingTestSinglePoint() { 60 double[] point = new double[2]; 61 point[0] = 0; 62 point[1] = 0; 63 double[][] front = { point }; 64 double dist = CrowdingCalculator.CalculateCrowding(front); 65 Assert.AreEqual(double.PositiveInfinity, dist); 66 } 67 67 68 //[TestMethod]69 // [TestCategory("Analysis.MultiObjective")]70 //[TestProperty("Time", "short")]71 //public void CrowdingTestDiagonal() {72 //double[] point = new double[2];73 //point[0] = 0;74 //point[1] = 0;75 //double[] point1 = new double[2];76 //point1[0] = 0.5;77 //point1[1] = 0.5;68 [TestMethod] 69 [TestCategory("Optimization.MultiObjective")] 70 [TestProperty("Time", "short")] 71 public void CrowdingTestDiagonal() { 72 double[] point = new double[2]; 73 point[0] = 0; 74 point[1] = 0; 75 double[] point1 = new double[2]; 76 point1[0] = 0.5; 77 point1[1] = 0.5; 78 78 79 //double[] point2 = new double[2];80 //point2[0] = 1;81 //point2[1] = 1;82 //double[][] front = { point, point1, point2 };83 // double dist = Crowding.Calculate(front, new double[,] { { 0, 1 }, { 0, 1 } });84 //Assert.AreEqual(2, dist);85 //}79 double[] point2 = new double[2]; 80 point2[0] = 1; 81 point2[1] = 1; 82 double[][] front = { point, point1, point2 }; 83 double dist = CrowdingCalculator.CalculateCrowding(front); 84 Assert.AreEqual(2, dist); 85 } 86 86 87 //[TestMethod]88 // [TestCategory("Analysis.MultiObjective")]89 //[TestProperty("Time", "short")]90 //public void CrowdingTestDiamond() {91 //double[] point = new double[2];92 //point[0] = 0;93 //point[1] = 0;94 //double[] point1 = new double[2];95 //point1[0] = 1;96 //point1[1] = 1.5;87 [TestMethod] 88 [TestCategory("Optimization.MultiObjective")] 89 [TestProperty("Time", "short")] 90 public void CrowdingTestDiamond() { 91 double[] point = new double[2]; 92 point[0] = 0; 93 point[1] = 0; 94 double[] point1 = new double[2]; 95 point1[0] = 1; 96 point1[1] = 1.5; 97 97 98 //double[] point2 = new double[2];99 //point2[0] = 3;100 //point2[1] = 0.5;101 //double[] point3 = new double[2];102 //point3[0] = 4;103 //point3[1] = 2;104 //double[][] front = { point, point1, point2, point3 };105 // double dist = Crowding.Calculate(front, new double[,] { { 0, 4 }, { 0, 2 } });106 //Assert.AreEqual(1.5, dist);107 //}98 double[] point2 = new double[2]; 99 point2[0] = 3; 100 point2[1] = 0.5; 101 double[] point3 = new double[2]; 102 point3[0] = 4; 103 point3[1] = 2; 104 double[][] front = { point, point1, point2, point3 }; 105 double dist = CrowdingCalculator.CalculateCrowding(front); 106 Assert.AreEqual(1.5, dist); 107 } 108 108 109 ///// <summary>110 ///// deltoid with 4 points of the 1-unit-square and the northeastern point at 4,4111 /////112 ///// </summary>113 //[TestMethod]114 // [TestCategory("Analysis.MultiObjective")]115 //[TestProperty("Time", "short")]116 //public void CrowdingTestDeltoid() {117 //double[] point = new double[2];118 //point[0] = 0;119 //point[1] = 0;120 //double[] point1 = new double[2];121 //point1[0] = 0.00000001; //points should not be exactly equal because sorting behavior could change result122 //point1[1] = 1.00000001;109 /// <summary> 110 /// deltoid with 4 points of the 1-unit-square and the northeastern point at 4,4 111 /// 112 /// </summary> 113 [TestMethod] 114 [TestCategory("Optimization.MultiObjective")] 115 [TestProperty("Time", "short")] 116 public void CrowdingTestDeltoid() { 117 double[] point = new double[2]; 118 point[0] = 0; 119 point[1] = 0; 120 double[] point1 = new double[2]; 121 point1[0] = 0.00000001; //points should not be exactly equal because sorting behavior could change result 122 point1[1] = 1.00000001; 123 123 124 //double[] point2 = new double[2];125 //point2[0] = 1;126 //point2[1] = 0;127 //double[] point3 = new double[2];128 //point3[0] = 4;129 //point3[1] = 4;124 double[] point2 = new double[2]; 125 point2[0] = 1; 126 point2[1] = 0; 127 double[] point3 = new double[2]; 128 point3[0] = 4; 129 point3[1] = 4; 130 130 131 131 132 //double[][] front = { point, point1, point2, point3, };133 // double dist = Crowding.Calculate(front, new double[,] { { 0, 4 }, { 0, 4 } });134 //Assert.AreEqual(1.25, dist);135 //}132 double[][] front = { point, point1, point2, point3, }; 133 double dist = CrowdingCalculator.CalculateCrowding(front); 134 Assert.AreEqual(1.25, dist); 135 } 136 136 137 137 138 //}138 } 139 139 140 140 141 //}141 } -
branches/2521_ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Optimization-3.3/Multi-objective/FastHyperVolumeTests.cs
r17262 r17338 23 23 using Microsoft.VisualStudio.TestTools.UnitTesting; 24 24 25 namespace HeuristicLab. Analysis.MultiObjective.Tests {25 namespace HeuristicLab.Optimization.Tests { 26 26 [TestClass] 27 27 public class FastHypervolumeTest { … … 39 39 /// </summary> 40 40 [TestMethod] 41 [TestCategory(" Analysis.MultiObjective")]41 [TestCategory("Optimization.MultiObjective")] 42 42 [TestProperty("Time", "short")] 43 43 public void FastHypervolumeTestSinglePoint() { … … 62 62 /// </summary> 63 63 [TestMethod] 64 [TestCategory(" Analysis.MultiObjective")]64 [TestCategory("Optimization.MultiObjective")] 65 65 [TestProperty("Time", "short")] 66 66 public void FastHypervolumeTestRandomSinglePoint() { … … 100 100 /// </summary> 101 101 [TestMethod] 102 [TestCategory(" Analysis.MultiObjective")]102 [TestCategory("Optimization.MultiObjective")] 103 103 [TestProperty("Time", "short")] 104 104 public void FastHypervolumeTestDiagonalPoint() { -
branches/2521_ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Optimization-3.3/Multi-objective/HyperVolumeTests.cs
r17262 r17338 24 24 using Microsoft.VisualStudio.TestTools.UnitTesting; 25 25 26 namespace HeuristicLab. Analysis.MultiObjective.Tests {26 namespace HeuristicLab.Optimization.Tests { 27 27 [TestClass] 28 28 public class HypervolumeTest { … … 41 41 /// </summary> 42 42 [TestMethod] 43 [TestCategory(" Analysis.MultiObjective")]43 [TestCategory("Optimization.MultiObjective")] 44 44 [TestProperty("Time", "short")] 45 45 public void HypervolumeTestSinglePoint() { … … 98 98 /// </summary> 99 99 [TestMethod] 100 [TestCategory(" Analysis.MultiObjective")]100 [TestCategory("Optimization.MultiObjective")] 101 101 [TestProperty("Time", "short")] 102 102 public void HypervolumeTestRandomSinglePoint() { … … 151 151 /// </summary> 152 152 [TestMethod] 153 [TestCategory(" Analysis.MultiObjective")]153 [TestCategory("Optimization.MultiObjective")] 154 154 [TestProperty("Time", "short")] 155 155 public void HypervolumeTestDiagonalPoint() { … … 202 202 203 203 [TestMethod()] 204 [ExpectedException(typeof(ArgumentException))] 205 [TestCategory("Analysis.MultiObjective")] 204 [TestCategory("Optimization.MultiObjective")] 206 205 [TestProperty("Time", "short")] 207 206 public void HypervolumeTestReferencePointViolationNE() { … … 220 219 referencePoint[1] = 1; 221 220 double ne = HypervolumeCalculator.CalculateHypervolume(front, referencePoint, maximization); 222 }223 224 [TestMethod()] 225 [ ExpectedException(typeof(ArgumentException))]226 [TestCategory(" Analysis.MultiObjective")]221 Assert.AreEqual(0, ne); 222 } 223 224 [TestMethod()] 225 [TestCategory("Optimization.MultiObjective")] 227 226 [TestProperty("Time", "short")] 228 227 public void HypervolumeTestReferencePointViolationNW() { … … 241 240 referencePoint[1] = 1; 242 241 double nw = HypervolumeCalculator.CalculateHypervolume(front, referencePoint, maximization); 243 Assert.AreEqual(0.25, nw); 244 } 245 246 [TestMethod()] 247 [ExpectedException(typeof(ArgumentException))] 248 [TestCategory("Analysis.MultiObjective")] 242 Assert.AreEqual(0, nw); 243 } 244 245 [TestMethod()] 246 [TestCategory("Optimization.MultiObjective")] 249 247 [TestProperty("Time", "short")] 250 248 public void HypervolumeTestReferencePointViolationSW() { … … 263 261 referencePoint[1] = 0; 264 262 double sw = HypervolumeCalculator.CalculateHypervolume(front, referencePoint, maximization); 265 Assert.AreEqual(0.25, sw); 266 } 267 268 [TestMethod()] 269 [ExpectedException(typeof(ArgumentException))] 270 [TestCategory("Analysis.MultiObjective")] 263 Assert.AreEqual(0, sw); 264 } 265 266 [TestMethod()] 267 [TestCategory("Optimization.MultiObjective")] 271 268 [TestProperty("Time", "short")] 272 269 public void HypervolumeTestReferencePointViolationSE() { … … 285 282 referencePoint[1] = 0; 286 283 double se = HypervolumeCalculator.CalculateHypervolume(front, referencePoint, maximization); 287 Assert.AreEqual(0 .25, se);284 Assert.AreEqual(0, se); 288 285 } 289 286 } -
branches/2521_ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Tests.csproj
r17262 r17338 510 510 <Compile Include="HeuristicLab.Analysis-3.3\EffectSizeUnitTests.cs" /> 511 511 <Compile Include="HeuristicLab.Analysis-3.3\KruskalWallisUnitTests.cs" /> 512 <Compile Include="HeuristicLab.Analysis-3.3\Multi-objective\SpacingTest.cs" /> 512 513 <Compile Include="HeuristicLab.Analysis-3.3\MultidimensionalScalingTest.cs" /> 513 514 <Compile Include="HeuristicLab.Collections-3.3\BidirectionalDictionaryTest.cs" /> … … 590 591 <Compile Include="HeuristicLab.IGraph\IGraphWrappersMatrixTest.cs" /> 591 592 <Compile Include="HeuristicLab.IGraph\IGraphWrappersVectorTest.cs" /> 593 <Compile Include="HeuristicLab.Optimization-3.3\Multi-objective\CrowdingTest.cs" /> 594 <Compile Include="HeuristicLab.Optimization-3.3\Multi-objective\FastHyperVolumeTests.cs" /> 595 <Compile Include="HeuristicLab.Optimization-3.3\Multi-objective\HyperVolumeTests.cs" /> 592 596 <Compile Include="HeuristicLab.Persistence-3.3\StorableAttributeTests.cs" /> 593 597 <Compile Include="HeuristicLab.Persistence-3.3\UseCases.cs" /> … … 636 640 <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\SumSquaresEvaluatorTest.cs" /> 637 641 <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\ZakharovEvaluatorTest.cs" /> 638 <Compile Include="HeuristicLab.Analysis-3.3\Multi-objective\CrowdingTest.cs" />639 <Compile Include="HeuristicLab.Analysis-3.3\Multi-objective\FastHyperVolumeTests.cs" />640 642 <Compile Include="HeuristicLab.Analysis-3.3\Multi-objective\GenerationalDistanceTest.cs" /> 641 <Compile Include="HeuristicLab.Analysis-3.3\Multi-objective\HyperVolumeTests.cs" />642 643 <Compile Include="HeuristicLab.Analysis-3.3\Multi-objective\InvertedGenerationalDistanceTest.cs" /> 643 <Compile Include="HeuristicLab.Analysis-3.3\Multi-objective\SpacingTest.cs" />644 644 <Compile Include="HeuristicLab.Problems.TravelingSalesman-3.3\TSPMoveEvaluatorTest.cs" /> 645 645 <Compile Include="HeuristicLab.Problems.LinearAssignment-3.3\LinearAssignmentProblemSolverTest.cs" /> … … 716 716 </EmbeddedResource> 717 717 </ItemGroup> 718 <ItemGroup /> 718 719 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> 719 720 <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Note: See TracChangeset
for help on using the changeset viewer.