Changeset 3231 for trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Tests/OrderCrossoverTest.cs
- Timestamp:
- 03/29/10 17:53:12 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Tests/OrderCrossoverTest.cs
r3063 r3231 93 93 try { 94 94 target.Cross(random, new ItemArray<Permutation>(new Permutation[] { 95 new Permutation( 4), new Permutation(4), new Permutation(4)}));95 new Permutation(PermutationTypes.RelativeUndirected, 4), new Permutation(PermutationTypes.RelativeUndirected, 4), new Permutation(PermutationTypes.RelativeUndirected, 4)})); 96 96 } catch (System.InvalidOperationException) { 97 97 exceptionFired = true; … … 110 110 random.Reset(); 111 111 random.IntNumbers = new int[] { 3, 6 }; 112 parent1 = new Permutation( new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 });112 parent1 = new Permutation(PermutationTypes.RelativeUndirected, new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 }); 113 113 Assert.IsTrue(parent1.Validate()); 114 parent2 = new Permutation( new int[] { 8, 2, 6, 7, 1, 5, 4, 0, 3 });114 parent2 = new Permutation(PermutationTypes.RelativeUndirected, new int[] { 8, 2, 6, 7, 1, 5, 4, 0, 3 }); 115 115 Assert.IsTrue(parent2.Validate()); 116 expected = new Permutation( new int[] { 2, 7, 1, 3, 4, 5, 6, 0, 8 });116 expected = new Permutation(PermutationTypes.RelativeUndirected, new int[] { 2, 7, 1, 3, 4, 5, 6, 0, 8 }); 117 117 Assert.IsTrue(expected.Validate()); 118 118 actual = OrderCrossover.Apply(random, parent1, parent2); … … 122 122 random.Reset(); 123 123 random.IntNumbers = new int[] { 2, 4 }; 124 parent1 = new Permutation( new int[] { 0, 1, 2, 3, 4, 5, 6, 7 });124 parent1 = new Permutation(PermutationTypes.RelativeUndirected, new int[] { 0, 1, 2, 3, 4, 5, 6, 7 }); 125 125 Assert.IsTrue(parent1.Validate()); 126 parent2 = new Permutation( new int[] { 1, 3, 5, 7, 6, 4, 2, 0 });126 parent2 = new Permutation(PermutationTypes.RelativeUndirected, new int[] { 1, 3, 5, 7, 6, 4, 2, 0 }); 127 127 Assert.IsTrue(parent2.Validate()); 128 expected = new Permutation( new int[] { 7, 6, 2, 3, 4, 0, 1, 5 });128 expected = new Permutation(PermutationTypes.RelativeUndirected, new int[] { 7, 6, 2, 3, 4, 0, 1, 5 }); 129 129 actual = OrderCrossover.Apply(random, parent1, parent2); 130 130 Assert.IsTrue(actual.Validate()); … … 133 133 random.Reset(); 134 134 random.IntNumbers = new int[] { 2, 5 }; 135 parent1 = new Permutation( new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 });135 parent1 = new Permutation(PermutationTypes.RelativeUndirected, new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 }); 136 136 Assert.IsTrue(parent1.Validate()); 137 parent2 = new Permutation( new int[] { 7, 3, 0, 4, 8, 2, 5, 1, 6 });137 parent2 = new Permutation(PermutationTypes.RelativeUndirected, new int[] { 7, 3, 0, 4, 8, 2, 5, 1, 6 }); 138 138 Assert.IsTrue(parent2.Validate()); 139 expected = new Permutation( new int[] { 0, 8, 2, 3, 4, 5, 1, 6, 7 });139 expected = new Permutation(PermutationTypes.RelativeUndirected, new int[] { 0, 8, 2, 3, 4, 5, 1, 6, 7 }); 140 140 Assert.IsTrue(expected.Validate()); 141 141 actual = OrderCrossover.Apply(random, parent1, parent2); … … 145 145 random.Reset(); 146 146 random.IntNumbers = new int[] { 0, 5 }; 147 parent1 = new Permutation( new int[] { 2, 1, 4, 3, 7, 8, 6, 0, 5, 9 });147 parent1 = new Permutation(PermutationTypes.RelativeUndirected, new int[] { 2, 1, 4, 3, 7, 8, 6, 0, 5, 9 }); 148 148 Assert.IsTrue(parent1.Validate()); 149 parent2 = new Permutation( new int[] { 5, 3, 4, 0, 9, 8, 2, 7, 1, 6 });149 parent2 = new Permutation(PermutationTypes.RelativeUndirected, new int[] { 5, 3, 4, 0, 9, 8, 2, 7, 1, 6 }); 150 150 Assert.IsTrue(parent2.Validate()); 151 expected = new Permutation( new int[] { 2, 1, 4, 3, 7, 8, 6, 5, 0, 9 });151 expected = new Permutation(PermutationTypes.RelativeUndirected, new int[] { 2, 1, 4, 3, 7, 8, 6, 5, 0, 9 }); 152 152 Assert.IsTrue(expected.Validate()); 153 153 actual = OrderCrossover.Apply(random, parent1, parent2); … … 157 157 random.Reset(); 158 158 random.IntNumbers = new int[] { 6, 9 }; 159 expected = new Permutation( new int[] { 3, 4, 8, 2, 7, 1, 6, 0, 5, 9 });159 expected = new Permutation(PermutationTypes.RelativeUndirected, new int[] { 3, 4, 8, 2, 7, 1, 6, 0, 5, 9 }); 160 160 Assert.IsTrue(expected.Validate()); 161 161 actual = OrderCrossover.Apply(random, parent1, parent2); … … 165 165 random.Reset(); 166 166 random.IntNumbers = new int[] { 0, 9 }; 167 expected = new Permutation( new int[] { 2, 1, 4, 3, 7, 8, 6, 0, 5, 9 });167 expected = new Permutation(PermutationTypes.RelativeUndirected, new int[] { 2, 1, 4, 3, 7, 8, 6, 0, 5, 9 }); 168 168 Assert.IsTrue(expected.Validate()); 169 169 actual = OrderCrossover.Apply(random, parent1, parent2); … … 175 175 bool exceptionFired = false; 176 176 try { 177 OrderCrossover.Apply(random, new Permutation( 8), new Permutation(6));177 OrderCrossover.Apply(random, new Permutation(PermutationTypes.RelativeUndirected, 8), new Permutation(PermutationTypes.RelativeUndirected, 6)); 178 178 } catch (System.ArgumentException) { 179 179 exceptionFired = true;
Note: See TracChangeset
for help on using the changeset viewer.