Package org.opt4j.operators.crossover
Class CrossoverDouble
- java.lang.Object
-
- org.opt4j.operators.crossover.CrossoverDouble
-
- All Implemented Interfaces:
org.opt4j.core.optimizer.Operator<org.opt4j.core.genotype.DoubleGenotype>
,Crossover<org.opt4j.core.genotype.DoubleGenotype>
- Direct Known Subclasses:
CrossoverDoubleElementwise
,CrossoverDoubleUnfairAverage
public abstract class CrossoverDouble extends java.lang.Object implements Crossover<org.opt4j.core.genotype.DoubleGenotype>
Crossover for theDoubleGenotype
.
-
-
Field Summary
Fields Modifier and Type Field Description protected NormalizeDouble
normalize
protected java.util.Random
random
-
Constructor Summary
Constructors Constructor Description CrossoverDouble(NormalizeDouble normalize, org.opt4j.core.common.random.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(java.util.List<java.lang.Double> p1, java.util.List<java.lang.Double> p2, java.util.List<java.lang.Double> o1, java.util.List<java.lang.Double> o2)
Performs a crossover of two parentGenotype
s that consist of double vectors.Pair<org.opt4j.core.genotype.DoubleGenotype>
crossover(org.opt4j.core.genotype.DoubleGenotype p1, org.opt4j.core.genotype.DoubleGenotype p2)
Performs a crossover for twoGenotype
parents.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.opt4j.operators.crossover.Crossover
getOperatorType
-
-
-
-
Field Detail
-
random
protected final java.util.Random random
-
normalize
protected final NormalizeDouble normalize
-
-
Constructor Detail
-
CrossoverDouble
@Inject public CrossoverDouble(NormalizeDouble normalize, org.opt4j.core.common.random.Rand random)
Constructs a new crossover for theDoubleGenotype
.- Parameters:
normalize
- a normalize operatorrandom
- the random number generator
-
-
Method Detail
-
crossover
public Pair<org.opt4j.core.genotype.DoubleGenotype> crossover(org.opt4j.core.genotype.DoubleGenotype p1, org.opt4j.core.genotype.DoubleGenotype p2)
Description copied from interface:Crossover
Performs a crossover for twoGenotype
parents. The resulting pair ofGenotype
offspring is returned.
-
crossover
protected abstract void crossover(java.util.List<java.lang.Double> p1, java.util.List<java.lang.Double> p2, java.util.List<java.lang.Double> o1, java.util.List<java.lang.Double> o2)
Performs a crossover of two parentGenotype
s that consist of double vectors.- Parameters:
p1
- the first parentp2
- the second parento1
- the first offspringo2
- the second offspring
-
-