Package org.opt4j.operator.crossover
Class CrossoverListXPoint<G extends ListGenotype<?>>
- java.lang.Object
-
- org.opt4j.operator.crossover.CrossoverListXPoint<G>
-
- Direct Known Subclasses:
CrossoverBooleanXPoint
,CrossoverIntegerXPoint
public abstract class CrossoverListXPoint<G extends ListGenotype<?>> extends Object implements Crossover<G>
The
CrossoverListXPoint
performs a crossover onGenotype
objects that are lists of values.The crossover is performed on
x
points of theGenotype
.
-
-
Constructor Summary
Constructors Constructor Description CrossoverListXPoint(int x, Rand random)
Constructs aCrossoverListXPoint
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Pair<G>
crossover(G p1, G p2)
Performs a crossover for twoGenotype
parents.
-
-
-
Field Detail
-
x
protected final int x
-
random
protected final Random random
-
-
Constructor Detail
-
CrossoverListXPoint
@Inject public CrossoverListXPoint(int x, Rand random)
Constructs aCrossoverListXPoint
.- Parameters:
x
- the number of crossover pointsrandom
- the random number generator
-
-
Method Detail
-
crossover
public Pair<G> crossover(G p1, G p2)
Description copied from interface:Crossover
Performs a crossover for twoGenotype
parents. The resulting pair ofGenotype
offspring is returned.- Specified by:
crossover
in interfaceCrossover<G extends ListGenotype<?>>
- Parameters:
p1
- The first parent genotype for the crossoverp2
- The second parents genotype for the crossover- Returns:
- The resulting pair of offspring genotypes
-
-