Ejemplo n.º 1
0
        private List <Individual> NextGeneration(List <Individual> survivors)
        {
            // Elitism
            var nextGeneration = survivors.Take(EliteSize).ToList();

            // Cross-over
            while (nextGeneration.Count < Population.Count)
            {
                var mother = survivors[random.Next(survivors.Count)];
                var father = survivors[random.Next(survivors.Count)];
                nextGeneration.Add(Individual.CrossOver(mother, father));
            }

            return(nextGeneration);
        }