AbstractListChromosomes for crossover
This crossover policy evaluates each gene of the parent chromosomes by chosing a
uniform random number p in the range [0, 1]. If p < ratio,
the parent genes are swapped. This means with a ratio of 0.7, 30% of the genes from the
first parent and 70% from the second parent will be selected for the first offspring (and
vice versa for the second offspring).
This 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 double | ratio
The mixing ratio. |
| Access | Constructor and Description |
|---|---|
| public | UniformCrossover(final double
the mixing ratio ratio)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 double | |
| private ChromosomePair | Returns: the pair of new chromosomes that resulted from the crossoverthe first chromosome first, final AbstractListChromosome<T> the second chromosome second)Helper for |
| ratio | back to summary |
|---|---|
| private final double ratio The mixing ratio. | |
| UniformCrossover | back to summary |
|---|---|
| public UniformCrossover(final double ratio) throws OutOfRangeException 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.
| |
| getRatio | back to summary |
|---|---|
| public double getRatio() Returns the mixing ratio used by this
| |
| mate | back to summary |
|---|---|
| private ChromosomePair mate(final AbstractListChromosome<T> first, final AbstractListChromosome<T> second) throws DimensionMismatchException Helper for
| |