コード例 #1
0
ファイル: Program.cs プロジェクト: devshorts/GeneticSummer
 private static void PrintEndPopulationStats(Population finalPopulation, EvolveConfig config, IndividualConfig individualConfig)
 {
     Console.WriteLine("Final population fitness {0}", finalPopulation.Grade());
     Console.WriteLine("Accepted values:");
     finalPopulation.Individuals.Where(i => Math.Round((i as Individual).Sum, config.Precision) == Math.Round(individualConfig.Target, config.Precision))
                                .GroupBy(i => i.ToString())
                                .ForEach(i => Console.WriteLine("{0} indiviuals {1} sum to {2}", i.Count(), i.First(), (i.First() as Individual).Sum));
 }
コード例 #2
0
ファイル: Evolver.cs プロジェクト: devshorts/GeneticSummer
        private bool ShouldEvolve(Population population)
        {
            var grade = population.Grade();

            Console.WriteLine(grade);

            return Math.Round(grade, Config.Precision) != Math.Round(0.0, Config.Precision);
        }