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.
      Parameters:
      type - the decision variable type
      operator - the suggested operator
    • setVariationHint

      protected final void setVariationHint(Class<? extends Variable> type, String operator)
      Sets the variation hint for the given decision variable type, overwriting any existing hint.
      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. Mixed types are currently not supported. Returns null if no mutation operators support the given problem.
      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. Mixed types are currently not supported. Returns null if no variation operators support the given problem.
      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