MOEA Framework 2.12
API Specification

org.moeaframework.core.spi
Class OperatorFactory

java.lang.Object
  extended by org.moeaframework.core.spi.OperatorFactory

public class OperatorFactory
extends Object

Factory for creating and variation (e.g., crossover and mutation) operator instances.

Operators can be combined by joining the two operator names with the plus sign, such as "sbx+pm". Not all operators can be joined this way. See CompoundVariation for the restrictions.

This class is thread safe.


Constructor Summary
OperatorFactory()
          Constructs a new operator factory.
 
Method Summary
 void addProvider(OperatorProvider provider)
          Adds an operator provider to this operator factory.
 String getDefaultMutation(Problem problem)
          Returns the name of the default mutation operator for the given problem.
 String getDefaultVariation(Problem problem)
          Returns the name of the default variation operator (e.g., crossover with mutation) for the given problem.
static OperatorFactory getInstance()
          Returns the default operator factory.
 Variation getVariation(String name, Properties properties, Problem problem)
          Returns an instance of the variation operator with the specified name.
 Variation getVariation(String name, TypedProperties properties, Problem problem)
          Returns an instance of the variation operator with the specified name.
static void setInstance(OperatorFactory instance)
          Sets the default operator factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OperatorFactory

public OperatorFactory()
Constructs a new operator factory.

Method Detail

getInstance

public static OperatorFactory getInstance()
Returns the default operator factory.

Returns:
the default operator factory

setInstance

public static void setInstance(OperatorFactory instance)
Sets the default operator factory.

Parameters:
instance - the default operator factory

addProvider

public void addProvider(OperatorProvider provider)
Adds an operator provider to this operator factory. Subsequent calls to getVariation(String, Properties, Problem) will search the given provider for a match.

Parameters:
provider - the new operator provider

getDefaultMutation

public String getDefaultMutation(Problem problem)
Returns the name of the default mutation operator for the given problem. Mixed types are currently not supported.

Parameters:
problem - the problem
Returns:
the name of the default mutation operator for the given problem
Throws:
ProviderLookupException - if no default mutation operator could be determined

getDefaultVariation

public String getDefaultVariation(Problem problem)
Returns the name of the default variation operator (e.g., crossover with mutation) for the given problem. Mixed types are currently not supported.

Parameters:
problem - the problem
Returns:
the name of the default variation operator for the given problem
Throws:
ProviderLookupException - if no default variation operator could be determined

getVariation

public Variation getVariation(String name,
                              TypedProperties properties,
                              Problem problem)
Returns an instance of the variation operator with the specified name. This method must throw an ProviderNotFoundException if no suitable operator is found. If name is null, the factory should return a default variation operator appropriate for the problem.

Parameters:
name - the name identifying the variation operator
properties - the implementation-specific properties
problem - the problem to be solved
Returns:
an instance of the variation operator with the specified name
Throws:
ProviderNotFoundException - if no provider for the algorithm is available

getVariation

public Variation getVariation(String name,
                              Properties properties,
                              Problem problem)
Returns an instance of the variation operator with the specified name. This method must throw an ProviderNotFoundException if no suitable operator is found. If name is null, the factory should return a default variation operator appropriate for the problem.

Parameters:
name - the name identifying the variation operator
properties - the implementation-specific properties
problem - the problem to be solved
Returns:
an instance of the variation operator with the specified name
Throws:
ProviderNotFoundException - if no provider for the algorithm is available

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!