MOEA Framework 2.12
API Specification

org.moeaframework.core.operator
Class CompoundVariation

java.lang.Object
  extended by org.moeaframework.core.operator.CompoundVariation
All Implemented Interfaces:
Variation
Direct Known Subclasses:
GAVariation

public class CompoundVariation
extends Object
implements Variation

Construct a variation operator applying one or more variations sequentially. This construct is used to support mixed-type decision variables; however, this requires that the variation operators are type safe. Type safe variation operates only on supported types and ignores unsupported types.

CompoundVariation provides the following behavior:

  1. If the previous operator produced K offspring and the current operator requires K parents, the current operator is applied normally. The current operator may produce any number of offspring.
  2. If the previous operator produced K offspring and the current operator requires 1 parent, the current operator is applied to each offspring individually. The current operator may produce any number of offspring, but only the first offspring will be retained.
  3. Otherwise, an exception is thrown.


Constructor Summary
CompoundVariation()
          Constructs a compound variation operator with no variation operators.
CompoundVariation(Variation... operators)
          Constructs a compound variation operator with the specified variation operators.
 
Method Summary
 void appendOperator(Variation variation)
          Appends the specified variation operator to this compound operator.
 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.
 String getName()
          Returns the name of this variation operator.
 void setName(String name)
          Sets the name of this variation operator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompoundVariation

public CompoundVariation()
Constructs a compound variation operator with no variation operators.


CompoundVariation

public CompoundVariation(Variation... operators)
Constructs a compound variation operator with the specified variation operators.

Parameters:
operators - the variation operators in the order they are applied
Method Detail

getName

public String getName()
Returns the name of this variation operator. If no name has been assigned through setName(String), a name is generated which identifies the underlying operators.

Returns:
the name of this variation operator

setName

public void setName(String name)
Sets the name of this variation operator.

Parameters:
name - the name of this variation operator

appendOperator

public void appendOperator(Variation variation)
Appends the specified variation operator to this compound operator.

Parameters:
variation - the variation operator to append

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

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

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!