Package org.moeaframework.core.operator
Class TypeSafeMutation<T extends Variable>
java.lang.Object
org.moeaframework.core.operator.TypeSafeMutation<T>
- Type Parameters:
T
- the type of decision variable this operator supports
- All Implemented Interfaces:
Configurable
,Mutation
,Variation
An abstract mutation class that validates the types of each variable before applying the mutation operation with
a given probability.
-
Constructor Summary
ConstructorDescriptionTypeSafeMutation
(Class<T> type, double probability) Constructs a new mutation operator for the given type. -
Method Summary
Modifier and TypeMethodDescriptiondouble
Returns the probability of mutating each decision variableMutates the given parent to produce an offspring.abstract void
Mutates in place a single decision variable.void
setProbability
(double probability) Sets the probability of mutating each decision variable.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
-
TypeSafeMutation
Constructs a new mutation operator for the given type.- Parameters:
type
- the type of decision variable this operator supportsprobability
- the probability of mutating each decision variable
-
-
Method Details
-
getProbability
public double getProbability()Returns the probability of mutating each decision variable- Returns:
- the probability between 0.0 and 1.0, inclusive
-
setProbability
public void setProbability(double probability) Sets the probability of mutating each decision variable.- Parameters:
probability
- the probability between 0.0 and 1.0, inclusive
-
mutate
Description copied from interface:Mutation
Mutates the given parent to produce an offspring. -
mutate
Mutates in place a single decision variable.- Parameters:
variable
- the variable to mutate
-