public class MutatePermutationSwap extends Object implements MutatePermutation
Mutate operator for the PermutationGenotype. With a given mutation
rate two elements are selected and swapped.
Given a permutation 1 2 3 4 5 6 7 8, this might result in 1 2
7 4 5 6 3 8.
| Constructor and Description |
|---|
MutatePermutationSwap(Rand random)
Constructs a new
MutatePermutation with the given mutation rate. |
| Modifier and Type | Method and Description |
|---|---|
void |
mutate(PermutationGenotype<?> genotype,
double p)
Performs a mutation for a
Genotype. |
@Inject public MutatePermutationSwap(Rand random)
MutatePermutation with the given mutation rate.random - the random number generatorpublic void mutate(PermutationGenotype<?> genotype, double p)
MutateGenotype.mutate in interface Mutate<PermutationGenotype<?>>genotype - the genotype to be mutatedp - the mutation rate