Package org.moeaframework.core.spi
Class OperatorProvider
java.lang.Object
org.moeaframework.core.spi.OperatorProvider
- Direct Known Subclasses:
RegisteredOperatorProvider
Defines a SPI for variation operators.
To create a custom OperatorProvider
:
- Extend this class and implement the abstract methods.
- Create the file
META-INF/services/org.moeaframework.core.spi.OperatorProvider
with a line identifying the fully-qualified class name of the custom provider. - Compile and bundle the
.class
file(s) along with theMETA-INF
folder into a JAR. - Include this JAR on the classpath.
OperatorFactory
.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract String
getMutationHint
(Problem problem) Returns the name of the suggested mutation operator for the given problem, ornull
if no hint is available.abstract Variation
getVariation
(String name, TypedProperties properties, Problem problem) Returns an instance of the variation operator with the specified name.abstract String
getVariationHint
(Problem problem) Returns the name of the suggested variation operator for the given problem, ornull
if no hint is available.
-
Constructor Details
-
OperatorProvider
public OperatorProvider()Constructs an operator provider.
-
-
Method Details
-
getMutationHint
Returns the name of the suggested mutation operator for the given problem, ornull
if no hint is available.- Parameters:
problem
- the problem- Returns:
- the name of the suggested mutation operator for the given problem
-
getVariationHint
Returns the name of the suggested variation operator for the given problem, ornull
if no hint is available.- Parameters:
problem
- the problem- Returns:
- the name of the suggested variation operator for the given problem
-
getVariation
Returns an instance of the variation operator with the specified name. This method must returnnull
if the named operator is not supported, or no suitable operator could be identified using hints.- Parameters:
name
- the name identifying the variation operator, ornull
to select a default operator based on the hintsproperties
- the implementation-specific propertiesproblem
- the problem to be solved- Returns:
- an instance of the variation operator or
null
- Throws:
ProviderException
- if the creation of the operator failed for any reason
-