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 MutatePermutationInsertinsertprotected Randomrandomprotected MutatePermutationRevertrevertprotected MutatePermutationSwapswap
-
Constructor Summary
Constructors Constructor Description MutatePermutationMixed(MutatePermutationSwap swap, MutatePermutationInsert insert, MutatePermutationRevert revert, Rand random)Constructs a newMutatePermutationwith the given mutation rate.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidmutate(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 newMutatePermutationwith 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:MutatePerforms a mutation for aGenotype.- Specified by:
mutatein interfaceMutate<PermutationGenotype<?>>- Parameters:
genotype- the genotype to be mutatedp- the mutation rate
-
-