Class GrammarMutation
java.lang.Object
org.moeaframework.core.operator.grammar.GrammarMutation
- All Implemented Interfaces:
Configurable
,Mutation
,Variation
Uniform mutation for grammars. Each integer codon in the grammar representation is uniformly mutated with a
specified probability.
This variation operator is type-safe.
-
Constructor Summary
ConstructorDescriptionConstructs a uniform mutation operators for grammars.GrammarMutation
(double probability) Constructs a uniform mutation operator for grammars with the specified probability of mutating each integer codon in the grammar representation. -
Method Summary
Modifier and TypeMethodDescriptiongetName()
Returns the name of this variation operator.double
Returns the probability of mutating each integer codon in the grammar representation.Mutates the given parent to produce an offspring.static void
Performs uniform mutation on the specified grammar.void
setProbability
(double probability) Sets the probability of mutating each integer codon in the grammar representation.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
-
GrammarMutation
public GrammarMutation()Constructs a uniform mutation operators for grammars. -
GrammarMutation
public GrammarMutation(double probability) Constructs a uniform mutation operator for grammars with the specified probability of mutating each integer codon in the grammar representation.- Parameters:
probability
- the probability of mutating each integer codon in the grammar representation
-
-
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. -
getProbability
public double getProbability()Returns the probability of mutating each integer codon in the grammar representation.- Returns:
- the probability
-
setProbability
public void setProbability(double probability) Sets the probability of mutating each integer codon in the grammar representation.- Parameters:
probability
- the probability (0.0 - 1.0)
-
mutate
Description copied from interface:Mutation
Mutates the given parent to produce an offspring. -
mutate
Performs uniform mutation on the specified grammar. Each integer codon in the grammar representation is uniformly mutated with the specified probability in the range[0, getMaximumValue()-1]
.- Parameters:
grammar
- the grammar to mutateprobability
- the probability of mutating each integer codon in the grammar representation
-