1 | using HeuristicLab.Core;
|
---|
2 | using HeuristicLab.Encodings.IntegerVectorEncoding;
|
---|
3 | using HeuristicLab.Encodings.PermutationEncoding;
|
---|
4 | using HeuristicLab.Encodings.ScheduleEncoding;
|
---|
5 | using HeuristicLab.Encodings.ScheduleEncoding.JobSequenceMatrix;
|
---|
6 | using HeuristicLab.Encodings.ScheduleEncoding.PermutationWithRepetition;
|
---|
7 | using HeuristicLab.Tests;
|
---|
8 |
|
---|
9 | namespace HeuristicLab.Encodings.ScheduleEncoding_33.Tests {
|
---|
10 | public class TestUtils {
|
---|
11 | public static JSMEncoding CreateTestJSM1() {
|
---|
12 | JSMEncoding result = new JSMEncoding();
|
---|
13 | ItemList<Permutation> jsm = new ItemList<Permutation>();
|
---|
14 | for (int i = 0; i < 6; i++)
|
---|
15 | jsm.Add(new Permutation(PermutationTypes.Absolute, new int[] { 0, 1, 2, 3, 4, 5 }));
|
---|
16 | result.JobSequenceMatrix = jsm;
|
---|
17 | return result;
|
---|
18 | }
|
---|
19 |
|
---|
20 | public static JSMEncoding CreateTestJSM2() {
|
---|
21 | JSMEncoding result = new JSMEncoding();
|
---|
22 | ItemList<Permutation> jsm = new ItemList<Permutation>();
|
---|
23 | for (int i = 0; i < 6; i++)
|
---|
24 | jsm.Add(new Permutation(PermutationTypes.Absolute, new int[] { 5, 4, 3, 2, 1, 0 }));
|
---|
25 | result.JobSequenceMatrix = jsm;
|
---|
26 | return result;
|
---|
27 | }
|
---|
28 |
|
---|
29 |
|
---|
30 | public static PWREncoding CreateTestPWR1() {
|
---|
31 | PWREncoding result = new PWREncoding();
|
---|
32 | IntegerVector pwr = new IntegerVector(new int[] { 1, 0, 1, 1, 2, 0, 2, 2, 0 });
|
---|
33 | result.PermutationWithRepetition = pwr;
|
---|
34 | return result;
|
---|
35 | }
|
---|
36 |
|
---|
37 | public static PWREncoding CreateTestPWR2() {
|
---|
38 | PWREncoding result = new PWREncoding();
|
---|
39 | IntegerVector pwr = new IntegerVector(new int[] { 0, 1, 1, 0, 2, 0, 1, 2, 2 });
|
---|
40 | result.PermutationWithRepetition = pwr;
|
---|
41 | return result;
|
---|
42 | }
|
---|
43 |
|
---|
44 |
|
---|
45 | public static ItemList<Job> CreateJobData() {
|
---|
46 | Job j1 = new Job(0, 0);
|
---|
47 | j1.Tasks = new ItemList<Task> {
|
---|
48 | new Task (0, 0, j1.Index, 1),
|
---|
49 | new Task (1, 1, j1.Index, 2),
|
---|
50 | new Task (2, 2, j1.Index, 1)
|
---|
51 | };
|
---|
52 |
|
---|
53 | Job j2 = new Job(1, 0);
|
---|
54 | j2.Tasks = new ItemList<Task> {
|
---|
55 | new Task (3, 2, j2.Index, 2),
|
---|
56 | new Task (4, 1, j2.Index, 1),
|
---|
57 | new Task (5, 0, j2.Index, 2)
|
---|
58 | };
|
---|
59 |
|
---|
60 | Job j3 = new Job(2, 0);
|
---|
61 | j3.Tasks = new ItemList<Task> {
|
---|
62 | new Task (6, 0, j3.Index, 1),
|
---|
63 | new Task (7, 2, j3.Index, 2),
|
---|
64 | new Task (8, 1, j3.Index, 1)
|
---|
65 | };
|
---|
66 |
|
---|
67 | return new ItemList<Job> { j1, j2, j3 };
|
---|
68 | }
|
---|
69 |
|
---|
70 | public static Schedule CreateTestSchedule1() {
|
---|
71 | 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());
|
---|
72 | return result;
|
---|
73 | }
|
---|
74 |
|
---|
75 | public static Schedule CreateTestSchedule2() {
|
---|
76 | 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());
|
---|
77 | return result;
|
---|
78 | }
|
---|
79 | }
|
---|
80 | }
|
---|