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 TaskSchedulingSolution(ProblemBase problem) : base(problem)
        {
            TaskSchedulingProblem schedulingProblem = (Problem as TaskSchedulingProblem);

            this.GeneticMaterial = new int[2, schedulingProblem.TaskCount];

            IEnumerable <int> randomTaskPermutation = Aleatoriety.GetRandomIntegerSequencePermutation(0, schedulingProblem.TaskCount);

            int idx = 0;

            foreach (int task in randomTaskPermutation)
            {
                this.GeneticMaterial[0, idx] = task;
                this.GeneticMaterial[1, idx] = Aleatoriety.GetRandomInt(schedulingProblem.ProcessorCount);
                ++idx;
            }
        }
        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);
        }
        public TaskSchedulingSolution(ProblemBase problem, int[,] geneticMaterial) : base(problem)
        {
            TaskSchedulingProblem schedulingProblem = (Problem as TaskSchedulingProblem);

            this.GeneticMaterial = geneticMaterial;
        }