Beispiel #1
0
        protected void PreBuildActions()
        {
            if (environment == null && chromosomeEvaluator.GetType() != typeof(BassicChromosomeEvaluator))
            {
                environment = new DefaultEnvironment();
            }

            if (mutationManager == null)
            {
                mutationManager = new BasicMutationProbabilityManager(mutationProbability);
            }
        }
        public GeneticSearchOptions(int populationSize, List <IStopManager> stopManagers, bool includeAllHistory,
                                    List <IPopulationRenwalManager> populationRenwalManagers, double elitePercentage, IMutationProbabilityManager mutationManager, List <IPopulationConverter> populationConverters, IChromosomeEvaluator chromosomeEvaluator)
        {
            StopManagers             = stopManagers;
            IncludeAllHistory        = includeAllHistory;
            PopulationRenwalManagers = populationRenwalManagers;
            AssertIsBetweenZeroAndOne(elitePercentage, nameof(elitePercentage));
            ElitePercentage      = elitePercentage;
            MutationManager      = mutationManager;
            PopulationConverters = populationConverters;
            ChromosomeEvaluator  = chromosomeEvaluator;

            PopulationSize = populationSize > 0
                ? populationSize
                : throw new GeneticAlgorithmException(nameof(populationSize) + " must be greater then zero");
        }
Beispiel #3
0
 public ChildrenGenerator(ICrossoverManager crossoverManager, IMutationProbabilityManager mutationManager, ISelectionStrategy selectionStrategy)
 {
     this.crossoverManager  = crossoverManager;
     this.mutationManager   = mutationManager;
     this.selectionStrategy = selectionStrategy;
 }
Beispiel #4
0
 /// <summary>
 /// A Custom Mutation Manager lets you dynamically determine the probability of a mutation based on the current population.
 /// For instance, you might want to set a high mutation probability for a few generations if the population is homogeneous, and lower it while the population is diversified.
 /// </summary>
 public GeneticSearchEngineBuilder SetCustomMutationProbabilityManager(IMutationProbabilityManager manager)
 {
     mutationManager = manager;
     return(this);
 }