Changeset 3053 for trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Tests/PositionBasedCrossoverTest.cs
- Timestamp:
- 03/16/10 00:56:44 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3
- Property svn:ignore
-
old new 2 2 bin 3 3 obj 4 HeuristicLabEncodingsPermutation Plugin.cs4 HeuristicLabEncodingsPermutationEncodingPlugin.cs
-
- Property svn:ignore
-
trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Tests/PositionBasedCrossoverTest.cs
r2930 r3053 22 22 using HeuristicLab.Core; 23 23 using Microsoft.VisualStudio.TestTools.UnitTesting; 24 using HeuristicLab.Encodings.Permutation ;24 using HeuristicLab.Encodings.PermutationEncoding; 25 25 26 namespace HeuristicLab.Encodings.Permutation _33.Tests {26 namespace HeuristicLab.Encodings.PermutationEncoding_33.Tests { 27 27 /// <summary> 28 28 ///This is a test class for PositionBasedCrossover and is intended … … 93 93 bool exceptionFired = false; 94 94 try { 95 target.Cross(random, new ItemArray<Permutation .Permutation>(new Permutation.Permutation[] {96 new Permutation .Permutation(4), new Permutation.Permutation(4), new Permutation.Permutation(4) }));95 target.Cross(random, new ItemArray<Permutation>(new Permutation[] { 96 new Permutation(4), new Permutation(4), new Permutation(4) })); 97 97 } 98 98 catch (System.InvalidOperationException) { … … 109 109 public void PositionBasedCrossoverApplyTest() { 110 110 TestRandom random = new TestRandom(); 111 Permutation .Permutationparent1, parent2, expected, actual;111 Permutation parent1, parent2, expected, actual; 112 112 113 113 // The following test is based on an example from Larranaga, 1999. Genetic Algorithms for the Traveling Salesman Problem. 114 114 random.Reset(); 115 115 random.IntNumbers = new int[] { 3, 1, 2, 5 }; 116 parent1 = new Permutation .Permutation(new int[] { 0, 1, 2, 3, 4, 5, 6, 7 });116 parent1 = new Permutation(new int[] { 0, 1, 2, 3, 4, 5, 6, 7 }); 117 117 Assert.IsTrue(parent1.Validate()); 118 parent2 = new Permutation .Permutation(new int[] { 1, 3, 5, 7, 6, 4, 2, 0 });118 parent2 = new Permutation(new int[] { 1, 3, 5, 7, 6, 4, 2, 0 }); 119 119 Assert.IsTrue(parent2.Validate()); 120 120 121 expected = new Permutation .Permutation(new int[] { 0, 3, 5, 1, 2, 4, 6, 7 });121 expected = new Permutation(new int[] { 0, 3, 5, 1, 2, 4, 6, 7 }); 122 122 Assert.IsTrue(expected.Validate()); 123 123 actual = PositionBasedCrossover.Apply(random, parent1, parent2); … … 129 129 bool exceptionFired = false; 130 130 try { 131 PositionBasedCrossover.Apply(random, new Permutation .Permutation(8), new Permutation.Permutation(6));131 PositionBasedCrossover.Apply(random, new Permutation(8), new Permutation(6)); 132 132 } catch (System.ArgumentException) { 133 133 exceptionFired = true;
Note: See TracChangeset
for help on using the changeset viewer.