Package io.jenetics
Class PartiallyMatchedCrossover<T,C extends Comparable<? super C>>
- java.lang.Object
-
- io.jenetics.AbstractAlterer<G,C>
-
- io.jenetics.Recombinator<G,C>
-
- io.jenetics.Crossover<EnumGene<T>,C>
-
- io.jenetics.PartiallyMatchedCrossover<T,C>
-
public class PartiallyMatchedCrossover<T,C extends Comparable<? super C>> extends Crossover<EnumGene<T>,C>
ThePartiallyMatchedCrossover
(PMX) guarantees that allGene
s are found exactly once in each chromosome. No gene is duplicated by this crossover. The PMX can be applied usefully in the TSP or other permutation problem encodings. Permutation encoding is useful for all problems where the 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
The PMX is similar to the two-point crossover. A crossing region is chosen by selecting two crossing points.
C1 = 012|345|6789 C2 = 987|654|3210
After performing the crossover we normally got two invalid chromosomes.C1 = 012|654|6789 C2 = 987|345|3210
ChromosomeC1
contains the value 6 twice and misses the value 3. On the other side chromosomeC2
contains the value 3 twice and misses the value 6. We can observe that this crossover is equivalent to the exchange of the values3 -> 6
,4 -> 5
and5 -> 4
. To repair the two chromosomes we have to apply this exchange outside the crossing region.C1 = 012|654|3789 C2 = 987|345|6210
ThePartiallyMatchedCrossover
class requires chromosomes with the same length. AnIllegalArgumentException
is thrown at runtime if this requirement is not fulfilled.- Since:
- 1.0
- Version:
- 4.4
- Author:
- Franz Wilhelmstötter
- See Also:
PermutationChromosome
-
-
Field Summary
-
Fields inherited from class io.jenetics.AbstractAlterer
_probability
-
Fields inherited from interface io.jenetics.Alterer
DEFAULT_ALTER_PROBABILITY
-
-
Constructor Summary
Constructors Constructor Description PartiallyMatchedCrossover(double probability)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
crossover(MSeq<EnumGene<T>> that, MSeq<EnumGene<T>> other)
Template method which performs the crossover.String
toString()
-
Methods inherited from class io.jenetics.Recombinator
alter, order
-
Methods inherited from class io.jenetics.AbstractAlterer
probability
-
-
-
-
Constructor Detail
-
PartiallyMatchedCrossover
public PartiallyMatchedCrossover(double probability)
-
-