Changeset 13469 for branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Encodings.ScheduleEncoding-3.3
- Timestamp:
- 12/15/15 15:16:24 (9 years ago)
- Location:
- branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Encodings.ScheduleEncoding-3.3
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Encodings.ScheduleEncoding-3.3/DirectScheduleGTCrossoverTest.cs
r12012 r13469 22 22 using System.Linq; 23 23 using HeuristicLab.Core; 24 using HeuristicLab.Encodings.ScheduleEncoding.PermutationWithRepetition; 25 using HeuristicLab.Encodings.ScheduleEncoding.ScheduleEncoding; 24 using HeuristicLab.Encodings.ScheduleEncoding; 26 25 using HeuristicLab.Tests; 27 26 using Microsoft.VisualStudio.TestTools.UnitTesting; … … 48 47 Schedule actual; 49 48 actual = DirectScheduleGTCrossover.Apply(random, parent1, parent2, jobData, mutProp); 50 Schedule expected = DirectScheduleRandomCreator.Apply( 3, 3,new PWREncoding(3, 3, new TestRandom(new int[] { 0, 2, 1, 1, 0, 2, 1, 2, 0 }, null)), TestUtils.CreateJobData());49 Schedule expected = DirectScheduleRandomCreator.Apply(new PWREncoding(3, 3, new TestRandom(new int[] { 0, 2, 1, 1, 0, 2, 1, 2, 0 }, null)), TestUtils.CreateJobData()); 51 50 Assert.IsTrue(TestUtils.ScheduleEquals(actual, expected)); 52 51 } -
branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Encodings.ScheduleEncoding-3.3/JSMJOXCrossoverTest.cs
r12012 r13469 22 22 using HeuristicLab.Core; 23 23 using HeuristicLab.Encodings.PermutationEncoding; 24 using HeuristicLab.Encodings.ScheduleEncoding.JobSequenceMatrix;25 24 using HeuristicLab.Tests; 26 25 using Microsoft.VisualStudio.TestTools.UnitTesting; … … 40 39 [TestProperty("Time", "short")] 41 40 public void ApplyTest() { 42 IRandom random = new TestRandom(new int[] { 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1 }, null);41 IRandom random = new TestRandom(new int[] { 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1 }, null); 43 42 JSMEncoding p1 = TestUtils.CreateTestJSM1(); 44 43 JSMEncoding p2 = TestUtils.CreateTestJSM2(); 45 JSMEncoding expected = new JSMEncoding( );46 ItemList<Permutation> jsm = new ItemList<Permutation>();44 JSMEncoding expected = new JSMEncoding(0); 45 ItemList<Permutation> jsm = expected.JobSequenceMatrix; 47 46 for (int i = 0; i < 6; i++) { 48 47 jsm.Add(new Permutation(PermutationTypes.Absolute, new int[] { 5, 4, 3, 0, 1, 2 })); 49 48 } 50 expected.JobSequenceMatrix = jsm; 49 51 50 52 51 JSMEncoding actual; -
branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Encodings.ScheduleEncoding-3.3/JSMSXXCrossoverTest.cs
r12012 r13469 22 22 using HeuristicLab.Core; 23 23 using HeuristicLab.Encodings.PermutationEncoding; 24 using HeuristicLab.Encodings.ScheduleEncoding.JobSequenceMatrix;25 24 using HeuristicLab.Tests; 26 25 using Microsoft.VisualStudio.TestTools.UnitTesting; … … 40 39 [TestProperty("Time", "short")] 41 40 public void ApplyTest() { 42 IRandom random = new TestRandom(new int[] { 3 }, null);41 IRandom random = new TestRandom(new int[] { 0, 3 }, null); 43 42 JSMEncoding p1 = TestUtils.CreateTestJSM1(); 44 43 JSMEncoding p2 = TestUtils.CreateTestJSM2(); 45 JSMEncoding expected = new JSMEncoding( );46 ItemList<Permutation> jsm = new ItemList<Permutation>();44 JSMEncoding expected = new JSMEncoding(0); 45 ItemList<Permutation> jsm = expected.JobSequenceMatrix; 47 46 for (int i = 0; i < 6; i++) { 48 47 jsm.Add(new Permutation(PermutationTypes.Absolute, new int[] { 2, 1, 0, 3, 4, 5 })); 49 48 } 50 expected.JobSequenceMatrix = jsm;51 49 52 50 JSMEncoding actual; -
branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Encodings.ScheduleEncoding-3.3/JSMShiftChangeManipulatorTest.cs
r12012 r13469 22 22 using HeuristicLab.Core; 23 23 using HeuristicLab.Encodings.PermutationEncoding; 24 using HeuristicLab.Encodings.ScheduleEncoding.JobSequenceMatrix;25 24 using HeuristicLab.Tests; 26 25 using Microsoft.VisualStudio.TestTools.UnitTesting; … … 43 42 JSMEncoding individual = TestUtils.CreateTestJSM1(); 44 43 JSMShiftChangeManipulator.Apply(random, individual); 45 JSMEncoding expected = new JSMEncoding( );46 ItemList<Permutation> jsm = new ItemList<Permutation>();44 JSMEncoding expected = new JSMEncoding(0); 45 ItemList<Permutation> jsm = expected.JobSequenceMatrix; 47 46 for (int i = 0; i < 3; i++) { 48 47 jsm.Add(new Permutation(PermutationTypes.Absolute, new int[] { 0, 1, 3, 2, 4, 5 })); 49 48 jsm.Add(new Permutation(PermutationTypes.Absolute, new int[] { 0, 1, 3, 4, 2, 5 })); 50 49 } 51 expected.JobSequenceMatrix = jsm;52 50 53 51 Assert.IsTrue(TestUtils.JSMEncodingEquals(expected, individual)); -
branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Encodings.ScheduleEncoding-3.3/PWRGOXCrossoverTest.cs
r12012 r13469 22 22 using HeuristicLab.Core; 23 23 using HeuristicLab.Encodings.IntegerVectorEncoding; 24 using HeuristicLab.Encodings.ScheduleEncoding.PermutationWithRepetition;25 24 using HeuristicLab.Tests; 26 25 using Microsoft.VisualStudio.TestTools.UnitTesting; -
branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Encodings.ScheduleEncoding-3.3/PWRPPXCrossoverTest.cs
r12012 r13469 22 22 using HeuristicLab.Core; 23 23 using HeuristicLab.Encodings.IntegerVectorEncoding; 24 using HeuristicLab.Encodings.ScheduleEncoding.PermutationWithRepetition;25 24 using HeuristicLab.Tests; 26 25 using Microsoft.VisualStudio.TestTools.UnitTesting; -
branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Encodings.ScheduleEncoding-3.3/TestUtils.cs
r12012 r13469 24 24 using HeuristicLab.Encodings.IntegerVectorEncoding; 25 25 using HeuristicLab.Encodings.PermutationEncoding; 26 using HeuristicLab.Encodings.ScheduleEncoding.JobSequenceMatrix; 27 using HeuristicLab.Encodings.ScheduleEncoding.PermutationWithRepetition; 26 28 27 using HeuristicLab.Tests; 29 28 … … 31 30 public class TestUtils { 32 31 public static JSMEncoding CreateTestJSM1() { 33 JSMEncoding result = new JSMEncoding( );34 ItemList<Permutation> jsm = new ItemList<Permutation>();32 JSMEncoding result = new JSMEncoding(0); 33 ItemList<Permutation> jsm = result.JobSequenceMatrix; 35 34 for (int i = 0; i < 6; i++) 36 35 jsm.Add(new Permutation(PermutationTypes.Absolute, new int[] { 0, 1, 2, 3, 4, 5 })); 37 result.JobSequenceMatrix = jsm;38 36 return result; 39 37 } 40 38 41 39 public static JSMEncoding CreateTestJSM2() { 42 JSMEncoding result = new JSMEncoding( );43 ItemList<Permutation> jsm = new ItemList<Permutation>();40 JSMEncoding result = new JSMEncoding(0); 41 ItemList<Permutation> jsm = result.JobSequenceMatrix; 44 42 for (int i = 0; i < 6; i++) 45 43 jsm.Add(new Permutation(PermutationTypes.Absolute, new int[] { 5, 4, 3, 2, 1, 0 })); 46 result.JobSequenceMatrix = jsm;47 44 return result; 48 45 } … … 66 63 public static ItemList<Job> CreateJobData() { 67 64 Job j1 = new Job(0, 0); 68 j1.Tasks = new ItemList<Task> {65 j1.Tasks.AddRange(new[]{ 69 66 new Task (0, 0, j1.Index, 1), 70 67 new Task (1, 1, j1.Index, 2), 71 68 new Task (2, 2, j1.Index, 1) 72 } ;69 }); 73 70 74 71 Job j2 = new Job(1, 0); 75 j2.Tasks = new ItemList<Task>{72 j2.Tasks.AddRange(new[]{ 76 73 new Task (3, 2, j2.Index, 2), 77 74 new Task (4, 1, j2.Index, 1), 78 75 new Task (5, 0, j2.Index, 2) 79 } ;76 }); 80 77 81 78 Job j3 = new Job(2, 0); 82 j3.Tasks = new ItemList<Task>{79 j3.Tasks.AddRange(new[]{ 83 80 new Task (6, 0, j3.Index, 1), 84 81 new Task (7, 2, j3.Index, 2), 85 82 new Task (8, 1, j3.Index, 1) 86 } ;83 }); 87 84 88 85 return new ItemList<Job> { j1, j2, j3 }; … … 90 87 91 88 public static Schedule CreateTestSchedule1() { 92 Schedule result = DirectScheduleRandomCreator.Apply( 3, 3,new PWREncoding(3, 3, new TestRandom(new int[] { 1, 0, 1, 1, 2, 0, 2, 2, 0 }, null)), CreateJobData());89 Schedule result = DirectScheduleRandomCreator.Apply(new PWREncoding(3, 3, new TestRandom(new int[] { 1, 0, 1, 1, 2, 0, 2, 2, 0 }, null)), CreateJobData()); 93 90 return result; 94 91 } 95 92 96 93 public static Schedule CreateTestSchedule2() { 97 Schedule result = DirectScheduleRandomCreator.Apply( 3, 3,new PWREncoding(3, 3, new TestRandom(new int[] { 0, 1, 1, 0, 2, 0, 1, 2, 2 }, null)), CreateJobData());94 Schedule result = DirectScheduleRandomCreator.Apply(new PWREncoding(3, 3, new TestRandom(new int[] { 0, 1, 1, 0, 2, 0, 1, 2, 2 }, null)), CreateJobData()); 98 95 return result; 99 96 }
Note: See TracChangeset
for help on using the changeset viewer.