Changeset 10081 for branches/HeuristicLab.Analysis.AlgorithmBehavior/AlgorithmBehaviorUnitTests/LPConvexHullTest.cs
- Timestamp:
- 10/23/13 15:56:50 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Analysis.AlgorithmBehavior/AlgorithmBehaviorUnitTests/LPConvexHullTest.cs
r10060 r10081 28 28 using Microsoft.VisualStudio.TestTools.UnitTesting; 29 29 30 namespace Visualization{30 namespace AlgorithmBehaviorUnitTests { 31 31 [TestClass] 32 32 public class LPConvexHullTest { 33 33 [TestMethod] 34 34 public void TestMethod1() { 35 int nrOfSamples = 10;35 int nrOfSamples = 70; 36 36 int sampleSize = 2; 37 37 double[][] inputs = CreateRandomData(nrOfSamples, sampleSize); … … 70 70 } 71 71 72 [TestMethod] 73 public void TestExt() { 74 var inputs = CreateDataExtremePoint1().ToList(); 75 double[] alpha = inputs.Last(); 76 bool result = LPHull.EXT(inputs, alpha, inputs.Count() - 1); 77 Assert.IsTrue(result); 78 79 inputs = CreateDataExtremePoint2().ToList(); 80 alpha = inputs.Last(); 81 result = LPHull.EXT(inputs, alpha, inputs.Count() - 1); 82 Assert.IsTrue(result); 83 84 inputs = CreateDataNonExtremePoint1().ToList(); 85 alpha = inputs.Last(); 86 result = LPHull.EXT(inputs, alpha, inputs.Count() - 1); 87 Assert.IsFalse(result); 88 89 inputs = CreateDataOnHull().ToList(); 90 alpha = inputs.Last(); 91 result = LPHull.EXT(inputs, alpha, inputs.Count() - 1); 92 Assert.IsFalse(result); 93 } 94 95 private double[][] CreateDataExtremePoint1() { 96 double[][] result = new double[5][]; 97 98 result[0] = new double[] { 0.1, 0.1 }; 99 result[1] = new double[] { 1, 1 }; 100 result[2] = new double[] { 1, 0 }; 101 result[3] = new double[] { 0, 1 }; 102 result[4] = new double[] { 2.0, 1.4 }; 103 104 return result; 105 } 106 107 private double[][] CreateDataExtremePoint2() { 108 double[][] result = new double[5][]; 109 110 result[0] = new double[] { 0.1, 0.1 }; 111 result[1] = new double[] { 1, 1 }; 112 result[2] = new double[] { 1, 0 }; 113 result[3] = new double[] { 0, 1 }; 114 result[4] = new double[] { 1.0, 1.4 }; 115 116 return result; 117 } 118 119 private double[][] CreateDataNonExtremePoint1() { 120 double[][] result = new double[5][]; 121 122 result[0] = new double[] { 0.1, 0.1 }; 123 result[1] = new double[] { 1, 1 }; 124 result[2] = new double[] { 1, 0 }; 125 result[3] = new double[] { 0, 1 }; 126 result[4] = new double[] { 0.8, 0.4 }; 127 128 return result; 129 } 130 131 private double[][] CreateDataOnHull() { 132 double[][] result = new double[5][]; 133 134 result[0] = new double[] { 0.1, 0.1 }; 135 result[1] = new double[] { 1, 1 }; 136 result[2] = new double[] { 1, 0 }; 137 result[3] = new double[] { 0, 1 }; 138 result[4] = new double[] { 1.0, 0.5 }; 139 140 return result; 141 } 142 72 143 private List<DefaultVertex> ConvertPermutationToVertex(double[][] data) { 73 144 List<DefaultVertex> result = new List<DefaultVertex>();
Note: See TracChangeset
for help on using the changeset viewer.