Class NsgaiiiCptSearchSpace
- Namespace
- OptunaSharp.Samplers.NsgaiiiCpt
- Assembly
- OptunaSharp.dll
The conditional-parameter search space of NSGAIIICptSampler — an OptunaSharp extension with no Optuna analog, extracted here so that IntersectionSearchSpace and every other sampler stay a bit-exact Optuna port. It is the sole home of the "Categorical Parameter Trees" (CPT) search-space fold.
Unconditional parameters intersect exactly as Optuna's IntersectionSearchSpace does (this class delegates to the shared parity fold Calculate(IReadOnlyList<FrozenTrial>, bool, OrderedDict<string, BaseDistribution>, int) for that). A parameter declared conditional in the supplied ConditionalParams is instead kept when a trial lacks it (it was inactive there), joins the space the first time any trial carries it, and is excluded for good once two trials carry it with conflicting distributions — so, like the intersection, the result is order-independent. Completed trials whose parameter set contradicts the declared rules are reported once per parameter through OptunaSharp.Internal.OptunaWarnings.
Parity contract. Constructed with a null rule set this class is a byte-for-byte
pass-through to the shared intersection fold, so an NSGAIIICptSampler without rules is
identical to NSGAIIISampler. The customized behavior only runs when rules are present.
public sealed class NsgaiiiCptSearchSpace
- Inheritance
-
NsgaiiiCptSearchSpace
- Inherited Members
Constructors
NsgaiiiCptSearchSpace(ConditionalParams?, bool)
Creates a per-study incremental search-space cache aware of the declared conditional parameters.
public NsgaiiiCptSearchSpace(ConditionalParams? conditionalParams, bool includePruned = false)
Parameters
conditionalParamsConditionalParamsThe activation rules that tell a conditional parameter's inactive absence from a trial apart from a genuinely missing observation.
nullmakes this a plain intersection (Optuna parity).includePrunedboolWhether pruned trials should contribute their recorded parameter distributions.
Methods
Calculate(Study, bool)
Returns the (conditional-aware) search space of the Study, mirroring Calculate(Study, bool)'s per-study incremental cache contract.
public OrderedDict<string, BaseDistribution> Calculate(Study study, bool useCache = false)
Parameters
studyStudyA study with completed trials. The same study must be passed for one instance of this class through its lifetime.
useCacheboolWhether to read the study's cached trial snapshots.
Returns
- OrderedDict<string, BaseDistribution>
The parameter names and distributions, sorted by ordinal parameter name.
Remarks
The returned dictionary is a new sorted container. Distribution objects are shared with trial snapshots and treated as immutable.
Exceptions
- ValueError
This cache is reused with a different study identifier.
IntersectionSearchSpaceOf(IReadOnlyList<FrozenTrial>, ConditionalParams, bool)
The conditional-aware search space of the given trials in one shot (no incremental cache) — the intersection over unconditional parameters plus every conditional parameter some trial suggested whose distribution never changed. See CalculateConditional(IReadOnlyList<FrozenTrial>, bool, OrderedDict<string, BaseDistribution>, int, ConditionalParams, HashSet<string>, HashSet<string>).
public static OrderedDict<string, BaseDistribution> IntersectionSearchSpaceOf(IReadOnlyList<FrozenTrial> trials, ConditionalParams conditionalParams, bool includePruned = false)
Parameters
trialsIReadOnlyList<FrozenTrial>Trial snapshots to inspect.
conditionalParamsConditionalParamsThe declared activation rules used to distinguish inactive parameters from missing observations.
includePrunedboolWhether pruned trials contribute their recorded parameter distributions.
Returns
- OrderedDict<string, BaseDistribution>
The parameter names and distributions, sorted by ordinal parameter name.
Exceptions
- ArgumentNullException
The conditional-parameter rule collection is null.