lib_pymoo module¶
Pymoo optimization library wrapper.
- class gemseo_pymoo.algos.opt.lib_pymoo.PymooAlgorithmDescription(algorithm_name, internal_algorithm_name, library_name='pymoo', description='', website='', handle_integer_variables=True, require_gradient=False, handle_equality_constraints=False, handle_inequality_constraints=True, handle_multiobjective=False, positive_constraints=False, problem_type=ProblemType.NON_LINEAR, require_grad=False)[source]
Bases:
OptimizationAlgorithmDescription
The description of an optimization algorithm from the pymoo library.
- Parameters:
algorithm_name (str) –
internal_algorithm_name (str) –
library_name (str) –
By default it is set to “pymoo”.
description (str) –
By default it is set to “”.
website (str) –
By default it is set to “”.
handle_integer_variables (bool) –
By default it is set to True.
require_gradient (bool) –
By default it is set to False.
handle_equality_constraints (bool) –
By default it is set to False.
handle_inequality_constraints (bool) –
By default it is set to True.
handle_multiobjective (bool) –
By default it is set to False.
positive_constraints (bool) –
By default it is set to False.
problem_type (ProblemType) –
By default it is set to “non-linear”.
require_grad (bool) –
By default it is set to False.
- algorithm_name: str
The name of the algorithm in GEMSEO.
- handle_equality_constraints: bool = False
Whether the optimization algorithm handles equality constraints.
- handle_inequality_constraints: bool = True
Whether the optimization algorithm handles inequality constraints.
- handle_integer_variables: bool = True
Whether the optimization algorithm handles integer variables.
- internal_algorithm_name: str
The name of the algorithm in the wrapped library.
- library_name: str = 'pymoo'
The name of the wrapped library.
- positive_constraints: bool = False
Whether the optimization algorithm requires positive constraints.
- problem_type: ProblemType = 'non-linear'
The type of problem (see
OptimizationProblem.ProblemType
).
- require_grad: bool = False
- class gemseo_pymoo.algos.opt.lib_pymoo.PymooOpt[source]
Bases:
OptimizationLibrary
Pymoo optimization library interface.
See
gemseo.algos.opt.optimization_library.OptimizationLibrary
.Notes
The missing current values of the
DesignSpace
attached to theOptimizationProblem
are automatically initialized with the methodDesignSpace.initialize_missing_current_values()
.Constructor.
Generate the library dict, which contains the list of algorithms with their characteristics:
does it require gradient
does it handle equality constraints
does it handle inequality constraints
- get_optimum_from_database(message=None, status=None)[source]
Retrieve the optimum from the database.
Override the super class method in order to return an
OptimizationResult
instance adapted for multi-objective results (seeMultiObjectiveOptimizationResult
).- Parameters:
- Returns:
An optimization result object based on the optimum found.
- Return type:
- CROSSOVER_OPERATOR: Final[str] = 'crossover'
The crossover operator’s name.
- EVOLUTIONARY_OPERATORS: Final[dict[str, Operator]] = {'crossover': pymoo.core.crossover.Crossover, 'mutation': pymoo.core.mutation.Mutation, 'sampling': pymoo.core.sampling.Sampling, 'selection': pymoo.core.selection.Selection}
A dictionary with all evolutionary operators available as keys and their Pymoo classes as values.
- HV_TOL_ABS: Final[str] = 'hv_tol_abs'
The tag for the absolute tolerance used in the hypervolume convergence check.
- HV_TOL_REL: Final[str] = 'hv_tol_rel'
The tag for the relative tolerance used in the hypervolume convergence check.
- LIBRARY_NAME: Final[str] = 'pymoo'
The library’s name.
- MAX_GEN: Final[str] = 'max_gen'
The tag for the maximum number of generations allowed.
- MUTATION_OPERATOR: Final[str] = 'mutation'
The mutation operator’s name.
- N_PROCESSES: Final[str] = 'n_processes'
The tag for the number of processes to use.
- PYMOO_GA: Final[str] = 'PYMOO_GA'
The GEMSEO alias for the Genetic Algorithm.
- PYMOO_NSGA2: Final[str] = 'PYMOO_NSGA2'
The GEMSEO alias for the Non-dominated Sorting Genetic Algorithm II.
- PYMOO_NSGA3: Final[str] = 'PYMOO_NSGA3'
The GEMSEO alias for the Non-dominated Sorting Genetic Algorithm III.
- PYMOO_RNSGA3: Final[str] = 'PYMOO_RNSGA3'
The GEMSEO alias for the Reference Point Based NSGA-III.
- PYMOO_UNSGA3: Final[str] = 'PYMOO_UNSGA3'
The GEMSEO alias for the Unified NSGA-III.
- SAMPLING_OPERATOR: Final[str] = 'sampling'
The sampling operator’s name.
- SELECTION_OPERATOR: Final[str] = 'selection'
The selection operator’s name.
- STOP_CRIT_N_HV: Final[str] = 'stop_crit_n_hv'
The tag for the number of generations to account for in the hypervolume check.
- descriptions: dict[str, AlgorithmDescription]
The description of the algorithms contained in the library.
- internal_algo_name: str | None
The internal name of the algorithm used currently.
It typically corresponds to the name of the algorithm in the wrapped library if any.
- opt_grammar: JSONGrammar | None
The grammar defining the options of the current algorithm.
- problem: OptimizationProblem
The optimization problem the driver library is bonded to.
- pymoo_n_gen: int = 10000000
The pymoo’s termination criterion based on the number of generations.