Changeset 14121 for trunk/sources/HeuristicLab.Tests/HeuristicLab.Problems.TestFunctions.MultiObjective-3.3/FastHyperVolumeTests.cs
- Timestamp:
- 07/19/16 18:24:53 (8 years ago)
- Location:
- trunk/sources/HeuristicLab.Tests/HeuristicLab.Problems.TestFunctions.MultiObjective-3.3
- Files:
-
- 1 added
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Tests/HeuristicLab.Problems.TestFunctions.MultiObjective-3.3/FastHyperVolumeTests.cs
r14111 r14121 20 20 #endregion 21 21 using System; 22 using System.Collections.Generic;23 using HeuristicLab.Problems.TestFunctions.MultiObjective;24 22 using Microsoft.VisualStudio.TestTools.UnitTesting; 25 23 26 namespace MultiObjectiveTestfunctionTests {24 namespace HeuristicLab.Problems.TestFunctions.MultiObjective.Tests { 27 25 [TestClass] 28 26 public class FastHypervolumeTest { … … 40 38 /// </summary> 41 39 [TestMethod] 42 [TestCategory("Problems.TestFunctions ")]40 [TestCategory("Problems.TestFunctions.MultiObjective")] 43 41 [TestProperty("Time", "short")] 44 public void SinglePointTest() {42 public void FastHypervolumeTestSinglePoint() { 45 43 double[] point = new double[] { 0.5, 0.5, 0.5 }; 46 44 double[][] front = { point }; … … 63 61 /// </summary> 64 62 [TestMethod] 65 [TestCategory("Problems.TestFunctions ")]63 [TestCategory("Problems.TestFunctions.MultiObjective")] 66 64 [TestProperty("Time", "short")] 67 public void RandomSinglePointTest() {65 public void FastHypervolumeTestRandomSinglePoint() { 68 66 //Front with a single Point 69 67 double[] point = new double[3]; 70 Random r = newRandom();68 var r = new System.Random(); 71 69 72 70 point[0] = r.NextDouble(); … … 100 98 /// Hypervolume should be 0.25 101 99 /// </summary> 102 //[TestMethod] 103 public void DiagonalPointTest() { 100 [TestMethod] 101 [TestCategory("Problems.TestFunctions.MultiObjective")] 102 [TestProperty("Time", "short")] 103 public void FastHypervolumeTestDiagonalPoint() { 104 104 //Front with three points 105 105 double[] point1 = new double[] { 1, 0, 0 }; … … 110 110 double[] referencePoint = new double[] { 1, 1, 1 }; 111 111 double hv = Hypervolume.Calculate(front, referencePoint, new bool[3]); 112 Assert.AreEqual(0. 25, hv);112 Assert.AreEqual(0.5, hv); 113 113 } 114 115 116 public void HypervolumeConsistencyTest() {117 double[] referencePoint = new double[] { 1, 1, 1 };118 bool[] maximization = new bool[3];119 List<double[]> points = new List<double[]>();120 Random r = new Random();121 for (int i = 0; i < 100; i++) {122 double[] p = new double[3];123 p[0] = r.NextDouble();124 p[1] = r.NextDouble();125 points.Add(p);126 }127 var front = NonDominatedSelect.SelectNonDominatedVectors(points, maximization, true);128 129 double dim3hv = Hypervolume.Calculate(front, referencePoint, new bool[3]);130 double dim2hv = Hypervolume.Calculate(front, referencePoint, maximization);131 132 133 134 135 }136 137 138 114 } 139 140 141 115 }
Note: See TracChangeset
for help on using the changeset viewer.