예제 #1
0
 private void Run_Optimizer(object sender, RoutedEventArgs e)
 {
     var parameters = new GeneticAlgorithm.GeneticAlgorithmParameters
                          {
                              CrossoverRate = 0.85,
                              ElitismRate = 0.1,
                              Generations = 300,
                              MutationRate = 0.7,
                              PopulationSize = 50
                          };
     var optimizer = new GeneticCompoundFDPOptimizer(parameters);
     optimizer.GenerationExtincts += (generation) =>
                                         {
                                             Console.WriteLine("Generation {0}", generation);
                                             PrintChromosomes(optimizer);
                                         };
     optimizer.Run();
     Console.WriteLine("Last generation");
     PrintChromosomes(optimizer);
 }
예제 #2
0
        private void Run_Optimizer(object sender, RoutedEventArgs e)
        {
            var parameters = new GeneticAlgorithm.GeneticAlgorithmParameters
            {
                CrossoverRate  = 0.85,
                ElitismRate    = 0.1,
                Generations    = 300,
                MutationRate   = 0.7,
                PopulationSize = 50
            };
            var optimizer = new GeneticCompoundFDPOptimizer(parameters);

            optimizer.GenerationExtincts += (generation) =>
            {
                Console.WriteLine("Generation {0}", generation);
                PrintChromosomes(optimizer);
            };
            optimizer.Run();
            Console.WriteLine("Last generation");
            PrintChromosomes(optimizer);
        }