//The Step function assumes that the fitness values of all the individuals in the population have been calculated. public override void Step() { List <Individual> new_pop = new List <Individual> (); updateReport(); //called to get some stats // fills the rest with mutations of the best ! for (int i = 0; i < populationSize; i++) { HillClimberIndividual tmp = (HillClimberIndividual)overallBest.Clone(); tmp.Mutate(mutationProbability); new_pop.Add(tmp.Clone()); } population = new_pop; generation++; }
//The Step function assumes that the fitness values of all the individuals in the population have been calculated. public override void Step() { List<Individual> newPopRed = new List<Individual> (); List<Individual> newPopBlue = new List<Individual>(); updateReport (); //called to get some stats // fills the rest with mutations of the best ! for (int i = 0; i < populationSize ; i++) { HillClimberIndividual tmpRed = (HillClimberIndividual) overallBestRed.Clone (); HillClimberIndividual tmpBlue = (HillClimberIndividual) overallBestBlue.Clone(); tmpRed.Mutate (mutationProbabilityRedPopulation); tmpBlue.Mutate(mutationProbabilityBluePopulation); newPopRed.Add (tmpRed.Clone()); newPopBlue.Add(tmpBlue.Clone()); } populationRed = newPopRed; populationBlue = newPopBlue; generation++; }