Package org.opt4j.operator.crossover
Class CrossoverListRate<G extends ListGenotype<?>>
- java.lang.Object
-
- org.opt4j.operator.crossover.CrossoverListRate<G>
-
- Direct Known Subclasses:
CrossoverBooleanRate
,CrossoverIntegerRate
public abstract class CrossoverListRate<G extends ListGenotype<?>> extends Object implements Crossover<G>
The
CrossoverListRate
performs a crossover onGenotype
objects that are lists of values.A point of crossover of the list is selected with a given
rate
.
-
-
Constructor Summary
Constructors Constructor Description CrossoverListRate(double rate, Rand random)
Constructs a newCrossoverListRate
.
-
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
-
random
protected final Random random
-
rate
protected final double rate
-
-
Constructor Detail
-
CrossoverListRate
@Inject public CrossoverListRate(double rate, Rand random)
Constructs a newCrossoverListRate
.- Parameters:
rate
- the rate for a crossoverrandom
- 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
-
-