Class UniformCrossover
- Namespace
- OptunaSharp.Samplers.Nsgaii
- Assembly
- OptunaSharp.dll
Uniform Crossover operation used by NSGAIISampler. Port of
optuna/samplers/nsgaii/_crossovers/_uniform.py: UniformCrossover.
Select each parameter with equal probability from the two parent individuals.
public class UniformCrossover : BaseCrossover
- Inheritance
-
UniformCrossover
- Inherited Members
Constructors
UniformCrossover(double)
Configures the probability that an offspring coordinate comes from the second parent.
public UniformCrossover(double swappingProb = 0.5)
Parameters
swappingProbdoubleProbability of swapping each parameter of the parents during crossover.
Exceptions
- ValueError
The swapping probability is outside [0, 1].
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.