Class RegisteredProblemProvider

java.lang.Object
org.moeaframework.core.spi.ProblemProvider
org.moeaframework.core.spi.RegisteredProblemProvider
Direct Known Subclasses:
CEC2009ProblemProvider, DTLZProblemProvider, LSMOPProblemProvider, LZProblemProvider, MiscProblemProvider, SingleObjectiveProblemProvider, WFGProblemProvider, ZCATProblemProvider, ZDTProblemProvider

public class RegisteredProblemProvider extends ProblemProvider
Problem provider that lets callers register problems by name. For example:
    RegisteredProblemProvider myProvider = new RegisteredProblemProvider();
    myProvider.register("MyProblem", () -> new MyProblem(), "pf/myProbem.pf");
    
    ProblemFactory.getInstance().addProvider(myProvider);
 
  • Constructor Details

    • RegisteredProblemProvider

      public RegisteredProblemProvider()
      Creates a new, empty problem provider.
  • Method Details

    • register

      protected final void register(String name, Supplier<Problem> constructor, String referenceSet)
      Registers a new problem with this provider.
      Parameters:
      name - the problem name
      constructor - the function that creates a new instance of the problem
      referenceSet - the path of the file containing the reference set
    • registerEpsilons

      protected final void registerEpsilons(String name, Epsilons epsilons)
      Registers the ε values for the given problem, used as the defaults when constructing an algorithm, archive, or other object that uses ε-based dominance.
      Parameters:
      name - the problem name
      epsilons - the ε values
    • registerDiagnosticToolProblem

      protected final void registerDiagnosticToolProblem(String name)
      Registers the given problem with the diagnostic tool.
      Parameters:
      name - the problem name
    • registerDiagnosticToolProblems

      protected final void registerDiagnosticToolProblems(Collection<String> names)
      Registers all of the given problems with the diagnostic tool.
      Parameters:
      names - the problem names
    • getRegisteredProblems

      public Set<String> getRegisteredProblems()
      Returns all problems that have been registered with this provider. Note that this does not necessarily include all problems that can be instantiated by the provider, only those that have been explicitly registered.
      Returns:
      the problem names
    • getDiagnosticToolProblems

      public Set<String> getDiagnosticToolProblems()
      Description copied from class: ProblemProvider
      Returns the problem names to appear in the diagnostic tool. For best results, only include problems with two objectives and have a defined reference set.
      Overrides:
      getDiagnosticToolProblems in class ProblemProvider
      Returns:
      the problem names to appear in the diagnostic tool
    • getProblem

      public Problem getProblem(String name)
      Description copied from class: ProblemProvider
      Returns the problem with the specified name, or null if this provider does not support the problem.
      Specified by:
      getProblem in class ProblemProvider
      Parameters:
      name - the problem name
      Returns:
      the problem with the specified name, or null if this provider does not support the problem
    • getReferenceSet

      public NondominatedPopulation getReferenceSet(String name)
      Description copied from class: ProblemProvider
      Returns the reference set for the specified problem, or null if this provider does not support the problem or no reference set is available.
      Specified by:
      getReferenceSet in class ProblemProvider
      Parameters:
      name - the problem name
      Returns:
      the reference set for the specified problem, or null if this provider does not support the problem or no reference set is available
    • getEpsilons

      public Epsilons getEpsilons(String name)
      Description copied from class: ProblemProvider
      Returns the recommended or default ε values for the specified problem, or null if this provider does not support the problem or no defaults are provided.
      Overrides:
      getEpsilons in class ProblemProvider
      Parameters:
      name - the problem name
      Returns:
      the ε values for the specified problem, or null if this provider does not support the problem or no reference set is available