Пример #1
0
        public static void Main()
        {
            var engine = Engine.Engine
                         .Builder(Dist, Codecs.OfPermutation(Stops))
                         .Optimize(Optimize.Minimum)
                         .MaximalPhenotypeAge(11)
                         .PopulationSize(500)
                         .Alterers(
                new SwapMutator <EnumGene <int>, double>(0.2),
                new PartiallyMatchedCrossover <int, double>(0.35)
                )
                         .Build();

            var statistics = EvolutionStatistics.OfNumber <double>();

            var best = engine.Stream()
                       .TakeWhile(BySteadyFitness <EnumGene <int>, double>(15))
                       .Take(250)
                       .Peek(statistics.Accept)
                       .ToBestPhenotype();

            Console.WriteLine(statistics);
            Console.WriteLine(best);
        }