- Timestamp:
- 03/19/10 15:59:37 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Tests
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Tests/MichalewiczNonUniformAllPositionsManipulatorTest.cs
r3061 r3123 86 86 TestRandom random = new TestRandom(); 87 87 RealVector parent, expected; 88 DoubleValue min, max, generationsDependency; 88 DoubleValue generationsDependency; 89 DoubleMatrix bounds; 89 90 IntValue currentGeneration, maximumGenerations; 90 91 bool exceptionFired; … … 94 95 parent = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 }); 95 96 expected = new RealVector(new double[] { 0.45, 0.22, 0.3, 0.6, 0.14 }); 96 min = new DoubleValue(0.3); 97 max = new DoubleValue(0.7); 97 bounds = new DoubleMatrix(new double[,] { { 0.3, 0.7 } }); 98 98 generationsDependency = new DoubleValue(0.1); 99 99 currentGeneration = new IntValue(1); 100 100 maximumGenerations = new IntValue(4); 101 MichalewiczNonUniformAllPositionsManipulator.Apply(random, parent, min, max, currentGeneration, maximumGenerations, generationsDependency);101 MichalewiczNonUniformAllPositionsManipulator.Apply(random, parent, bounds, currentGeneration, maximumGenerations, generationsDependency); 102 102 Assert.IsTrue(Auxiliary.RealVectorIsAlmostEqualByPosition(expected, parent)); 103 103 // The following test is not based on published examples … … 106 106 random.DoubleNumbers = new double[] { 0.2, 0.5, 0.7, 0.8, 0.9, 0.5, 0.2, 0.5, 0.7, 0.8 }; 107 107 parent = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 }); 108 min = new DoubleValue(0.3); 109 max = new DoubleValue(0.7); 108 bounds = new DoubleMatrix(new double[,] { { 0.3, 0.7 } }); 110 109 generationsDependency = new DoubleValue(0.1); 111 110 currentGeneration = new IntValue(5); //current generation > max generation 112 111 maximumGenerations = new IntValue(4); 113 112 try { 114 MichalewiczNonUniformAllPositionsManipulator.Apply(random, parent, min, max, currentGeneration, maximumGenerations, generationsDependency);113 MichalewiczNonUniformAllPositionsManipulator.Apply(random, parent, bounds, currentGeneration, maximumGenerations, generationsDependency); 115 114 } 116 115 catch (System.ArgumentException) { -
trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Tests/MichalewiczNonUniformOnePositionManipulatorTest.cs
r3061 r3123 86 86 TestRandom random = new TestRandom(); 87 87 RealVector parent, expected; 88 DoubleValue min, max, generationsDependency; 88 DoubleValue generationsDependency; 89 DoubleMatrix bounds; 89 90 IntValue currentGeneration, maximumGenerations; 90 91 bool exceptionFired; … … 95 96 parent = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 }); 96 97 expected = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.34, 0.1 }); 97 min = new DoubleValue(0.3); 98 max = new DoubleValue(0.7); 98 bounds = new DoubleMatrix(new double[,] { { 0.3, 0.7 } }); 99 99 generationsDependency = new DoubleValue(0.1); 100 100 currentGeneration = new IntValue(1); 101 101 maximumGenerations = new IntValue(4); 102 MichalewiczNonUniformOnePositionManipulator.Apply(random, parent, min, max, currentGeneration, maximumGenerations, generationsDependency);102 MichalewiczNonUniformOnePositionManipulator.Apply(random, parent, bounds, currentGeneration, maximumGenerations, generationsDependency); 103 103 Assert.IsTrue(Auxiliary.RealVectorIsAlmostEqualByPosition(expected, parent)); 104 104 // The following test is not based on published examples … … 108 108 random.DoubleNumbers = new double[] { 0.2, 0.7 }; 109 109 parent = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 }); 110 min = new DoubleValue(0.3); 111 max = new DoubleValue(0.7); 110 bounds = new DoubleMatrix(new double[,] { { 0.3, 0.7 } }); 112 111 generationsDependency = new DoubleValue(0.1); 113 112 currentGeneration = new IntValue(5); //current generation > max generation 114 113 maximumGenerations = new IntValue(4); 115 114 try { 116 MichalewiczNonUniformOnePositionManipulator.Apply(random, parent, min, max, currentGeneration, maximumGenerations, generationsDependency);115 MichalewiczNonUniformOnePositionManipulator.Apply(random, parent, bounds, currentGeneration, maximumGenerations, generationsDependency); 117 116 } 118 117 catch (System.ArgumentException) { -
trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Tests/UniformOnePositionManipulatorTest.cs
r3061 r3123 86 86 TestRandom random = new TestRandom(); 87 87 RealVector parent, expected; 88 Double Value min, max;88 DoubleMatrix bounds; 89 89 // The following test is not based on published examples 90 90 random.Reset(); … … 93 93 parent = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 }); 94 94 expected = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.3, 0.1 }); 95 min = new DoubleValue(0.2); 96 max = new DoubleValue(0.7); 97 UniformOnePositionManipulator.Apply(random, parent, min, max); 95 bounds = new DoubleMatrix(new double[,] { { 0.2, 0.7 } }); 96 UniformOnePositionManipulator.Apply(random, parent, bounds); 98 97 Assert.IsTrue(Auxiliary.RealVectorIsAlmostEqualByPosition(expected, parent)); 99 98 }
Note: See TracChangeset
for help on using the changeset viewer.