MOEA Framework 2.12
API Specification

org.moeaframework.core.operator.program
Class SubtreeCrossover

java.lang.Object
  extended by org.moeaframework.core.operator.program.SubtreeCrossover
All Implemented Interfaces:
Variation

public class SubtreeCrossover
extends Object
implements 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
SubtreeCrossover(double probability)
          Constructs a new subtree crossover instance.
 
Method Summary
protected  void crossover(Program program1, Program program2, Rules rules)
          Applies subtree crossover to the programs.
 Solution[] evolve(Solution[] parents)
          Evolves one or more parent solutions (specified by getArity) and produces one or more child solutions.
 int getArity()
          Returns the number of solutions that must be supplied to the evolve method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubtreeCrossover

public SubtreeCrossover(double probability)
Constructs a new subtree crossover instance.

Parameters:
probability - the probability that subtree crossover is applied to a program
Method Detail

getArity

public int getArity()
Description copied from interface: Variation
Returns the number of solutions that must be supplied to the evolve method.

Specified by:
getArity in interface Variation
Returns:
the number of solutions that must be supplied to the evolve method

evolve

public Solution[] evolve(Solution[] parents)
Description copied from interface: Variation
Evolves one or more parent solutions (specified by getArity) 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 interface Variation
Parameters:
parents - the array of parent solutions
Returns:
an array of child solutions

crossover

protected void crossover(Program program1,
                         Program program2,
                         Rules rules)
Applies subtree crossover to the programs.

Parameters:
program1 - the first program, which is the parent program
program2 - the second program, which provides the replacement subtree
rules - the rules defining the program syntax

MOEA Framework 2.12
API Specification

Copyright 2009-2016 MOEA Framework. All rights reserved.
Licensed under the GNU Lesser General Public License.
Return to the MOEA Framework homepage. Visit us on Github!