- Timestamp:
- 03/16/10 11:37:25 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Tests
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Tests/Auxiliary.cs
r3060 r3061 20 20 #endregion 21 21 22 using HeuristicLab.Data;23 22 using HeuristicLab.Common; 23 using HeuristicLab.Encodings.RealVectorEncoding; 24 24 25 25 namespace HeuristicLab.Encodings.RealVectorEncoding_33.Tests { 26 26 public static class Auxiliary { 27 public static bool DoubleArrayIsAlmostEqualByPosition(DoubleArray p1, DoubleArrayp2) {27 public static bool RealVectorIsAlmostEqualByPosition(RealVector p1, RealVector p2) { 28 28 bool equal = (p1.Length == p2.Length); 29 29 if (equal) { -
trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Tests/BlendAlphaBetaCrossoverTest.cs
r3060 r3061 114 114 expected = new RealVector(new double[] { 0.3, 0.15, 0.3, 0.35, 0.45 }); 115 115 actual = BlendAlphaBetaCrossover.Apply(random, parent1, parent2, alpha, beta); 116 Assert.IsTrue(Auxiliary. DoubleArrayIsAlmostEqualByPosition(actual, expected));116 Assert.IsTrue(Auxiliary.RealVectorIsAlmostEqualByPosition(actual, expected)); 117 117 // The following test is not based on published examples 118 118 random.Reset(); -
trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Tests/BlendAlphaCrossoverTest.cs
r3060 r3061 112 112 expected = new RealVector(new double[] { 0.3, 0.15, 0.3, 0.35, 0.45 }); 113 113 actual = BlendAlphaCrossover.Apply(random, parent1, parent2, alpha); 114 Assert.IsTrue(Auxiliary. DoubleArrayIsAlmostEqualByPosition(actual, expected));114 Assert.IsTrue(Auxiliary.RealVectorIsAlmostEqualByPosition(actual, expected)); 115 115 // The following test is not based on published examples 116 116 random.Reset(); … … 121 121 expected = new RealVector(new double[] { 0.225, 0.1875, 0.3, 0.4625, 0.1875 }); 122 122 actual = BlendAlphaCrossover.Apply(random, parent1, parent2, alpha); 123 Assert.IsTrue(Auxiliary. DoubleArrayIsAlmostEqualByPosition(actual, expected));123 Assert.IsTrue(Auxiliary.RealVectorIsAlmostEqualByPosition(actual, expected)); 124 124 // The following test is not based on published examples 125 125 random.Reset(); -
trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Tests/DiscreteCrossoverTest.cs
r3060 r3061 101 101 expected = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.5, 0.8 }); 102 102 actual = DiscreteCrossover.Apply(random, parents); 103 Assert.IsTrue(Auxiliary. DoubleArrayIsAlmostEqualByPosition(actual, expected));103 Assert.IsTrue(Auxiliary.RealVectorIsAlmostEqualByPosition(actual, expected)); 104 104 // The following test is not based on published examples 105 105 random.Reset(); -
trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Tests/HeuristicCrossoverTest.cs
r3060 r3061 111 111 expected = new RealVector(new double[] { 0.14, 0.23, 0.3, 0.59, -0.11 }); 112 112 actual = HeuristicCrossover.Apply(random, parent1, parent2); 113 Assert.IsTrue(Auxiliary. DoubleArrayIsAlmostEqualByPosition(actual, expected));113 Assert.IsTrue(Auxiliary.RealVectorIsAlmostEqualByPosition(actual, expected)); 114 114 // The following test is not based on published examples 115 115 random.Reset(); -
trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Tests/LocalCrossoverTest.cs
r3060 r3061 111 111 expected = new RealVector(new double[] { 0.34, 0.11, 0.3, 0.32, 0.639 }); 112 112 actual = LocalCrossover.Apply(random, parent1, parent2); 113 Assert.IsTrue(Auxiliary. DoubleArrayIsAlmostEqualByPosition(actual, expected));113 Assert.IsTrue(Auxiliary.RealVectorIsAlmostEqualByPosition(actual, expected)); 114 114 // The following test is not based on published examples 115 115 random.Reset(); -
trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Tests/MichalewiczNonUniformAllPositionsManipulatorTest.cs
r3060 r3061 100 100 maximumGenerations = new IntValue(4); 101 101 MichalewiczNonUniformAllPositionsManipulator.Apply(random, parent, min, max, currentGeneration, maximumGenerations, generationsDependency); 102 Assert.IsTrue(Auxiliary. DoubleArrayIsAlmostEqualByPosition(expected, parent));102 Assert.IsTrue(Auxiliary.RealVectorIsAlmostEqualByPosition(expected, parent)); 103 103 // The following test is not based on published examples 104 104 exceptionFired = false; -
trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Tests/MichalewiczNonUniformOnePositionManipulatorTest.cs
r3060 r3061 101 101 maximumGenerations = new IntValue(4); 102 102 MichalewiczNonUniformOnePositionManipulator.Apply(random, parent, min, max, currentGeneration, maximumGenerations, generationsDependency); 103 Assert.IsTrue(Auxiliary. DoubleArrayIsAlmostEqualByPosition(expected, parent));103 Assert.IsTrue(Auxiliary.RealVectorIsAlmostEqualByPosition(expected, parent)); 104 104 // The following test is not based on published examples 105 105 exceptionFired = false; -
trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Tests/PolynomialAllPositionManipulatorTest.cs
r3060 r3061 96 96 maxManipulation = new DoubleValue(0.2); 97 97 PolynomialAllPositionManipulator.Apply(random, parent, contiguity, maxManipulation); 98 Assert.IsTrue(Auxiliary. DoubleArrayIsAlmostEqualByPosition(expected, parent));98 Assert.IsTrue(Auxiliary.RealVectorIsAlmostEqualByPosition(expected, parent)); 99 99 // The following test is not based on published examples 100 100 exceptionFired = false; -
trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Tests/PolynomialOnePositionManipulatorTest.cs
r3060 r3061 97 97 maxManipulation = new DoubleValue(0.7); 98 98 PolynomialOnePositionManipulator.Apply(random, parent, contiguity, maxManipulation); 99 Assert.IsTrue(Auxiliary. DoubleArrayIsAlmostEqualByPosition(expected, parent));99 Assert.IsTrue(Auxiliary.RealVectorIsAlmostEqualByPosition(expected, parent)); 100 100 // The following test is not based on published examples 101 101 exceptionFired = false; -
trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Tests/RandomConvexCrossoverTest.cs
r3060 r3061 111 111 expected = new RealVector(new double[] { 0.34, 0.13, 0.3, 0.29, 0.59 }); 112 112 actual = RandomConvexCrossover.Apply(random, parent1, parent2); 113 Assert.IsTrue(Auxiliary. DoubleArrayIsAlmostEqualByPosition(actual, expected));113 Assert.IsTrue(Auxiliary.RealVectorIsAlmostEqualByPosition(actual, expected)); 114 114 // The following test is not based on published examples 115 115 random.Reset(); -
trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Tests/SimulatedBinaryCrossoverTest.cs
r3060 r3061 113 113 expected = new RealVector(new double[] { 1.11032829834638, -0.0145477755417797, 0.3, 0.5, 0.1 }); 114 114 actual = SimulatedBinaryCrossover.Apply(random, parent1, parent2, contiguity); 115 Assert.IsTrue(Auxiliary. DoubleArrayIsAlmostEqualByPosition(actual, expected));115 Assert.IsTrue(Auxiliary.RealVectorIsAlmostEqualByPosition(actual, expected)); 116 116 // The following test is not based on published examples 117 117 random.Reset(); -
trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Tests/SinglePointCrossoverTest.cs
r3060 r3061 111 111 expected = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.2, 0.8 }); 112 112 actual = SinglePointCrossover.Apply(random, parent1, parent2); 113 Assert.IsTrue(Auxiliary. DoubleArrayIsAlmostEqualByPosition(actual, expected));113 Assert.IsTrue(Auxiliary.RealVectorIsAlmostEqualByPosition(actual, expected)); 114 114 // The following test is not based on published examples 115 115 random.Reset(); -
trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Tests/UniformOnePositionManipulatorTest.cs
r3060 r3061 96 96 max = new DoubleValue(0.7); 97 97 UniformOnePositionManipulator.Apply(random, parent, min, max); 98 Assert.IsTrue(Auxiliary. DoubleArrayIsAlmostEqualByPosition(expected, parent));98 Assert.IsTrue(Auxiliary.RealVectorIsAlmostEqualByPosition(expected, parent)); 99 99 } 100 100
Note: See TracChangeset
for help on using the changeset viewer.