public void Individual_Equals_Test() { TaskSchedulingProblem Gauss18 = new TaskSchedulingProblem(TaskSchedulingInstanceDescription.Gauss18(2)); TaskSchedulingSolution thisObj = new TaskSchedulingSolution( Gauss18, new int[2, 18] { { 0, 5, 1, 2, 6, 10, 7, 3, 8, 11, 12, 4, 9, 13, 15, 16, 14, 17 }, { 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1 } } ); TaskSchedulingSolution thisObjAgain = new TaskSchedulingSolution( Gauss18, new int[2, 18] { { 0, 5, 1, 2, 6, 10, 7, 3, 8, 11, 12, 4, 9, 13, 15, 16, 14, 17 }, { 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1 } } ); TaskSchedulingSolution thatObj = new TaskSchedulingSolution( Gauss18, new int[2, 18] { { 0, 5, 1, 2, 6, 10, 7, 3, 8, 11, 12, 4, 9, 13, 15, 16, 14, 18 }, { 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1 } } ); Assert.AreEqual(thisObj, thisObjAgain); Assert.AreNotEqual(thisObj, thatObj); }
public void StaticProblem_EvaluateIndividual_Test() { TaskSchedulingProblem Gauss18 = new TaskSchedulingProblem(TaskSchedulingInstanceDescription.Gauss18(2)); TaskSchedulingSolution solution = new TaskSchedulingSolution( Gauss18, new int[2, 18] { { 0, 5, 1, 2, 6, 10, 7, 3, 8, 11, 12, 4, 9, 13, 15, 16, 14, 17 }, { 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1 } } ); Gauss18.ValidateIndividual(solution); Gauss18.EvaluateIndividual(solution); Assert.AreEqual(44.0, solution.MakeSpan); Assert.AreEqual(691.2, solution.SpentPower); solution = new TaskSchedulingSolution( Gauss18, new int[2, 18] { { 8, 5, 1, 2, 6, 10, 7, 3, 0, 11, 12, 4, 9, 13, 15, 16, 14, 17 }, { 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1 } } ); Gauss18.ValidateIndividual(solution); Gauss18.EvaluateIndividual(solution); Assert.AreEqual(48.0, solution.MakeSpan); Assert.AreEqual(691.2, solution.SpentPower); TaskSchedulingSolution solutionWithDeadLock = new TaskSchedulingSolution( Gauss18, new int[2, 18] { { 1, 10, 7, 8, 12, 0, 2, 6, 3, 11, 5, 4, 9, 13, 15, 16, 14, 17 }, { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } } ); Gauss18.ValidateIndividual(solutionWithDeadLock); Gauss18.EvaluateIndividual(solutionWithDeadLock); }