public virtual void Selection()
{
// amount of random chromosomes in the new population
int randomAmount = (int)(randomSelectionPortion * size);
// do selection
selectionMethod.ApplySelection(population, size - randomAmount);
// add random chromosomes
if (randomAmount > 0)
{
IChromosome ancestor = population[0];
for (int i = 0; i < randomAmount; i++)
{
// create new chromosome
IChromosome c = ancestor.CreateNew();
// calculate it's fitness
c.Evaluate(fitnessFunction);
// add it to population
population.Add(c);
}
}
FindBestChromosome();
}