public void NewGeneration() { if (!Population.Any()) { return; } CalculateFitness(); var newPopulation = new List <Dna <T> >(); for (int i = 0; i < Population.Count; i++) { Dna <T> parent1 = ChooseParent(); Dna <T> parent2 = ChooseParent(); Dna <T> child = parent1.Crossover(parent2); child.Mutate(MutationRate); newPopulation.Add(child); } Population = newPopulation; Generation++; }