Package org.opt4j.operator.mutate
Class MutatePermutationMixed
- java.lang.Object
-
- org.opt4j.operator.mutate.MutatePermutationMixed
-
- All Implemented Interfaces:
Operator<PermutationGenotype<?>>
,Mutate<PermutationGenotype<?>>
,MutatePermutation
public class MutatePermutationMixed extends Object implements MutatePermutation
Mutate for the
PermutationGenotype
. Randomly selects betweenMutatePermutationSwap
,MutatePermutationInsert
, andMutatePermutationRevert
.
-
-
Field Summary
Fields Modifier and Type Field Description protected MutatePermutationInsert
insert
protected Random
random
protected MutatePermutationRevert
revert
protected MutatePermutationSwap
swap
-
Constructor Summary
Constructors Constructor Description MutatePermutationMixed(MutatePermutationSwap swap, MutatePermutationInsert insert, MutatePermutationRevert revert, 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(PermutationGenotype<?> genotype, double p)
Performs a mutation for aGenotype
.
-
-
-
Field Detail
-
random
protected final Random random
-
swap
protected final MutatePermutationSwap swap
-
insert
protected final MutatePermutationInsert insert
-
revert
protected final MutatePermutationRevert revert
-
-
Constructor Detail
-
MutatePermutationMixed
@Inject public MutatePermutationMixed(MutatePermutationSwap swap, MutatePermutationInsert insert, MutatePermutationRevert revert, Rand random)
Constructs a newMutatePermutation
with the given mutation rate.- Parameters:
swap
- the swap mutateinsert
- the insert mutaterevert
- the revert mutaterandom
- the random number generator
-
-
Method Detail
-
mutate
public void mutate(PermutationGenotype<?> genotype, double p)
Description copied from interface:Mutate
Performs a mutation for aGenotype
.- Specified by:
mutate
in interfaceMutate<PermutationGenotype<?>>
- Parameters:
genotype
- the genotype to be mutatedp
- the mutation rate
-
-