Exemplo n.º 1
0
        //! Start Pseudo BruteForce method

        /*!
         *  /param SChedulerInterface scheduler to run
         *  /param SchedulingProblem to solve
         *  /param Main mainform to update Information
         *  Currently can only be called with the greedy scheduler
         */
        public static void startBruteForce(SchedulerInterface scheduler, SchedulingProblem problem, Main mainform)
        {
            if (scheduler.GetType() == typeof(GreedyScheduler))
            {
                TimeMeasurement tm          = new TimeMeasurement();
                GreedyScheduler greedy      = (GreedyScheduler)scheduler;
                double          bestFitness = 0.0;
                for (int iteration = 0; iteration < problem.getContactWindows().Count(); iteration++)
                {
                    tm.activate();
                    greedy.BruteForceSchedule(problem, iteration);
                    mainform.updateCalculationTime(tm.getValueAndDeactivate());
                    ObjectiveFunction obj = problem.getObjectiveFunction();
                    obj.calculateValues(greedy.getFinischedSchedule());
                    mainform.updateCalculationTime(tm.getValueAndDeactivate());
                    mainform.setNumberOfGeneration(iteration);
                    if (bestFitness <= obj.getObjectiveResults())
                    {
                        bestFitness = obj.getObjectiveResults();
                        displayResults(mainform, scheduler, iteration);
                    }
                }
            }
            //else do nothing
        }
Exemplo n.º 2
0
        //! Start Scheduler

        /*!
         *  /param SchedulerInterface scheduler to run
         *  /param SchedulingProblems problem to solve
         */
        public static void startScheduler(SchedulerInterface scheduler, SchedulingProblem problem)
        {
            scheduler.setObjectiveFunktion(problem.getObjectiveFunction());
            scheduler.CalculateSchedule(problem);
        }