public void RunPopulation(object thePopulationObject) { Population thePopulation = (Population)thePopulationObject; int NumberOfGenerations = 50000; for (int i = 0; i < NumberOfGenerations; i++) { thePopulation.NextGeneration(); if (i % (NumberOfGenerations / 20) == 0) { thePopulation.WriteNextGenerationTop(10); if (EquationGenome.PerfectFitness == true) { NumberOfGenerations = i; break; } } if (i % (NumberOfGenerations / 4) == 0) { EquationGenome[] EquationGenomesBest = (EquationGenome[])thePopulation.GetHighestScoreGenomes(Population.kNumberOfChoiceGenomes); CopyHighestFitnessToOtherPopulations(EquationGenomesBest); } } thePopulation.FinishedRunning = true; thePopulation.CalculateFitnessForAll(); EquationGenome EquationGenomeToIllustrate = (EquationGenome)thePopulation.GetHighestScoreGenome(); Console.WriteLine(""); Console.WriteLine("Best Genome in {1} after {0} Generations", NumberOfGenerations, thePopulation.Name); Console.WriteLine(EquationGenomeToIllustrate.ToString()); EquationGenomeToIllustrate = GetBestGeneFromAllPopulations(); Console.WriteLine("The next value in the series = {0}", EquationGenomeToIllustrate.CalculateNextValue()); Class1.EquationGenomeToIllustrate = EquationGenomeToIllustrate; // Console.ReadLine(); }