Class RegisteredOperatorProvider

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

public class RegisteredOperatorProvider extends OperatorProvider
Operator provider that lets callers register operators by name.
  • Constructor Details

    • RegisteredOperatorProvider

      public RegisteredOperatorProvider()
      Constructs a new, empty operator provider.
  • Method Details

    • setMutationHint

      protected final void setMutationHint(Class<? extends Variable> type, String operator)
      Sets the mutation hint for the given decision variable type, overwriting any existing hint. By convention, all mutation operators should accept a single parent and produce a single offspring.
      Parameters:
      type - the decision variable type
      operator - the suggested operator
    • setCrossoverHint

      protected final void setCrossoverHint(Class<? extends Variable> type, String operator)
      Sets the crossover hint for the given decision variable type, overwriting any existing hint. While not strictly required, we recommend only configuring crossover operators that accept two parents and produce two offspring. This convention guarantees the crossover operators can be combined safely.
      Parameters:
      type - the decision variable type
      operator - the suggested operator
    • register

      protected final void register(String name, BiFunction<TypedProperties,Problem,Variation> constructor)
      Registers a new operator with this provider.
      Parameters:
      name - the operator name
      constructor - the function that creates a new instance of the operator
    • getRegisteredOperators

      public Set<String> getRegisteredOperators()
      Returns the names of all operators registered with this provider.
      Returns:
      the names of all registered operators
    • getMutationHint

      public String getMutationHint(Problem problem)
      Description copied from class: OperatorProvider
      Returns the name of the suggested mutation operator for the given problem, or null if no hint is available.
      Specified by:
      getMutationHint in class OperatorProvider
      Parameters:
      problem - the problem
      Returns:
      the name of the suggested mutation operator for the given problem
    • getVariationHint

      public String getVariationHint(Problem problem)
      Description copied from class: OperatorProvider
      Returns the name of the suggested variation operator for the given problem, or null if no hint is available.
      Specified by:
      getVariationHint in class OperatorProvider
      Parameters:
      problem - the problem
      Returns:
      the name of the suggested variation operator for the given problem
    • getVariation

      public Variation getVariation(String name, TypedProperties properties, Problem problem)
      Description copied from class: OperatorProvider
      Returns an instance of the variation operator with the specified name. This method must return null if no suitable operator is found.
      Specified by:
      getVariation in class OperatorProvider
      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