示例#1
0
        private static IEnumerable <IndividualBase> NSGA2Test(ProblemBase mainProblem)
        {
            MultiObjectiveGeneticAlgorithm NSGA2 = new NSGA2(
                mainProblem,
                200,
                200,
                400,
                2);

            return(NSGA2.Execute());
        }
示例#2
0
        private static IEnumerable <IndividualBase> SPEA2MultiExecution(int executionCount, ProblemBase problem, int populationSize)
        {
            MultiObjectiveGeneticAlgorithm SPEA2 = new NSGA2(
                problem,
                populationSize,
                200,
                200,
                10);

            Population_MultiObjective_AG Aggregator = new Population_MultiObjective_AG(problem);

            for (int i = 0; i < executionCount; ++i)
            {
                IEnumerable <IndividualBase> executionResult = SPEA2.Execute();
                Aggregator.AddRange(executionResult);
            }

            IEnumerable <IndividualBase> nonDominatedFront    = Aggregator.FastNonDominatedSort().First().Content;
            IEnumerable <IndividualBase> firstItemsByMakeSpan = (from i in nonDominatedFront.Cast <TaskSchedulingSolution>()
                                                                 group i by i.MakeSpan into g
                                                                 select g.First()).OrderBy(I => I.MakeSpan);

            return(firstItemsByMakeSpan);
        }