Table of Contents

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

mutation BaseMutation

Numerical mutation operator used when an offspring coordinate is selected for mutation.

mutationProb double?

Per-parameter mutation probability; null selects the operator default.

crossover BaseCrossover

Operator combining the selected numerical parent vectors.

crossoverProb double

Probability of applying crossover to a mating.

swappingProb double

Probability of taking a coordinate from the alternate parent.

constraintsFunc Func<FrozenTrial, IEnumerable<double>>

Optional legacy callback returning constraint values; positive values violate a constraint.

rng LazyRandomState

Random stream whose draw order is shared with the reference algorithm.

conditionalParams ConditionalParams

Activation rules for parameters that only exist under some values of other parameters. null makes 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

study Study

Study supplying trial history, objective directions, and storage.

searchSpace OrderedDict<string, BaseDistribution>

Ordered parameter distributions defining the coordinates used by this operation.

parentPopulation List<FrozenTrial>

Eligible parent trials from the current generation.

Returns

OrderedDict<string, object>

External offspring parameter values produced by the configured reproduction strategy.