gemseo / algos / opt

Show inherited members

optimization_library module

Optimization library wrappers base class.

class gemseo.algos.opt.optimization_library.OptimizationAlgorithmDescription(algorithm_name, internal_algorithm_name, library_name='', description='', website='', handle_integer_variables=False, require_gradient=False, handle_equality_constraints=False, handle_inequality_constraints=False, handle_multiobjective=False, positive_constraints=False, problem_type=ProblemType.NON_LINEAR)[source]

Bases: DriverDescription

The description of an optimization algorithm.

Parameters:
  • algorithm_name (str) –

  • internal_algorithm_name (str) –

  • library_name (str) –

    By default it is set to “”.

  • 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 False.

  • 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 False.

  • 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”.

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 = False

Whether the optimization algorithm handles inequality constraints.

handle_multiobjective: bool = False

Whether the optimization algorithm handles multiple objectives.

internal_algorithm_name: str

The name of the algorithm in 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).

class gemseo.algos.opt.optimization_library.OptimizationLibrary[source]

Bases: DriverLibrary

Base optimization library defining a collection of optimization algorithms.

Typically used as:

  1. Instantiate an OptimizationLibrary.

  2. Select the algorithm with algo_name.

  3. Solve an OptimizationProblem with execute().

Notes

The missing current values of the DesignSpace attached to the OptimizationProblem are automatically initialized with the method DesignSpace.initialize_missing_current_values().

algorithm_handles_eqcstr(algo_name)[source]

Check if an algorithm handles equality constraints.

Parameters:

algo_name (str) – The name of the algorithm.

Returns:

Whether the algorithm handles equality constraints.

Return type:

bool

algorithm_handles_ineqcstr(algo_name)[source]

Check if an algorithm handles inequality constraints.

Parameters:

algo_name (str) – The name of the algorithm.

Returns:

Whether the algorithm handles inequality constraints.

Return type:

bool

get_right_sign_constraints()[source]

Transform the problem constraints into their opposite sign counterpart.

This is done if the algorithm requires positive constraints.

is_algo_requires_positive_cstr(algo_name)[source]

Check if an algorithm requires positive constraints.

Parameters:

algo_name (str) – The name of the algorithm.

Returns:

Whether the algorithm requires positive constraints.

Return type:

bool

new_iteration_callback(x_vect)[source]

Verify the design variable and objective value stopping criteria.

Parameters:

x_vect (ndarray) – The design variables values.

Raises:
  • FtolReached – If the defined relative or absolute function tolerance is reached.

  • XtolReached – If the defined relative or absolute x tolerance is reached.

Return type:

None

F_TOL_ABS = 'ftol_abs'
F_TOL_REL = 'ftol_rel'
LS_STEP_NB_MAX = 'max_ls_step_nb'
LS_STEP_SIZE_MAX = 'max_ls_step_size'
MAX_FUN_EVAL = 'max_fun_eval'
MAX_ITER = 'max_iter'
MAX_TIME = 'max_time'
PG_TOL = 'pg_tol'
SCALING_THRESHOLD: Final[str] = 'scaling_threshold'
STOP_CRIT_NX = 'stop_crit_n_x'
VERBOSE = 'verbose'
X_TOL_ABS = 'xtol_abs'
X_TOL_REL = 'xtol_rel'
algo_name: str | None

The name of the algorithm used currently.

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.