Class YAMLParameterSpace
This class extends ParameterSpace to provide dynamic parameter loading
capabilities from YAML configuration files. It supports various parameter types
including categorical, integer, and double parameters, with full support for
nested and conditional parameter structures commonly found in metaheuristic
algorithm configurations.
- Since:
- 1.0
- Version:
- 1.0, 1.0
- Author:
- Antonio J. Nebro, Antonio J. Nebro
- See Also:
-
Field Summary
Fields inherited from class org.uma.evolver.parameter.ParameterSpace
parameterSpace, topLevelParameters -
Constructor Summary
ConstructorsConstructorDescriptionYAMLParameterSpace(String yamlFilePath, ParameterFactory<?> parameterFactory) Constructs a new YAMLParameterSpace by loading parameters from the specified YAML file. -
Method Summary
Modifier and TypeMethodDescriptionCreates and configures a new instance of this parameter space.getParameterProcessor(String type) Returns the parameter processor for the specified parameter type.Returns an unmodifiable view of all parameter processors.Methods inherited from class org.uma.evolver.parameter.ParameterSpace
addTopLevelParameter, get, parameters, put, topLevelParameters
-
Constructor Details
-
YAMLParameterSpace
Constructs a new YAMLParameterSpace by loading parameters from the specified YAML file.This constructor initializes the parameter processors, loads the YAML configuration,
- Parameters:
yamlFilePath- the path to the YAML configuration file. The path can be a classpath resource (e.g., "config/parameters.yaml") or a filesystem path (e.g., "/path/to/parameters.yaml").parameterFactory- the factory to use for creating parameter instances. This allows customization of parameter creation while maintaining the YAML parsing logic.- Throws:
org.uma.jmetal.util.errorchecking.JMetalException- if there is an error loading or parsing the YAML file, or if the configuration is invalid.IllegalArgumentException- if yamlFilePath is null or empty, or if parameterFactory is null.- See Also:
-
-
Method Details
-
createInstance
Description copied from class:ParameterSpaceCreates and configures a new instance of this parameter space.This method is part of the prototype pattern, allowing parameter spaces to be cloned with the same configuration. Implementations should return a new instance of the concrete parameter space class with the same parameter configuration.
Example implementation:
@Override public ParameterSpace createInstance() { return new MyParameterSpace(); }- Specified by:
createInstancein classParameterSpace- Returns:
- a new instance of this parameter space
-
getParameterProcessors
Returns an unmodifiable view of all parameter processors.This method provides access to the internal processor registry for introspection and testing purposes. The returned map contains mappings from parameter type names to their corresponding processors.
- Returns:
- an unmodifiable map of parameter type names to their respective processors; never null
-
getParameterProcessor
Returns the parameter processor for the specified parameter type.This method allows retrieval of specific processors for custom parameter processing or validation logic.
- Parameters:
type- the parameter type (e.g., "categorical", "integer", "double"); case-sensitive- Returns:
- the parameter processor for the specified type, or
nullif not found
-