Class AlgorithmFactory

All Implemented Interfaces:
Iterable<AlgorithmProvider>

public class AlgorithmFactory extends AbstractFactory<AlgorithmProvider>
Factory for creating algorithm instances. See AlgorithmProvider for details on adding new providers.

This class is thread safe.

  • Constructor Details

    • AlgorithmFactory

      public AlgorithmFactory()
      Constructs a new algorithm factory.
  • Method Details

    • 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
    • getAlgorithm

      public Algorithm getAlgorithm(String name, 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
      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
    • getAlgorithm

      public Algorithm getAlgorithm(String name, TypedProperties 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
    • getAllDiagnosticToolAlgorithms

      public Set<String> getAllDiagnosticToolAlgorithms()
      Returns the names of all algorithms that have been registered to appear in the diagnostic tool.
      Returns:
      all diagnostic tool algorithm names