Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/15/15 15:16:24 (9 years ago)
Author:
mkommend
Message:

#2521: Refactored problem base classes and adapted scheduling encoding, scheduling problem and unit tests.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Encodings.ScheduleEncoding-3.3/TestUtils.cs

    r12012 r13469  
    2424using HeuristicLab.Encodings.IntegerVectorEncoding;
    2525using HeuristicLab.Encodings.PermutationEncoding;
    26 using HeuristicLab.Encodings.ScheduleEncoding.JobSequenceMatrix;
    27 using HeuristicLab.Encodings.ScheduleEncoding.PermutationWithRepetition;
     26
    2827using HeuristicLab.Tests;
    2928
     
    3130  public class TestUtils {
    3231    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;
    3534      for (int i = 0; i < 6; i++)
    3635        jsm.Add(new Permutation(PermutationTypes.Absolute, new int[] { 0, 1, 2, 3, 4, 5 }));
    37       result.JobSequenceMatrix = jsm;
    3836      return result;
    3937    }
    4038
    4139    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;
    4442      for (int i = 0; i < 6; i++)
    4543        jsm.Add(new Permutation(PermutationTypes.Absolute, new int[] { 5, 4, 3, 2, 1, 0 }));
    46       result.JobSequenceMatrix = jsm;
    4744      return result;
    4845    }
     
    6663    public static ItemList<Job> CreateJobData() {
    6764      Job j1 = new Job(0, 0);
    68       j1.Tasks = new ItemList<Task> {
     65      j1.Tasks.AddRange(new[]{
    6966        new Task (0, 0, j1.Index, 1),
    7067        new Task (1, 1, j1.Index, 2),
    7168        new Task (2, 2, j1.Index, 1)
    72       };
     69      });
    7370
    7471      Job j2 = new Job(1, 0);
    75       j2.Tasks = new ItemList<Task> {
     72      j2.Tasks.AddRange(new[]{
    7673        new Task (3, 2, j2.Index, 2),
    7774        new Task (4, 1, j2.Index, 1),
    7875        new Task (5, 0, j2.Index, 2)
    79       };
     76      });
    8077
    8178      Job j3 = new Job(2, 0);
    82       j3.Tasks = new ItemList<Task> {
     79      j3.Tasks.AddRange(new[]{
    8380        new Task (6, 0, j3.Index, 1),
    8481        new Task (7, 2, j3.Index, 2),
    8582        new Task (8, 1, j3.Index, 1)
    86       };
     83      });
    8784
    8885      return new ItemList<Job> { j1, j2, j3 };
     
    9087
    9188    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());
    9390      return result;
    9491    }
    9592
    9693    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());
    9895      return result;
    9996    }
Note: See TracChangeset for help on using the changeset viewer.