示例#1
0
 public NSGA2(IMultiObjectiveGeneticOperation <T> reproduction,
              IChromosomeEvaluator <T> chromosomeEvaluator,
              IReadOnlyDictionary <T, double> coefficients)
 {
     _reproduction        = reproduction;
     _chromosomeEvaluator = chromosomeEvaluator;
     _offspringSelection  = new OffspringSelection <T>(coefficients);
 }
        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");
        }
示例#3
0
 /// <summary>
 /// If you set an IChromosomeEvaluator, the engine will use your ChromosomeEvaluator's evaluate method (and not the chromosome's default evaluate method).
 /// Since the IChromosomeEvaluator's SetEnvierment is called before the evaluation starts, your ChromosomeEvaluator can use use the information in the environment to evaluate the chromosomes.
 /// </summary>
 public GeneticSearchEngineBuilder SetCustomChromosomeEvaluator(IChromosomeEvaluator evaluator)
 {
     chromosomeEvaluator = evaluator;
     return(this);
 }