public void TestWindowsOneInvalid()
        {
            // create problem.
            var problem = TSPTWHelper.CreateTSPTW(0, 0, 5, 10);

            problem.Windows[1] = new TimeWindow()
            {
                Min = 5,
                Max = 15
            };
            problem.Windows[2] = new TimeWindow()
            {
                Min = 15,
                Max = 25
            };
            problem.Windows[3] = new TimeWindow()
            {
                Min = 25,
                Max = 29 // invalid max.
            };
            problem.Windows[4] = new TimeWindow()
            {
                Min = 35,
                Max = 45
            };

            // calculate objective function.
            var objective = new TSPTWFeasibleObjective();

            Assert.AreEqual(1, objective.Calculate(problem, new Optimization.Tours.Tour(new int[] { 0, 1, 2, 3, 4 })));
        }
        public void TestWindowsValidOnlyWithWait()
        {
            // create problem.
            var problem = TSPTWHelper.CreateTSPTW(0, 0, 5, 10);

            problem.Windows[1] = new TimeWindow()
            {
                Min = 5,
                Max = 15
            };
            problem.Windows[2] = new TimeWindow()
            {
                Min = 15,
                Max = 25
            };
            problem.Windows[3] = new TimeWindow()
            {
                Min = 35, // wait here until it's '35'.
                Max = 45
            };
            problem.Windows[4] = new TimeWindow()
            {
                Min = 45,
                Max = 55
            };

            // calculate objective function.
            var objective = new TSPTWFeasibleObjective();

            Assert.AreEqual(0, objective.Calculate(problem, new Optimization.Tours.Tour(new int[] { 0, 1, 2, 3, 4 })));
        }
        public void TestNoWindows()
        {
            // create problem.
            var problem = TSPTWHelper.CreateTSPTW(0, 0, 5, 10);

            // calculate objective function.
            var objective = new TSPTWFeasibleObjective();

            Assert.AreEqual(0, objective.Calculate(problem, new Optimization.Tours.Tour(new int[] { 0, 1, 2, 3, 4 })));
        }