- Timestamp:
- 04/20/20 16:18:23 (5 years ago)
- Location:
- branches/2521_ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Encodings.ScheduleEncoding-3.3
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Encodings.ScheduleEncoding-3.3/DirectScheduleGTCrossoverTest.cs
r17226 r17516 20 20 #endregion 21 21 22 using System.Linq;23 22 using HeuristicLab.Core; 24 using HeuristicLab.Encodings.ScheduleEncoding;25 23 using HeuristicLab.Tests; 26 24 using Microsoft.VisualStudio.TestTools.UnitTesting; … … 47 45 Schedule actual; 48 46 actual = DirectScheduleGTCrossover.Apply(random, parent1, parent2, jobData, mutProp); 49 Schedule expected = DirectScheduleRandomCreator.Apply(new PWR Encoding(3, 3, new TestRandom(new int[] { 0, 2, 1, 1, 0, 2, 1, 2, 0 }, null)), TestUtils.CreateJobData());47 Schedule expected = DirectScheduleRandomCreator.Apply(new PWR(3, 3, new TestRandom(new int[] { 0, 2, 1, 1, 0, 2, 1, 2, 0 }, null)), TestUtils.CreateJobData()); 50 48 Assert.IsTrue(TestUtils.ScheduleEquals(actual, expected)); 51 49 } -
branches/2521_ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Encodings.ScheduleEncoding-3.3/JSMJOXCrossoverTest.cs
r17226 r17516 40 40 public void ApplyTest() { 41 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); 42 JSM Encodingp1 = TestUtils.CreateTestJSM1();43 JSM Encodingp2 = TestUtils.CreateTestJSM2();44 JSM Encoding expected = new JSMEncoding(0);42 JSM p1 = TestUtils.CreateTestJSM1(); 43 JSM p2 = TestUtils.CreateTestJSM2(); 44 JSM expected = new JSM(0); 45 45 ItemList<Permutation> jsm = expected.JobSequenceMatrix; 46 46 for (int i = 0; i < 6; i++) { … … 49 49 50 50 51 JSM Encodingactual;51 JSM actual; 52 52 actual = JSMJOXCrossover.Apply(random, p1, p2); 53 53 -
branches/2521_ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Encodings.ScheduleEncoding-3.3/JSMSXXCrossoverTest.cs
r17226 r17516 40 40 public void ApplyTest() { 41 41 IRandom random = new TestRandom(new int[] { 0, 3 }, null); 42 JSM Encodingp1 = TestUtils.CreateTestJSM1();43 JSM Encodingp2 = TestUtils.CreateTestJSM2();44 JSM Encoding expected = new JSMEncoding(0);42 JSM p1 = TestUtils.CreateTestJSM1(); 43 JSM p2 = TestUtils.CreateTestJSM2(); 44 JSM expected = new JSM(0); 45 45 ItemList<Permutation> jsm = expected.JobSequenceMatrix; 46 46 for (int i = 0; i < 6; i++) { … … 48 48 } 49 49 50 JSM Encodingactual;50 JSM actual; 51 51 actual = JSMSXXCrossover.Apply(random, p1, p2); 52 52 -
branches/2521_ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Encodings.ScheduleEncoding-3.3/JSMShiftChangeManipulatorTest.cs
r17226 r17516 40 40 public void ApplyTest() { 41 41 IRandom random = new TestRandom(new int[] { 2, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2 }, null); 42 JSM Encodingindividual = TestUtils.CreateTestJSM1();42 JSM individual = TestUtils.CreateTestJSM1(); 43 43 JSMShiftChangeManipulator.Apply(random, individual); 44 JSM Encoding expected = new JSMEncoding(0);44 JSM expected = new JSM(0); 45 45 ItemList<Permutation> jsm = expected.JobSequenceMatrix; 46 46 for (int i = 0; i < 3; i++) { -
branches/2521_ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Encodings.ScheduleEncoding-3.3/PWRGOXCrossoverTest.cs
r17226 r17516 40 40 public void ApplyTest() { 41 41 IRandom random = new TestRandom(new int[] { 3 }, null); 42 PWR Encodingparent1 = TestUtils.CreateTestPWR1();43 PWR Encodingparent2 = TestUtils.CreateTestPWR2();44 PWR Encoding expected = new PWREncoding();42 PWR parent1 = TestUtils.CreateTestPWR1(); 43 PWR parent2 = TestUtils.CreateTestPWR2(); 44 PWR expected = new PWR(); 45 45 expected.PermutationWithRepetition = new IntegerVector(new int[] { 1, 0, 1, 0, 2, 0, 1, 2, 2 }); 46 PWR Encodingactual;46 PWR actual; 47 47 actual = PWRGOXCrossover.Apply(random, parent1, parent2); 48 48 Assert.IsTrue(TestUtils.PRWEncodingEquals(expected, actual)); -
branches/2521_ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Encodings.ScheduleEncoding-3.3/PWRPPXCrossoverTest.cs
r17226 r17516 40 40 public void ApplyTest() { 41 41 IRandom random = new TestRandom(new int[] { 1, 1, 0, 0, 1, 1, 0, 0, 1 }, null); 42 PWR Encodingparent1 = TestUtils.CreateTestPWR1();43 PWR Encodingparent2 = TestUtils.CreateTestPWR2();44 PWR Encoding expected = new PWREncoding();42 PWR parent1 = TestUtils.CreateTestPWR1(); 43 PWR parent2 = TestUtils.CreateTestPWR2(); 44 PWR expected = new PWR(); 45 45 expected.PermutationWithRepetition = new IntegerVector(new int[] { 1, 0, 1, 0, 1, 2, 0, 2, 2 }); 46 PWR Encodingactual;46 PWR actual; 47 47 actual = PWRPPXCrossover.Apply(random, parent1, parent2); 48 48 Assert.IsTrue(TestUtils.PRWEncodingEquals(expected, actual)); -
branches/2521_ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Encodings.ScheduleEncoding-3.3/TestUtils.cs
r17226 r17516 29 29 namespace HeuristicLab.Encodings.ScheduleEncoding.Tests { 30 30 public class TestUtils { 31 public static JSM EncodingCreateTestJSM1() {32 JSM Encoding result = new JSMEncoding(0);31 public static JSM CreateTestJSM1() { 32 JSM result = new JSM(0); 33 33 ItemList<Permutation> jsm = result.JobSequenceMatrix; 34 34 for (int i = 0; i < 6; i++) … … 37 37 } 38 38 39 public static JSM EncodingCreateTestJSM2() {40 JSM Encoding result = new JSMEncoding(0);39 public static JSM CreateTestJSM2() { 40 JSM result = new JSM(0); 41 41 ItemList<Permutation> jsm = result.JobSequenceMatrix; 42 42 for (int i = 0; i < 6; i++) … … 46 46 47 47 48 public static PWR EncodingCreateTestPWR1() {49 PWR Encoding result = new PWREncoding();48 public static PWR CreateTestPWR1() { 49 PWR result = new PWR(); 50 50 IntegerVector pwr = new IntegerVector(new int[] { 1, 0, 1, 1, 2, 0, 2, 2, 0 }); 51 51 result.PermutationWithRepetition = pwr; … … 53 53 } 54 54 55 public static PWR EncodingCreateTestPWR2() {56 PWR Encoding result = new PWREncoding();55 public static PWR CreateTestPWR2() { 56 PWR result = new PWR(); 57 57 IntegerVector pwr = new IntegerVector(new int[] { 0, 1, 1, 0, 2, 0, 1, 2, 2 }); 58 58 result.PermutationWithRepetition = pwr; … … 87 87 88 88 public static Schedule CreateTestSchedule1() { 89 Schedule result = DirectScheduleRandomCreator.Apply(new PWR Encoding(3, 3, new TestRandom(new int[] { 1, 0, 1, 1, 2, 0, 2, 2, 0 }, null)), CreateJobData());89 Schedule result = DirectScheduleRandomCreator.Apply(new PWR(3, 3, new TestRandom(new int[] { 1, 0, 1, 1, 2, 0, 2, 2, 0 }, null)), CreateJobData()); 90 90 return result; 91 91 } 92 92 93 93 public static Schedule CreateTestSchedule2() { 94 Schedule result = DirectScheduleRandomCreator.Apply(new PWR Encoding(3, 3, new TestRandom(new int[] { 0, 1, 1, 0, 2, 0, 1, 2, 2 }, null)), CreateJobData());94 Schedule result = DirectScheduleRandomCreator.Apply(new PWR(3, 3, new TestRandom(new int[] { 0, 1, 1, 0, 2, 0, 1, 2, 2 }, null)), CreateJobData()); 95 95 return result; 96 96 } … … 117 117 } 118 118 119 public static bool JSMEncodingEquals(JSM Encoding expected, JSMEncodingactual) {119 public static bool JSMEncodingEquals(JSM expected, JSM actual) { 120 120 if (expected.JobSequenceMatrix.Count != actual.JobSequenceMatrix.Count) 121 121 return false; … … 136 136 } 137 137 138 public static bool PRWEncodingEquals(PWR Encoding expected, PWREncodingactual) {138 public static bool PRWEncodingEquals(PWR expected, PWR actual) { 139 139 if (expected.PermutationWithRepetition.Length != actual.PermutationWithRepetition.Length) 140 140 return false;
Note: See TracChangeset
for help on using the changeset viewer.