Class DoubleParameterFactory
java.lang.Object
org.uma.evolver.parameter.factory.DoubleParameterFactory
- All Implemented Interfaces:
ParameterFactory<org.uma.jmetal.solution.doublesolution.DoubleSolution>
public class DoubleParameterFactory
extends Object
implements ParameterFactory<org.uma.jmetal.solution.doublesolution.DoubleSolution>
Factory class for creating and configuring categorical parameters specific to evolutionary
algorithms that operate on DoubleSolution individuals. This factory implements the
ParameterFactory interface to provide type-safe creation of various algorithm components and
their parameters.
The factory supports the creation of parameters for different components including:
- Variation operators (crossover, mutation)
- Selection mechanisms
- Archiving strategies
- Solution initialization methods
- Density estimators
- And other algorithm-specific parameters
This implementation is specifically designed for algorithms working with double-encoded solutions and provides appropriate parameter types that are compatible with the DoubleSolution interface.
This implementation uses the Registry Pattern, allowing for dynamic registration of parameter creators and making it more extensible than a traditional switch-based factory.
- Since:
- 1.0
- Author:
- Antonio J. Nebro
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance of DoubleParameterFactory with default parameter creators registered. -
Method Summary
Modifier and TypeMethodDescriptioncreateParameter(String parameterName, List<String> values) Creates and returns a specificCategoricalParameterinstance based on the provided parameter name.Registers a parameter creator for a specific parameter type.
-
Constructor Details
-
DoubleParameterFactory
public DoubleParameterFactory()Creates a new instance of DoubleParameterFactory with default parameter creators registered.
-
-
Method Details
-
register
public DoubleParameterFactory register(String type, Function<List<String>, CategoricalParameter> creator) Registers a parameter creator for a specific parameter type.- Parameters:
type- the parameter type to registercreator- the function that creates the parameter- Returns:
- this factory instance for method chaining
- Throws:
NullPointerException- if type or creator is null
-
createParameter
Creates and returns a specificCategoricalParameterinstance based on the provided parameter name.If no specific creator is registered for the parameter name, a default
CategoricalParameterwith the given name and values will be created.- Specified by:
createParameterin interfaceParameterFactory<org.uma.jmetal.solution.doublesolution.DoubleSolution>- Parameters:
parameterName- the name of the parameter to create (case-sensitive)values- the list of possible string values for the parameter (must not be null or empty)- Returns:
- an instance of
CategoricalParametercorresponding to the specified parameter name - Throws:
IllegalArgumentException- if the values list is null or empty- See Also:
-