Package org.moeaframework.core.spi
Class OperatorProvider
java.lang.Object
org.moeaframework.core.spi.OperatorProvider
- Direct Known Subclasses:
RegisteredOperatorProvider
Defines an SPI for initializing different operators. Operators are identified by a unique name. The methods of
the provider must return
null
if the operator is not supported by the provider.
If the provider can supply the operator but an error occurred during instantiation, the provider may throw a
ProviderNotFoundException
along with the details causing the exception.
To provide a custom OperatorProvider
, first extend this class and implement the two abstract methods. Next,
build a JAR file containing the custom provider. Within the JAR file, create the file
META-INF/services/org.moeaframework.core.spi.OperatorProvider
containing on a single line the class name of
the custom provider. Lastly, add this JAR file to the classpath. Once these steps are completed, the
operators(s) are now accessible via the methods in this class.
-
Constructor Summary
-
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 no suitable operator is found.- Parameters:
name
- the name identifying the variation operatorproperties
- the implementation-specific propertiesproblem
- the problem to be solved- Returns:
- an instance of the variation operator with the specified name
-