Class NSGAIIIElitePopulationSelectionStrategy
- Namespace
- OptunaSharp.Samplers.Nsgaiii
- Assembly
- OptunaSharp.dll
The default elite-population selection strategy of NSGAIIISampler. Port of
optuna/samplers/_nsgaiii/_elite_population_selection_strategy.py.
Ranks the combined population by (constrained) non-domination (shared
RankPopulation(IReadOnlyList<FrozenTrial>, IReadOnlyList<StudyDirection>, bool)), then fills the elite
population rank by rank. The rank that overflows population_size — the borderline front —
is truncated by reference-point niching rather than crowding distance: objective values
are normalized onto a hyperplane (ideal point + achievement-scalarizing extreme points), each
individual is associated with its closest reference point, and survivors are drawn to keep the
reference points as evenly populated (sparse) as possible.
Bit-exact. The whole pipeline matches Optuna bit-for-bit: _filter_inf,
the ideal-point subtraction, the ASF einsum/argmin extreme-point pick, the
reference-point association (numpy's 4-operand einsum replicated term-by-term, verified
bit-identical over 2000 cases; its two np.linalg.norm(axis=...) calls and the axis
argmin/min run through NumSharp, so the row sums take NumPy's pairwise order from
eight objectives on — before 2026-11-11 they were left-to-right sums, exact only up to seven
objectives), the niching, and — since 2.15 — the hyperplane fit itself: the
degeneracy MatrixRank(double[,]) branch and the Solve(double[,], double[]) route
through NumSharp's np.linalg.matrix_rank/solve over the OpenBLAS LAPACK backend,
which is byte-identical to NumPy (the earlier managed reciprocal-multiplier LU drifted ~1 ULP
on a few percent of the extreme-point systems; the LAPACK route removes even that). Every RNG
draw (rng.shuffle) stays in lock-step. Confirmed byte-for-byte over a 400-config
differential (5 crossovers × {2,3,4} objectives × 25 seeds + 25 constrained); the many-objective
regime (8 and 10 objectives) is pinned by the live
NsgaiiiSamplerParityTests.ManyObjectives_FullState_IsBitIdentical.
public class NSGAIIIElitePopulationSelectionStrategy
- Inheritance
-
NSGAIIIElitePopulationSelectionStrategy
- Inherited Members
Constructors
NSGAIIIElitePopulationSelectionStrategy(int, LazyRandomState, Func<FrozenTrial, IEnumerable<double>>?, double[,]?, int)
Configures nondomination ranking and reference-point niching to a fixed population size.
public NSGAIIIElitePopulationSelectionStrategy(int populationSize, LazyRandomState rng, Func<FrozenTrial, IEnumerable<double>>? constraintsFunc = null, double[,]? referencePoints = null, int dividingParameter = 3)
Parameters
populationSizeintNumber of individuals retained or evaluated per generation.
rngLazyRandomStateRandom stream whose draw order is shared with the reference algorithm.
constraintsFuncFunc<FrozenTrial, IEnumerable<double>>Optional legacy callback returning constraint values; positive values violate a constraint.
referencePointsdouble[,]Reference vectors, one row per point and one column per objective.
dividingParameterintNumber of simplex divisions used to generate reference points.
Exceptions
- ValueError
Population size is below two.
Methods
Select(Study, List<FrozenTrial>)
Select the elite population from the given trials by the NSGA-III algorithm (Python
call).
public List<FrozenTrial> Select(Study study, List<FrozenTrial> population)
Parameters
studyStudyStudy supplying trial history, objective directions, and storage.
populationList<FrozenTrial>Individuals available for survival or reproduction.
Returns
- List<FrozenTrial>
The individuals retained by the configured survival rule, in selection order.
Exceptions
- ValueError
The reference-point dimension does not match the study objective count.