Class GrammarCrossover
java.lang.Object
org.moeaframework.core.operator.TypeSafeCrossover<Grammar>
org.moeaframework.core.operator.grammar.GrammarCrossover
- All Implemented Interfaces:
Configurable
,Variation
Single-point crossover for grammars. A crossover point is selected in both parents with the tail portions swapped.
This variation operator is type-safe.
-
Constructor Summary
ConstructorDescriptionConstructs a new grammar crossover operator with 100% probability of being applied to each solution.GrammarCrossover
(double probability) Constructs a single-point crossover operator for grammars with the specified probability of applying this operator to each grammar variable. -
Method Summary
Methods inherited from class org.moeaframework.core.operator.TypeSafeCrossover
evolve, getArity, getProbability, 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
-
GrammarCrossover
public GrammarCrossover()Constructs a new grammar crossover operator with 100% probability of being applied to each solution. -
GrammarCrossover
public GrammarCrossover(double probability) Constructs a single-point crossover operator for grammars with the specified probability of applying this operator to each grammar variable.- Parameters:
probability
- the probability of applying this operator to each grammar 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
-
evolve
Performs single-point crossover on the specified grammars. Crossover points are chosen for both parents and the tail sections swapped. The two grammars are modified as a result of this operation.- Specified by:
evolve
in classTypeSafeCrossover<Grammar>
- Parameters:
g1
- the first grammarg2
- the second grammar
-