/// Do selection public virtual void Selection() { // amount of random chromosomes in the new population double randomAmount = randomSelectionPortion * (double)population.Count; // do selection RouletteWheelSelection r = new RouletteWheelSelection(); r.ApplySelection(population); // population is reduced // add random chromosomes if (randomAmount > 0) { Chromosome ancestor = (Chromosome)population[0]; for (int i = 0; i < randomAmount; i++) { // create new chromosome Chromosome c = ancestor.CreateOffspring(); // calculate it's fitness add it to population if fit Evaluate(c); } } }