Class Swap
java.lang.Object
org.moeaframework.core.operator.TypeSafeMutation<Permutation>
org.moeaframework.core.operator.permutation.Swap
- All Implemented Interfaces:
Configurable
,Mutation
,Variation
Swap mutation operator. Randomly selects two entries in the permutation and swaps their position.
This operator is type-safe.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetName()
Returns the name of this variation operator.void
mutate
(Permutation permutation) Mutates the specified permutation using the swap mutation operator.Methods inherited from class org.moeaframework.core.operator.TypeSafeMutation
getProbability, mutate, setProbability
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.moeaframework.core.configuration.Configurable
applyConfiguration, getConfiguration
-
Constructor Details
-
Swap
public Swap()Constructs a swap mutation operator with the default settings. -
Swap
public Swap(double probability) Constructs a swap mutation operator with the specified probability of mutating a variable.- Parameters:
probability
- the probability of mutating a variable
-
-
Method Details
-
getName
Description copied from interface:Variation
Returns the name of this variation operator. This name should also be used as the prefix for any parameters. As such, the name should only contain alphanumeric characters, avoid using whitespace and other symbols.- Returns:
- the name of this variation operator
-
mutate
Mutates the specified permutation using the swap mutation operator.- Specified by:
mutate
in classTypeSafeMutation<Permutation>
- Parameters:
permutation
- the permutation to be mutated
-