Class SubtreeCrossover
java.lang.Object
org.moeaframework.core.operator.TypeSafeCrossover<Program>
org.moeaframework.core.operator.program.SubtreeCrossover
- All Implemented Interfaces:
Configurable
,Variation
Exchanges a randomly-selected subtree from one program with a compatible, randomly-selected subtree from another
program.
This operator is type-safe.
-
Constructor Summary
ConstructorDescriptionConstructs a new subtree crossover instance with a 90% chance of being applied to each solution.SubtreeCrossover
(double probability) Constructs a new subtree crossover instance. -
Method Summary
Methods inherited from class org.moeaframework.core.operator.TypeSafeCrossover
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
-
SubtreeCrossover
public SubtreeCrossover()Constructs a new subtree crossover instance with a 90% chance of being applied to each solution. -
SubtreeCrossover
public SubtreeCrossover(double probability) Constructs a new subtree crossover instance.- Parameters:
probability
- the probability that subtree crossover is applied to a program
-
-
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
Description copied from interface:Variation
Evolves one or more parent solutions (specified bygetArity
) and produces one or more child solutions. By contract, the parents must not be modified. The copy constructor should be used to create copies of the parents with these copies subsequently modified.- Specified by:
evolve
in interfaceVariation
- Overrides:
evolve
in classTypeSafeCrossover<Program>
- Parameters:
parents
- the array of parent solutions- Returns:
- an array of child solutions
-
evolve
Applies subtree crossover to the programs.- Specified by:
evolve
in classTypeSafeCrossover<Program>
- Parameters:
program1
- the first program, which is the parent programprogram2
- the second program, which provides the replacement subtree
-