Class OperatorProvider

java.lang.Object
org.moeaframework.core.spi.OperatorProvider
Direct Known Subclasses:
RegisteredOperatorProvider

public abstract class OperatorProvider extends Object
Defines a SPI for variation operators.

To create a custom OperatorProvider:

  1. Extend this class and implement the abstract methods.
  2. Create the file META-INF/services/org.moeaframework.core.spi.OperatorProvider with a line identifying the fully-qualified class name of the custom provider.
  3. Compile and bundle the .class file(s) along with the META-INF folder into a JAR.
  4. Include this JAR on the classpath.
Providers can also be registered directly with OperatorFactory.
  • Constructor Details

    • OperatorProvider

      public OperatorProvider()
      Constructs an operator provider.
  • Method Details

    • getMutationHint

      public abstract String getMutationHint(Problem problem)
      Returns the name of the suggested mutation operator for the given problem, or null if no hint is available.
      Parameters:
      problem - the problem
      Returns:
      the name of the suggested mutation operator for the given problem
    • getVariationHint

      public abstract String getVariationHint(Problem problem)
      Returns the name of the suggested variation operator for the given problem, or null if no hint is available.
      Parameters:
      problem - the problem
      Returns:
      the name of the suggested variation operator for the given problem
    • getVariation

      public abstract Variation getVariation(String name, TypedProperties properties, Problem problem)
      Returns an instance of the variation operator with the specified name. This method must return null if the named operator is not supported, or no suitable operator could be identified using hints.
      Parameters:
      name - the name identifying the variation operator, or null to select a default operator based on the hints
      properties - the implementation-specific properties
      problem - the problem to be solved
      Returns:
      an instance of the variation operator or null
      Throws:
      ProviderException - if the creation of the operator failed for any reason