Class UNDXCrossover
- Namespace
- OptunaSharp.Samplers.Nsgaii
- Assembly
- OptunaSharp.dll
Unimodal Normal Distribution Crossover used by NSGAIISampler. Port of
optuna/samplers/nsgaii/_crossovers/_undx.py: UNDXCrossover (experimental v3.0.0).
Generates a child from three parents using a multivariate normal distribution.
QR sign parity (n > 1). The orthonormal basis orthogonal to the primary search
line comes from np.linalg.qr (LAPACK dgeqrf/dorgqr). QR is unique only up
to the signs of R's diagonal, and those signs propagate into the basis vectors: get them wrong
and, with two or more numerical parameters, the child values differ from Optuna by O(1), which
then cascades through the crowding-distance/non-domination selection and diverges the whole
study trajectory. So the basis is computed through QrQ(double[,]) (OpenBLAS/LAPACK —
column signs byte-identical to NumPy) whenever the native backend is present, which is the
normal case and gives full Optuna parity here (to the ~1e-14 managed-vs-LAPACK tolerance the
downstream selection is insensitive to).
[Misaligned] no-native (Tier N) fallback. Without OpenBLAS the basis falls back to
a managed Householder QR (HouseholderQ(double[,], int)) that matches numpy's magnitudes to
~1e-14 but not its per-column signs (its accumulated Q = Q·Hₖ flips signs vs
orgqr). UNDX still samples correctly — etas ~ N(0, σ²) is symmetric, so a
sign-flipped basis is a valid draw and the study stays in RNG lock-step within OptunaSharp —
but its trajectory can sign-diverge from Optuna for ≥2-numerical-parameter spaces. A single
numerical parameter is bit-exact on either path (the basis is unused).
public class UNDXCrossover : BaseCrossover
- Inheritance
-
UNDXCrossover
- Inherited Members
Constructors
UNDXCrossover(double, double?)
Configures normal offspring variation along and perpendicular to the primary parent axis.
public UNDXCrossover(double sigmaXi = 0.5, double? sigmaEta = null)
Parameters
sigmaXidoubleParametrizes the normal distribution from which
xiis drawn.sigmaEtadouble?Parametrizes the normal distribution from which
etasare drawn. Defaults to0.35 / sqrt(len(search_space)).
Properties
NParents
Number of parent individuals required to perform crossover.
public override int NParents { get; }
Property Value
Methods
Crossover(double[][], NumPyRandom, Study, double[,])
Perform crossover of selected parent individuals.
public override double[] Crossover(double[][] parentsParams, NumPyRandom rng, Study study, double[,] searchSpaceBounds)
Parameters
parentsParamsdouble[][]A
num_parents x num_parametersarray. Represents a parameter space for each parent individual (continuous for numerical parameters). Rowiis parenti.rngNumPyRandomAn instance of
numpy.random.RandomState.studyStudyTarget study object.
searchSpaceBoundsdouble[,]A
len_search_space x 2array of numerical distribution bounds constructed from the transformed search space. Column 0 is lower, column 1 is upper.
Returns
- double[]
A 1-dimensional array containing the new parameter combination.