Class NsgaiiiCptChildGenerationStrategy
- Namespace
- OptunaSharp.Samplers.NsgaiiiCpt
- Assembly
- OptunaSharp.dll
The default child-generation strategy of NSGAIIICptSampler — the conditional-parameter
("Categorical Parameter Trees") counterpart of NSGAIIChildGenerationStrategy, and the
sole home of conditional child generation. It shares the genetic recipe with the Optuna-parity strategy
(crossover with probability crossover_prob else copy a parent; then per-parameter mutation at
mutation_prob, default 1 / len(params)), and adds the conditional handling the parity
strategy no longer carries.
Conditional parameters. With ConditionalParams declared, the search space may
hold parameters a parent lacks (inactive for it). Crossover then goes through
PerformConditionalCrossover(BaseCrossover, Study, IReadOnlyList<FrozenTrial>, OrderedDict<string, BaseDistribution>, NumPyRandom, double, Func<FrozenTrial, FrozenTrial, IReadOnlyList<StudyDirection>, bool>, ConditionalParams), the parent copy takes what the parent
carries, and every conditional parameter inactive for the child is pruned before the mutation pass — so
it is neither mutated nor counted in the default 1 / n_params. The mutation pass itself is
unchanged. With null rules this strategy is byte-for-byte the Optuna port (it delegates to the
shared PerformCrossover(BaseCrossover, Study, IReadOnlyList<FrozenTrial>, OrderedDict<string, BaseDistribution>, NumPyRandom, double, Func<FrozenTrial, FrozenTrial, IReadOnlyList<StudyDirection>, bool>)), so an NSGAIIICptSampler without
rules matches NSGAIIISampler.
public class NsgaiiiCptChildGenerationStrategy
- Inheritance
-
NsgaiiiCptChildGenerationStrategy
- Inherited Members
Constructors
NsgaiiiCptChildGenerationStrategy(BaseMutation?, double?, BaseCrossover, double, double, Func<FrozenTrial, IEnumerable<double>>?, LazyRandomState, ConditionalParams?)
Configures the genetic operators, selection randomness, and conditional-parameter policy used for offspring.
public NsgaiiiCptChildGenerationStrategy(BaseMutation? mutation, double? mutationProb, BaseCrossover crossover, double crossoverProb, double swappingProb, Func<FrozenTrial, IEnumerable<double>>? constraintsFunc, LazyRandomState rng, ConditionalParams? conditionalParams = null)
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.
conditionalParamsConditionalParamsActivation rules for parameters that only exist under some values of other parameters.
nullmakes the strategy behave as the Optuna-parity NSGAIIChildGenerationStrategy.
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.