Module io.jenetics.base
Package io.jenetics
Class UniformOderBasedCrossover<T,C extends Comparable<? super C>>
public class UniformOderBasedCrossover<T,C extends Comparable<? super C>>
extends Crossover<EnumGene<T>,C>
The
UniformOderBasedCrossover
guarantees that all Gene
s
are found exactly once in each chromosome. No gene is duplicated by this
crossover. This crossover can be applied usefully in the TSP or other
permutation problem encodings. Permutation encoding is useful for all
problems where fitness only depends on the ordering of the genes within
the chromosome. This is the case in many combinatorial optimization problems.
Other crossover operators for combinatorial optimization are:
- order crossover
- cycle crossover
- edge recombination crossover
- edge assembly crossover
- partially matched crossover
Within the uniform order-based crossover, a set of positions are chosen randomly. The genes at the positions are reordered in the order they occur in the other parent.
C1 = 0123456789 C2 = 9876543210 Positions = 2, 4, 5, 7, 8The values at the positions are removed
C1 = 01_3__6__9 C2 = 9__6__3_10 Order of removed values in C1 = 2, 4, 5, 7, 8 Order of removed values in C2 = 8, 7, 5, 4, 2The removed values are added in the order they occur in the other chromosome
C1 = 0183756429 C2 = 9246573810
- Since:
- 8.0
- Version:
- 8.0
- See Also:
-
Field Summary
Fields inherited from class io.jenetics.AbstractAlterer
_probability
Fields inherited from interface io.jenetics.Alterer
DEFAULT_ALTER_PROBABILITY
-
Constructor Summary
ConstructorDescriptionUniformOderBasedCrossover
(double probability) Create a new UniformOrderBasedCrossover instance -
Method Summary
Methods inherited from class io.jenetics.Recombinator
alter, order
Methods inherited from class io.jenetics.AbstractAlterer
probability
-
Constructor Details
-
UniformOderBasedCrossover
Create a new UniformOrderBasedCrossover instance- Parameters:
probability
- the recombination probability as defined inCrossover(double)
. This is the probability that a given individual is selected for crossover.- Throws:
IllegalArgumentException
- if the probability is not in the valid range of[0, 1]
-
-
Method Details
-
crossover
Applies uniform order-based crossover to two sequences. A set of positions is chosen, the genes at those positions are reordered as they occur in the other sequence.- Specified by:
crossover
in classCrossover<EnumGene<T>,
C extends Comparable<? super C>> - Parameters:
that
- first sequenceother
- second sequence- Returns:
- the number of altered genes
- Throws:
IllegalArgumentException
- if the two input sequences have a different length
-