G - the gene type.public abstract class Crossover<G extends Gene<?,G>,C extends Comparable<? super C>> extends Recombinator<G,C>
Performs a
Crossover of two Chromosome. This crossover implementation can
handle genotypes with different length (different number of chromosomes). It
is guaranteed that chromosomes with the the same (genotype) index are chosen
for crossover.
The order (Recombinator.getOrder()) of this Recombination implementation is two.
_probabilityDEFAULT_ALTER_PROBABILITY| Modifier | Constructor and Description |
|---|---|
protected |
Crossover(double probability)
Constructs an alterer with a given recombination probability.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract int |
crossover(MSeq<G> that,
MSeq<G> other)
Template method which performs the crossover.
|
protected int |
recombine(Population<G,C> population,
int[] individuals,
long generation)
Recombination template method.
|
alter, getOrderequals, getProbability, hashCodeprotected Crossover(double probability)
probability - the recombination probabilityIllegalArgumentException - if the probability is not in the
valid range of [0, 1]protected final int recombine(Population<G,C> population, int[] individuals, long generation)
Recombinatorrecombine in class Recombinator<G extends Gene<?,G>,C extends Comparable<? super C>>population - the population to recombineindividuals - the array with the indexes of the individuals which
are involved in the recombination step. The length of the
array is Recombinator.getOrder(). The first individual is the
primary individual.generation - the current generation.protected abstract int crossover(MSeq<G> that, MSeq<G> other)
that - the genes of the first chromosomeother - the genes of the other chromosome© 2007-2017 Franz Wilhelmstötter (2017-04-28 16:50)