Package org.opt4j.operator.crossover
Class CrossoverDouble
- java.lang.Object
-
- org.opt4j.operator.crossover.CrossoverDouble
-
- All Implemented Interfaces:
Operator<DoubleGenotype>
,Crossover<DoubleGenotype>
- Direct Known Subclasses:
CrossoverDoubleElementwise
,CrossoverDoubleUnfairAverage
public abstract class CrossoverDouble extends Object implements Crossover<DoubleGenotype>
Crossover for theDoubleGenotype
.
-
-
Field Summary
Fields Modifier and Type Field Description protected NormalizeDouble
normalize
protected Random
random
-
Constructor Summary
Constructors Constructor Description CrossoverDouble(NormalizeDouble normalize, Rand random)
Constructs a new crossover for theDoubleGenotype
.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
crossover(List<Double> p1, List<Double> p2, List<Double> o1, List<Double> o2)
Performs a crossover of two parentGenotype
s that consist of double vectors.Pair<DoubleGenotype>
crossover(DoubleGenotype p1, DoubleGenotype p2)
Performs a crossover for twoGenotype
parents.
-
-
-
Field Detail
-
random
protected final Random random
-
normalize
protected final NormalizeDouble normalize
-
-
Constructor Detail
-
CrossoverDouble
@Inject public CrossoverDouble(NormalizeDouble normalize, Rand random)
Constructs a new crossover for theDoubleGenotype
.- Parameters:
normalize
- a normalize operatorrandom
- the random number generator
-
-
Method Detail
-
crossover
public Pair<DoubleGenotype> crossover(DoubleGenotype p1, DoubleGenotype p2)
Description copied from interface:Crossover
Performs a crossover for twoGenotype
parents. The resulting pair ofGenotype
offspring is returned.- Specified by:
crossover
in interfaceCrossover<DoubleGenotype>
- Parameters:
p1
- The first parent genotype for the crossoverp2
- The second parents genotype for the crossover- Returns:
- The resulting pair of offspring genotypes
-
-