T
- generic type of the AbstractListChromosome
s for crossoverpublic class OnePointCrossover<T> extends Object implements CrossoverPolicy
-C- denotes a crossover point -C- -C- p1 = (1 0 1 0 0 1 | 0 1 1) X p2 = (0 1 1 0 1 0 | 1 1 1) \------------/ \-----/ \------------/ \-----/ || (*) || (**) VV (**) VV (*) /------------\ /-----\ /------------\ /-----\ c1 = (1 0 1 0 0 1 | 1 1 1) X c2 = (0 1 1 0 1 0 | 0 1 1)This policy works only on
AbstractListChromosome
, and therefore it
is parameterized by T. Moreover, the chromosomes must have same lengths.Constructor and Description |
---|
OnePointCrossover() |
Modifier and Type | Method and Description |
---|---|
ChromosomePair |
crossover(Chromosome first,
Chromosome second)
Performs one point crossover.
|
public ChromosomePair crossover(Chromosome first, Chromosome second)
-C- denotes a crossover point -C- -C- p1 = (1 0 1 0 0 1 | 0 1 1) X p2 = (0 1 1 0 1 0 | 1 1 1) \------------/ \-----/ \------------/ \-----/ || (*) || (**) VV (**) VV (*) /------------\ /-----\ /------------\ /-----\ c1 = (1 0 1 0 0 1 | 1 1 1) X c2 = (0 1 1 0 1 0 | 0 1 1)
crossover
in interface CrossoverPolicy
first
- first parent (p1)second
- second parent (p2)MathIllegalArgumentException
- iff one of the chromosomes is
not an instance of AbstractListChromosome
DimensionMismatchException
- if the length of the two chromosomes is differentCopyright © 2019 CNES. All rights reserved.