Class NSGAIIChildGenerationStrategy
- Namespace
- OptunaSharp.Samplers.Nsgaii
- Assembly
- OptunaSharp.dll
The default child-generation strategy of NSGAIISampler. Port of
optuna/samplers/nsgaii/_child_generation_strategy.py: NSGAIIChildGenerationStrategy.
With probability crossover_prob a child is produced by crossover of tournament-selected
parents; otherwise a single parent is copied. Each parameter is then mutated with probability
mutation_prob (defaulting to 1 / len(params)): if a mutation object is set the
value is mutated in place, otherwise the parameter is dropped and later resampled independently.
This is a bit-exact Optuna port. The conditional-parameter ("Categorical Parameter Trees") counterpart that evolves branch-defined parameters is NsgaiiiCptChildGenerationStrategy, used by NSGAIIICptSampler.
public class NSGAIIChildGenerationStrategy
- Inheritance
-
NSGAIIChildGenerationStrategy
- Inherited Members
Constructors
NSGAIIChildGenerationStrategy(BaseMutation?, double?, BaseCrossover, double, double, Func<FrozenTrial, IEnumerable<double>>?, LazyRandomState)
Configures the genetic operators and selection randomness used for offspring.
public NSGAIIChildGenerationStrategy(BaseMutation? mutation, double? mutationProb, BaseCrossover crossover, double crossoverProb, double swappingProb, Func<FrozenTrial, IEnumerable<double>>? constraintsFunc, LazyRandomState rng)
Parameters
mutationBaseMutationNumerical mutation operator used when an offspring coordinate is selected for mutation.
mutationProbdouble?Per-parameter mutation probability; null selects the operator default.
crossoverBaseCrossoverOperator combining the selected numerical parent vectors.
crossoverProbdoubleProbability of applying crossover to a mating.
swappingProbdoubleProbability of taking a coordinate from the alternate parent.
constraintsFuncFunc<FrozenTrial, IEnumerable<double>>Optional legacy callback returning constraint values; positive values violate a constraint.
rngLazyRandomStateRandom stream whose draw order is shared with the reference algorithm.
Exceptions
- ValueError
A mutation, crossover, or swapping probability is outside its supported interval.
Methods
Generate(Study, OrderedDict<string, BaseDistribution>, List<FrozenTrial>)
Generate a child parameter dict from the given parent population (Python call).
public OrderedDict<string, object?> Generate(Study study, OrderedDict<string, BaseDistribution> searchSpace, List<FrozenTrial> parentPopulation)
Parameters
studyStudyStudy supplying trial history, objective directions, and storage.
searchSpaceOrderedDict<string, BaseDistribution>Ordered parameter distributions defining the coordinates used by this operation.
parentPopulationList<FrozenTrial>Eligible parent trials from the current generation.
Returns
- OrderedDict<string, object>
External offspring parameter values produced by the configured reproduction strategy.