Class OperatorFactory

All Implemented Interfaces:
Iterable<OperatorProvider>

public class OperatorFactory extends AbstractFactory<OperatorProvider>
Factory for creating and variation (e.g., crossover and mutation) operator instances.

Operators can be combined by joining the two operator names with the plus sign, such as "sbx+pm". Not all operators can be joined this way. See CompoundVariation for the restrictions.

This class is thread safe.

  • Constructor Details

    • OperatorFactory

      public OperatorFactory()
      Constructs a new operator factory.
  • Method Details

    • getInstance

      public static OperatorFactory getInstance()
      Returns the default operator factory.
      Returns:
      the default operator factory
    • setInstance

      public static void setInstance(OperatorFactory instance)
      Sets the default operator factory.
      Parameters:
      instance - the default operator factory
    • getMutation

      public Mutation getMutation(Problem problem)
      Returns the suggested mutation operator for the given problem.
      Parameters:
      problem - the problem
      Returns:
      an instance of the mutation operator
    • getMutation

      public Mutation getMutation(String name, TypedProperties properties, Problem problem)
      Returns the suggested mutation operator for the given problem. If name is null, this will attempt to return a mutation operator appropriate for the problem.
      Parameters:
      name - the name of the mutation operator
      properties - the implementation-specific properties
      problem - the problem
      Returns:
      an instance of the mutation operator
    • getVariation

      public Variation getVariation(Problem problem)
      Returns the suggested variation operator for the given problem.
      Parameters:
      problem - the problem to be solved
      Returns:
      an instance of the variation operator
    • getVariation

      public Variation getVariation(String name, Problem problem)
      Returns the named variation operator using default settings.
      Parameters:
      name - the name identifying the variation operator
      problem - the problem to be solved
      Returns:
      an instance of the variation operator
    • getVariation

      public Variation getVariation(String name, TypedProperties properties, Problem problem)
      Returns an instance of the variation operator with the specified name. This method must throw a ProviderNotFoundException if no suitable operator is found. If name is null, the factory should return a default variation operator appropriate for the problem.
      Parameters:
      name - the name of the variation operator
      properties - the implementation-specific properties
      problem - the problem to be solved
      Returns:
      an instance of the variation operator
      Throws:
      ProviderNotFoundException - if no provider for the algorithm is available