MOEA Framework 2.12
API Specification

org.moeaframework.core.spi
Class AlgorithmFactory

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

public class AlgorithmFactory
extends Object

Factory for creating algorithm instances. See AlgorithmProvider for details on adding new providers.

This class is thread safe.


Constructor Summary
AlgorithmFactory()
          Constructs a new algorithm factory.
 
Method Summary
 void addProvider(AlgorithmProvider provider)
          Adds an algorithm provider to this algorithm factory.
 Algorithm getAlgorithm(String name, Properties properties, Problem problem)
          Searches through all discovered AlgorithmProvider instances, returning an instance of the algorithm with the registered name.
static AlgorithmFactory getInstance()
          Returns the default algorithm factory.
static void setInstance(AlgorithmFactory instance)
          Sets the default algorithm factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AlgorithmFactory

public AlgorithmFactory()
Constructs a new algorithm factory.

Method Detail

getInstance

public static AlgorithmFactory getInstance()
Returns the default algorithm factory.

Returns:
the default algorithm factory

setInstance

public static void setInstance(AlgorithmFactory instance)
Sets the default algorithm factory.

Parameters:
instance - the default algorithm factory

addProvider

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

Parameters:
provider - the new algorithm provider

getAlgorithm

public Algorithm getAlgorithm(String name,
                              Properties properties,
                              Problem problem)
Searches through all discovered AlgorithmProvider instances, returning an instance of the algorithm with the registered name. The algorithm is initialized using implementation-specific properties. This method must throw an ProviderNotFoundException if no suitable algorithm is found.

Parameters:
name - the name identifying the algorithm
properties - the implementation-specific properties
problem - the problem to be solved
Returns:
an instance of the algorithm with the registered 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!