Ejemplo n.º 1
0
        public void Step(int survivors, ISelector selector, IProcreator procreator, IEvaluator evaluator, Random random)
        {
            pooledPopulation.Clear();

            for (int i = 0; i < survivors; i++)
            {
                pooledPopulation.Append().GetChromosome().AddRange(CurrentPopulation.ReadOnlyIndividuals[i].Chromosome);
            }

            selector.Initialize(CurrentPopulation);
            while (pooledPopulation.Individuals.Count < CurrentPopulation.ReadOnlyIndividuals.Count)
            {
                procreator.Procreate(pooledPopulation.Append().GetChromosome(), selector, random);
            }

            pooledPopulation.Freeze(evaluator);

            Population temp = (Population)CurrentPopulation;

            CurrentPopulation = pooledPopulation;
            GenerationCount++;
            pooledPopulation = temp;
        }
Ejemplo n.º 2
0
        private void procreatePopulation(int population_size)
        {
            previous_last = population.Last();

            population = procreator.Procreate(population);
        }