Package org.moeaframework.core.spi
Class ProblemFactory
java.lang.Object
org.moeaframework.core.spi.AbstractFactory<ProblemProvider>
org.moeaframework.core.spi.ProblemFactory
- All Implemented Interfaces:
Iterable<ProblemProvider>
Factory for creating optimization problem instances and their corresponding reference sets, if known. Problems
are referenced by name. For example,
getProblem("DTLZ2_2")
will create an instance of the 2-objective
DTLZ2 problem. See ProblemProvider
for details on adding new providers.
This class is thread safe.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns the names of all problems that have been registered to display in the diagnostic tool.Returns the names of all problems that have been registered by the providers.getEpsilons
(String name) Searches through all discoveredProblemProvider
instances, returning the ε values of the problem with the registered name.static ProblemFactory
Returns the default problem factory.getProblem
(String name) Searches through all discoveredProblemProvider
instances, returning an instance of the problem with the registered name.getReferenceSet
(String name) Searches through all discoveredProblemProvider
instances, returning the reference set of the problem with the registered name.static void
setInstance
(ProblemFactory instance) Sets the default problem factory.Methods inherited from class org.moeaframework.core.spi.AbstractFactory
addProvider, hasProvider, iterator
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
ProblemFactory
public ProblemFactory()Constructs a new problem factory.
-
-
Method Details
-
getInstance
Returns the default problem factory.- Returns:
- the default problem factory
-
setInstance
Sets the default problem factory.- Parameters:
instance
- the default problem factory
-
getProblem
Searches through all discoveredProblemProvider
instances, returning an instance of the problem with the registered name. This method must throw anProviderNotFoundException
if no matching problem is found.- Parameters:
name
- the name identifying the problem- Returns:
- an instance of the problem with the registered name
- Throws:
ProviderNotFoundException
- if no provider for the problem is available
-
getReferenceSet
Searches through all discoveredProblemProvider
instances, returning the reference set of the problem with the registered name. Returnsnull
if no reference set is available for the specified problem.- Parameters:
name
- the name identifying the problem- Returns:
- the reference set of the problem with the registered name; or
null
if no reference set is available
-
getEpsilons
Searches through all discoveredProblemProvider
instances, returning the ε values of the problem with the registered name. Returnsnull
if no values are available for the specified problem.- Parameters:
name
- the name identifying the problem- Returns:
- the ε values of the problem with the registered name; or
null
if no values are available
-
getAllRegisteredProblems
Returns the names of all problems that have been registered by the providers. Note that this does not include a comprehensive list of all problems that can be constructed, only those that have been registered explicitly with a name.- Returns:
- all registered problem names
-
getAllDiagnosticToolProblems
Returns the names of all problems that have been registered to display in the diagnostic tool.- Returns:
- all diagnostic tool problem names
-