gemseo_pymoo / algos / opt / core

pymoo_problem_adapater module

An adapter for pymoo Problem.

class gemseo_pymoo.algos.opt.core.pymoo_problem_adapater.PymooProblem(*args, **kwargs)[source]

Bases: pymoo.core.problem.Problem

Interface between GEMSEO and pymoo optimization problems.

It supports multiprocessing.

Initialize a pymoo Problem from a GEMSEO one.

It also sets up a parallel object ParallelExecution for multiprocessing purposes.

Parameters
Return type

None

max_gen

The maximum number of generations allowed.

normalize_ds

Whether the design space is normalized.

opt_problem

The GEMSEO optimization problem.

gemseo_pymoo.algos.opt.core.pymoo_problem_adapater.get_gemseo_opt_problem(pymoo_pb, **pymoo_pb_options)[source]

Create a GEMSEO problem from a pymoo Problem.

If the pymoo problem’s name is provided, it must be a valid name among the available ones (see pymoo problems).

Parameters
  • pymoo_pb (str | Problem) – The pymoo problem to be converted.

  • **pymoo_pb_options (Any) – The additional arguments to be passed to the pymoo’s problem getter get_problem.

Returns

An instance of a GEMSEO OptimizationProblem.

Raises

TypeError – If pymoo_pb is not a valid string nor an instance of Problem.

Return type

OptimizationProblem

gemseo_pymoo.algos.opt.core.pymoo_problem_adapater.import_hdf(file_path, x_tolerance=0.0)[source]

Import an optimization history from an HDF file.

It uses gemseo.algos.opt_problem.OptimizationProblem.import_hdf() to import the optimization history from the HDF file. Afterwards, it replaces the gemseo.algos.opt_result.OptimizationResult object in gemseo.algos.opt_problem.OptimizationProblem.solution by a gemseo_pymoo.algos.opt_result_mo.MultiObjectiveOptimizationResult object.

Parameters
  • file_path (str) – The file containing the optimization history.

  • x_tolerance (float) –

    The tolerance on the design variables when reading the file.

    By default it is set to 0.0.

Returns

The read optimization problem.

Return type

gemseo.algos.opt_problem.OptimizationProblem