public class SwapMutator<G extends Gene<?,G>,C extends Comparable<? super C>> extends Mutator<G,C>
SwapMutation
changes the order of genes in a chromosome, with the
hope of bringing related genes closer together, thereby facilitating the
production of building blocks. This mutation operator can also be used for
combinatorial problems, where no duplicated genes within a chromosome are
allowed, e.g. for the TSP._probability
DEFAULT_ALTER_PROBABILITY
Constructor and Description |
---|
SwapMutator()
Default constructor, with default mutation probability
(
Alterer.DEFAULT_ALTER_PROBABILITY ). |
SwapMutator(double probability)
Constructs an alterer with a given recombination probability.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
int |
hashCode() |
protected int |
mutate(MSeq<G> genes,
double p)
Swaps the genes in the given array, with the mutation probability of this
mutation.
|
String |
toString() |
getProbability
public SwapMutator(double probability)
probability
- the crossover probability.IllegalArgumentException
- if the probability
is not in the
valid range of [0, 1]
.public SwapMutator()
Alterer.DEFAULT_ALTER_PROBABILITY
).© 2007-2016 Franz Wilhelmstötter (2016-12-26 11:02)