Class OperatorProvider

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

public abstract class OperatorProvider extends Object
Defines an SPI for initializing different operators. Operators are identified by a unique name. The methods of the provider must return null if the operator is not supported by the provider.

If the provider can supply the operator but an error occurred during instantiation, the provider may throw a ProviderNotFoundException along with the details causing the exception.

To provide a custom OperatorProvider, first extend this class and implement the two abstract methods. Next, build a JAR file containing the custom provider. Within the JAR file, create the file META-INF/services/org.moeaframework.core.spi.OperatorProvider containing on a single line the class name of the custom provider. Lastly, add this JAR file to the classpath. Once these steps are completed, the operators(s) are now accessible via the methods in this class.

  • 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. Mixed types are currently not supported. Returns null if no mutation operators support the given problem.
      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. Mixed types are currently not supported. Returns null if no variation operators support the given problem.
      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 no suitable operator is found.
      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