Beispiel #1
0
        protected Solution[] InitializePopulations(EvaluatorBase evaluator, ISeedingProcessor seedingProcessor = null)
        {
            var population = PopulationGenerator.GeneratePopulation(Parameters);

            if (seedingProcessor != null)
            {
                Stoper.Restart();
                population = seedingProcessor.Seed(population);
                Stoper.Stop();
                Statistics.SeedingTime = Stoper.Elapsed;
            }

            foreach (var solution in population)
            {
                solution.FitnessScore = evaluator.Evaluate(solution);
            }

            for (var i = 0; i < OffspringPopulation.Length; i++)
            {
                OffspringPopulation[i] = SolutionsFactory.Create(Parameters);
            }

            return(population);
        }
Beispiel #2
0
        public Solution RunEvolution(EvaluatorBase evaluator, ISeedingProcessor seedingProcessor)
        {
            BasePopulation = InitializePopulations(evaluator, seedingProcessor);

            return(Evolution(evaluator));
        }