Free cookie consent management tool by TermsFeed Policy Generator

source: branches/Scheduling/HeuristicLab.Encodings.ScheduleEncoding.Tests/DirectScheduleGTCrossoverTest.cs @ 7634

Last change on this file since 7634 was 6475, checked in by jhelm, 13 years ago

#1329: Added DirectSchedule-Classes for optimization with the direct-schedule encoding.

File size: 2.5 KB
Line 
1using HeuristicLab.Core;
2using HeuristicLab.Encodings.ScheduleEncoding.PermutationWithRepetition;
3using HeuristicLab.Encodings.ScheduleEncoding.ScheduleEncoding;
4using Microsoft.VisualStudio.TestTools.UnitTesting;
5
6namespace HeuristicLab.Encodings.ScheduleEncoding.Tests {
7
8
9  /// <summary>
10  ///This is a test class for DirectScheduleGTCrossoverTest and is intended
11  ///to contain all DirectScheduleGTCrossoverTest Unit Tests
12  ///</summary>
13  [TestClass()]
14  public class DirectScheduleGTCrossoverTest {
15
16
17    private TestContext testContextInstance;
18
19    /// <summary>
20    ///Gets or sets the test context which provides
21    ///information about and functionality for the current test run.
22    ///</summary>
23    public TestContext TestContext {
24      get {
25        return testContextInstance;
26      }
27      set {
28        testContextInstance = value;
29      }
30    }
31
32    #region Additional test attributes
33    //
34    //You can use the following additional attributes as you write your tests:
35    //
36    //Use ClassInitialize to run code before running the first test in the class
37    //[ClassInitialize()]
38    //public static void MyClassInitialize(TestContext testContext)
39    //{
40    //}
41    //
42    //Use ClassCleanup to run code after all tests in a class have run
43    //[ClassCleanup()]
44    //public static void MyClassCleanup()
45    //{
46    //}
47    //
48    //Use TestInitialize to run code before running each test
49    //[TestInitialize()]
50    //public void MyTestInitialize()
51    //{
52    //}
53    //
54    //Use TestCleanup to run code after each test has run
55    //[TestCleanup()]
56    //public void MyTestCleanup()
57    //{
58    //}
59    //
60    #endregion
61
62
63    /// <summary>
64    ///A test for Apply
65    ///</summary>
66    [TestMethod()]
67    public void ApplyTest() {
68      IRandom random = new TestRandom(new int[] { 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1 }, null);
69      Schedule parent1 = TestUtils.CreateTestSchedule1();
70      Schedule parent2 = TestUtils.CreateTestSchedule2();
71      ItemList<Job> jobData = TestUtils.CreateJobData();
72      double mutProp = 0.05;
73      Schedule actual;
74      actual = DirectScheduleGTCrossover.Apply(random, parent1, parent2, jobData, mutProp);
75      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());
76      Assert.IsTrue(actual.Equals(expected));
77    }
78  }
79}
Note: See TracBrowser for help on using the repository browser.