Class RegisteredAlgorithmProvider

java.lang.Object
org.moeaframework.core.spi.AlgorithmProvider
org.moeaframework.core.spi.RegisteredAlgorithmProvider
Direct Known Subclasses:
DefaultAlgorithms

public class RegisteredAlgorithmProvider extends AlgorithmProvider
Algorithm provider that lets callers register algorithms by name.
  • Constructor Details

    • RegisteredAlgorithmProvider

      public RegisteredAlgorithmProvider()
      Creates a new, empty problem provider.
  • Method Details

    • getDiagnosticToolAlgorithms

      public Set<String> getDiagnosticToolAlgorithms()
      Description copied from class: AlgorithmProvider
      Returns the algorithms names to appear in the diagnostic tool. If there are multiple aliases for the same algorithm, provide only the canonical name.
      Overrides:
      getDiagnosticToolAlgorithms in class AlgorithmProvider
      Returns:
      the algorithm names
    • registerDiagnosticToolAlgorithm

      protected final void registerDiagnosticToolAlgorithm(String name)
      Registers the given algorithm to appear in the diagnostic tool.
      Parameters:
      name - the algorithm name
    • registerDiagnosticToolAlgorithms

      protected final void registerDiagnosticToolAlgorithms(Collection<String> names)
      Registers all of the given algorithms to appear in the diagnostic tool.
      Parameters:
      names - the algorithm names
    • register

      protected final void register(BiFunction<TypedProperties,Problem,Algorithm> constructor, String... names)
      Registers a new algorithm with this provider.
      Parameters:
      constructor - the function that creates a new instance of the algorithm
      names - the name or names for this algorithm
    • getAlgorithm

      public Algorithm getAlgorithm(String name, TypedProperties properties, Problem problem)
      Description copied from class: AlgorithmProvider
      Returns the algorithm with the specified name, or null if this provider does not support the algorithm. An optional set of properties may be provided to further define the algorithm; however, the provider is expected to supply default properties if none are provided.
      Specified by:
      getAlgorithm in class AlgorithmProvider
      Parameters:
      name - the algorithm name
      properties - optional properties for the algorithm
      problem - the problem
      Returns:
      the algorithm with the specified name, or null if this provider does not support the algorithm