Accord.Genetic.Population.Regenerate C# (CSharp) Method

Regenerate() public method

Regenerate population.
The method regenerates population filling it with random chromosomes.
public Regenerate ( ) : void
return void
        public void Regenerate()
        {
            IChromosome ancestor = population[0];

            // clear population
            population.Clear();
            // add chromosomes to the population
            for (int i = 0; i < size; i++)
            {
                // create new chromosome
                IChromosome c = ancestor.CreateNew();
                // calculate it's fitness
                c.Evaluate(fitnessFunction);
                // add it to population
                population.Add(c);
            }
        }