Package org.opt4j.operators.mutate
Class MutatePermutationSwap
- java.lang.Object
-
- org.opt4j.operators.mutate.MutatePermutationSwap
-
- All Implemented Interfaces:
org.opt4j.core.optimizer.Operator<org.opt4j.core.genotype.PermutationGenotype<?>>
,Mutate<org.opt4j.core.genotype.PermutationGenotype<?>>
,MutatePermutation
public class MutatePermutationSwap extends java.lang.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 in1 2 7 4 5 6 3 8
.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Random
random
-
Constructor Summary
Constructors Constructor Description MutatePermutationSwap(org.opt4j.core.common.random.Rand random)
Constructs a newMutatePermutation
with the given mutation rate.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
mutate(org.opt4j.core.genotype.PermutationGenotype<?> genotype, double p)
Performs a mutation for aGenotype
.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.opt4j.operators.mutate.Mutate
getOperatorType
-
-
-
-
Constructor Detail
-
MutatePermutationSwap
@Inject public MutatePermutationSwap(org.opt4j.core.common.random.Rand random)
Constructs a newMutatePermutation
with the given mutation rate.- Parameters:
random
- the random number generator
-
-
Method Detail
-
mutate
public void mutate(org.opt4j.core.genotype.PermutationGenotype<?> genotype, double p)
Description copied from interface:Mutate
Performs a mutation for aGenotype
.
-
-