Changeset 14030 for branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/MultiObjectiveTestfunctionTests
- Timestamp:
- 07/08/16 15:30:46 (9 years ago)
- Location:
- branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/MultiObjectiveTestfunctionTests
- Files:
-
- 3 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/MultiObjectiveTestfunctionTests/CrowdingTest.cs
r14021 r14030 25 25 namespace MultiObjectiveTestfunctionTests { 26 26 [TestClass] 27 public class SpacingTest {27 public class CrowdingTest { 28 28 29 29 [TestMethod] … … 34 34 double[][] front = { }; 35 35 36 Spacing.Calculate(front);36 Crowding.Calculate(front, null); 37 37 } 38 38 … … 50 50 point1[1] = 0.5; 51 51 double[][] front = { point, point1 }; 52 double dist = Spacing.Calculate(front);53 Assert.AreEqual( 0, dist);52 double dist = Crowding.Calculate(front, new double[,] { { 0, 1 }, { 0, 1 } }); 53 Assert.AreEqual(double.PositiveInfinity, dist); 54 54 } 55 55 … … 62 62 point[1] = 0; 63 63 double[][] front = { point }; 64 double dist = Spacing.Calculate(front);65 Assert.AreEqual( 0, dist);64 double dist = Crowding.Calculate(front, new double[,] { { 0, 1 }, { 0, 1 } }); 65 Assert.AreEqual(double.PositiveInfinity, dist); 66 66 } 67 67 … … 69 69 [TestCategory("Problems.TestFunctions")] 70 70 [TestProperty("Time", "short")] 71 public void QuadraticTest() {71 public void DiagonalTest() { 72 72 double[] point = new double[2]; 73 73 point[0] = 0; 74 74 point[1] = 0; 75 75 double[] point1 = new double[2]; 76 point1[0] = 0 ;77 point1[1] = 1;76 point1[0] = 0.5; 77 point1[1] = 0.5; 78 78 79 79 double[] point2 = new double[2]; 80 80 point2[0] = 1; 81 point2[1] = 0; 82 double[] point3 = new double[2]; 83 point3[0] = 1; 84 point3[1] = 1; 85 double[][] front = { point, point1, point2, point3 }; 86 double dist = Spacing.Calculate(front); 87 Assert.AreEqual(0, dist); 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); 88 85 } 89 86 … … 91 88 [TestCategory("Problems.TestFunctions")] 92 89 [TestProperty("Time", "short")] 93 public void RectangularTest() {90 public void DiamondTest() { 94 91 double[] point = new double[2]; 95 92 point[0] = 0; 96 93 point[1] = 0; 97 94 double[] point1 = new double[2]; 98 point1[0] = 0;99 point1[1] = 1 ;95 point1[0] = 1; 96 point1[1] = 1.5; 100 97 101 98 double[] point2 = new double[2]; 102 point2[0] = 2;103 point2[1] = 0 ;99 point2[0] = 3; 100 point2[1] = 0.5; 104 101 double[] point3 = new double[2]; 105 point3[0] = 2;106 point3[1] = 1;102 point3[0] = 4; 103 point3[1] = 2; 107 104 double[][] front = { point, point1, point2, point3 }; 108 double dist = Spacing.Calculate(front);109 Assert.AreEqual( 0, dist);105 double dist = Crowding.Calculate(front, new double[,] { { 0, 2 }, { 0, 1 } }); ; 106 Assert.AreEqual(4.5, dist); 110 107 } 111 108 112 109 /// <summary> 113 /// deltoid with 3 points of the 1-unit-square and the northeastern point at 4,4 114 /// which gives d=(1,1,1,5) for minimal distances. Mean of d is 2 and variance of d is 3 115 /// Spacing is defined as the standarddeviation of d 110 /// deltoid with 4 points of the 1-unit-square and the northeastern point at 4,4 111 /// 116 112 /// </summary> 117 113 [TestMethod] … … 123 119 point[1] = 0; 124 120 double[] point1 = new double[2]; 125 point1[0] = 0 ;126 point1[1] = 1 ;121 point1[0] = 0.00000001; //points should not be exactly equal because sorting behaviour could change result 122 point1[1] = 1.00000001; 127 123 128 124 double[] point2 = new double[2]; … … 132 128 point3[0] = 4; 133 129 point3[1] = 4; 134 double[][] front = { point, point1, point2, point3 }; 135 double dist = Spacing.Calculate(front); 136 Assert.AreEqual(Math.Sqrt(3), dist); 130 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); 137 135 } 138 136 -
branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/MultiObjectiveTestfunctionTests/FastHyperVolumeTests.cs
r13729 r14030 46 46 double[][] front = { point }; 47 47 double[] referencePoint = new double[] { 1, 1, 1 }; 48 double hv = MultiDimensionalHypervolume.Calculate(front, referencePoint);48 double hv = Hypervolume.Calculate(front, referencePoint, new bool[3]); 49 49 Assert.AreEqual(0.125, hv); 50 50 } … … 81 81 referencePoint[1] = 1; 82 82 referencePoint[2] = 1; 83 double hv = MultiDimensionalHypervolume.Calculate(front, referencePoint);83 double hv = Hypervolume.Calculate(front, referencePoint, new bool[3]); 84 84 double hv2 = 1; 85 85 foreach (double d in point) { … … 109 109 110 110 double[] referencePoint = new double[] { 1, 1, 1 }; 111 double hv = MultiDimensionalHypervolume.Calculate(front, referencePoint);111 double hv = Hypervolume.Calculate(front, referencePoint, new bool[3]); 112 112 Assert.AreEqual(0.25, hv); 113 113 } … … 127 127 var front = NonDominatedSelect.selectNonDominatedVectors(points, maximization, true); 128 128 129 double dim3hv = MultiDimensionalHypervolume.Calculate(front, referencePoint);129 double dim3hv = Hypervolume.Calculate(front, referencePoint, new bool[3]); 130 130 double dim2hv = Hypervolume.Calculate(front, referencePoint, maximization); 131 131 -
branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/MultiObjectiveTestfunctionTests/MultiObjectiveTestfunctionTests.csproj
r13673 r14030 64 64 <ItemGroup> 65 65 <Compile Include="FastHyperVolumeTests.cs" /> 66 <Compile Include="CrowdingTest.cs" /> 66 67 <Compile Include="SpacingTest.cs" /> 67 68 <Compile Include="InvertedGenerationalDistanceTest.cs" /> -
branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/MultiObjectiveTestfunctionTests/SpacingTest.cs
r13988 r14030 26 26 [TestClass] 27 27 public class SpacingTest { 28 28 29 29 30 [TestMethod]
Note: See TracChangeset
for help on using the changeset viewer.