コード例 #1
0
 void MainLoop()
 {
     while (!population.IsFinished())
     {
         population.NaturalSelection();
         population.Generate();
         population.CalcFitness();
         string result = population.GetBest();
         Console.WriteLine("Current best: " + result);
         Console.WriteLine("Average fitness: " + (int)(population.AverageFitness() * 100) + "%");
         Console.WriteLine("Generations: " + population.generations);
         Console.WriteLine("Mutation rate: " + mutationRate * 100 + "%");
         Console.WriteLine();
     }
     Console.ReadKey();
 }