AbstractListChromosomes for crossover
To form a cycle the following procedure is applied:
p1 = (8 4 7 3 6 2 5 1 9 0) X c1 = (8 1 2 3 4 5 6 7 9 0) p2 = (0 1 2 3 4 5 6 7 8 9) X c2 = (0 4 7 3 6 2 5 1 8 9) cycle 1: 8 0 9 cycle 2: 4 1 7 2 5 6 cycle 3: 3This policy works only on
AbstractListChromosome, and therefore it
is parameterized by T. Moreover, the chromosomes must have same lengths.
| Modifier and Type | Field and Description |
|---|---|
| private final boolean | randomStart
If the start index shall be chosen randomly. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | CycleCrossover(final boolean
whether the start index shall be chosen randomly or be set to 0 randomStart)Creates a new |
| Modifier and Type | Method and Description |
|---|---|
| public ChromosomePair | crossover(final Chromosome
the first chromosome. first, final Chromosome the second chromosome. second)Implements org. Perform a crossover operation on the given chromosomes. |
| public boolean | Returns: true if the starting index is chosen randomly, false otherwiseReturns whether the starting index is chosen randomly or set to zero. |
| protected ChromosomePair | Returns: the pair of new chromosomes that resulted from the crossoverthe first chromosome first, final AbstractListChromosome<T> the second chromosome second)Helper for |
| randomStart | back to summary |
|---|---|
| private final boolean randomStart If the start index shall be chosen randomly. | |
| CycleCrossover | back to summary |
|---|---|
| public CycleCrossover() Creates a new | |
| CycleCrossover | back to summary |
|---|---|
| public CycleCrossover(final boolean randomStart) Creates a new
| |
| crossover | back to summary |
|---|---|
| public ChromosomePair crossover(final Chromosome first, final Chromosome second) throws DimensionMismatchException, MathIllegalArgumentException Implements org. Doc from org. Perform a crossover operation on the given chromosomes.
| |
| isRandomStart | back to summary |
|---|---|
| public boolean isRandomStart() Returns whether the starting index is chosen randomly or set to zero.
| |
| mate | back to summary |
|---|---|
| protected ChromosomePair mate(final AbstractListChromosome<T> first, final AbstractListChromosome<T> second) throws DimensionMismatchException Helper for
| |