// Offspring: Produces the entire new generation of offspring public List <Individual> Offspring() { Individual parent1, parent2, child; List <Individual> offspring = new List <Individual>(populationSize); for (int i = 0; i < populationSize; i++) { parent1 = SelectParent(); parent2 = SelectParent(); child = Breed(parent1, parent2); child.fitnesses = ghHandler.GetFitnessValues(); offspring.Add(child); } return(offspring); }
public Population(int size, GH_ParameterHandler _ghHandler) { populationSize = size; ghHandler = _ghHandler; nonDominatedFront = new List <Individual>(); fronts = new List <List <Individual> >(); population = new List <Individual>(); for (int i = 0; i < populationSize; i++) { Individual individual = new Individual(ghHandler); individual.fitnesses = ghHandler.GetFitnessValues(); population.Add(individual); } }