- Type Parameters:
G- the gene type.
- All Implemented Interfaces:
- Direct Known Subclasses:
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.order()) of this Recombination implementation is two.
Constructors Modifier Constructor Description
Crossover(double probability)Constructs an alterer with a given recombination probability.
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description
protected abstract int
crossover(MSeq<G> that, MSeq<G> other)Template method which performs the crossover.
recombine(MSeq<Phenotype<G,C>> population, int individuals, long generation)Recombination template method.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected final int recombine(MSeq<Phenotype<G,C>> population, int individuals, long generation)Description copied from class:
RecombinatorRecombination template method. This method is called 0 to n times. It is guaranteed that this method is only called by one thread.
- Specified by:
Recombinator<G extends Gene<?,G>,C extends Comparable<? super C>>
population- the population to recombine
individuals- the array with the indexes of the individuals which are involved in the recombination step. The length of the array is
Recombinator.order(). The first individual is the primary individual.
generation- the current generation.
- the number of genes that has been altered.
crossoverTemplate method which performs the crossover. The arguments given are mutable non null arrays of the same length.
that- the genes of the first chromosome
other- the genes of the other chromosome
- the number of altered genes