Package org.opt4j.operator.mutate
Class MutatePermutationSwap
java.lang.Object
org.opt4j.operator.mutate.MutatePermutationSwap
- All Implemented Interfaces:
Operator<PermutationGenotype<?>>,Mutate<PermutationGenotype<?>>,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.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMutatePermutationSwap(Rand random) Constructs a newMutatePermutationwith the given mutation rate. -
Method Summary
Modifier and TypeMethodDescriptionvoidmutate(PermutationGenotype<?> genotype, double p) Performs a mutation for aGenotype.
-
Field Details
-
random
-
-
Constructor Details
-
MutatePermutationSwap
Constructs a newMutatePermutationwith the given mutation rate.- Parameters:
random- the random number generator
-
-
Method Details
-
mutate
Description copied from interface:MutatePerforms a mutation for aGenotype.- Specified by:
mutatein interfaceMutate<PermutationGenotype<?>>- Parameters:
genotype- the genotype to be mutatedp- the mutation rate
-