Module io.jenetics.ext
Package io.jenetics.ext
Class RSMutator<G extends Gene<?,G>,C extends Comparable<? super C>>
java.lang.Object
io.jenetics.AbstractAlterer<G,C>
io.jenetics.Mutator<G,C>
io.jenetics.ext.RSMutator<G,C>
- All Implemented Interfaces:
Alterer<G,C>
The reverse sequence mutation, two positions i and j are randomly chosen The
gene order in a chromosome will then be reversed between this two points.
This mutation operator can also be used for combinatorial problems, where no
duplicated genes within a chromosome are allowed, e.g., for the TSP.
- Since:
- 5.0
- Version:
- 5.0
- See Also:
-
Field Summary
Fields inherited from class io.jenetics.AbstractAlterer
_probabilityFields inherited from interface io.jenetics.Alterer
DEFAULT_ALTER_PROBABILITY -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor, with default mutation probability (Alterer.DEFAULT_ALTER_PROBABILITY).RSMutator(double probability) Constructs an alterer with a given recombination probability. -
Method Summary
Modifier and TypeMethodDescriptionprotected MutatorResult<Chromosome<G>> mutate(Chromosome<G> chromosome, double p, RandomGenerator random) Mutates the given chromosome.Methods inherited from class io.jenetics.AbstractAlterer
probability
-
Constructor Details
-
RSMutator
Constructs an alterer with a given recombination probability.- Parameters:
probability- the crossover probability.- Throws:
IllegalArgumentException- if theprobabilityis not in the valid range of[0, 1].
-
RSMutator
public RSMutator()Default constructor, with default mutation probability (Alterer.DEFAULT_ALTER_PROBABILITY).
-
-
Method Details
-
mutate
protected MutatorResult<Chromosome<G>> mutate(Chromosome<G> chromosome, double p, RandomGenerator random) Description copied from class:MutatorMutates the given chromosome.
-