gemseo / algos

lagrange_multipliers module

Implementation of the Lagrange multipliers.

class gemseo.algos.lagrange_multipliers.LagrangeMultipliers(opt_problem)[source]

Bases: object

Class that implements the computation of Lagrange Multipliers.

Denote \(x^\ast\) an optimal solution of the optimization problem below.

\[\begin{split}\begin{aligned} & \text{Minimize} & & f(x) \\ & \text{relative to} & & x \\ & \text{subject to} & & \left\{\begin{aligned} & g(x)\le0, \\ & h(x)=0, \\ & \ell\le x\le u. \end{aligned}\right. \end{aligned}\end{split}\]

If the constraints are qualified at \(x^\ast\) then the Lagrange multipliers of \(x^\ast\) are the vectors \(\lambda_g\), \(\lambda_h\), \(\lambda_\ell\) and \(\lambda_u\) satisfying

\[\begin{split}\left\{\begin{aligned} &\frac{\partial f}{\partial x}(x^\ast) +\lambda_g^\top\frac{\partial g}{\partial x}(x^\ast) +\lambda_h^\top\frac{\partial h}{\partial x}(x^\ast) +\sum_j\lambda_{\ell,j}+\sum_j\lambda_{u,j} =0,\\ &\lambda_{g,i}\ge0\text{ if }g_i(x^\ast)=0, \text{ otherwise }\lambda_{g,i}=0,\\ &\lambda_{\ell,j}\le0\text{ if }x^\ast_j=\ell_j, \text{ otherwise }\lambda_{\ell,j}=0,\\ &\lambda_{u,j}\ge0\text{ if }x^\ast_j=u_j, \text{ otherwise }\lambda_{u,j}=0. \end{aligned}\right.\end{split}\]
Parameters

opt_problem (gemseo.algos.opt_problem.OptimizationProblem) – The optimization problem on which Lagrange multipliers shall be computed.

Return type

None

compute(x_vect, ineq_tolerance=1e-06, rcond=- 1)[source]

Compute the Lagrange multipliers, as a post-processing of the optimal point.

This solves:

(d ActiveConstraints)’ d Objective (——————-) . Lambda = - ———– (d X ) d X

Parameters
  • x_vect (numpy.ndarray) – The optimal point on which the multipliers shall be computed.

  • ineq_tolerance (float) –

    The tolerance on inequality constraints.

    By default it is set to 1e-06.

  • rcond (float) –

    The cut-off ratio for small singular values of the Jacobian (see scipy.linalg.lsq).

    By default it is set to -1.

Returns

The Lagrange multipliers.

Return type

dict[str, tuple[list[str], numpy.ndarray]]

get_multipliers_arrays()[source]

Return the Lagrange multipliers (zero and nonzero) as arrays.

Returns

The Lagrange multipliers.

Return type

dict[str, dict[str, numpy.ndarray]]

CSTR_LABELS = ['lower_bounds', 'upper_bounds', 'inequality', 'equality']
EQUALITY = 'equality'
INEQUALITY = 'inequality'
LOWER_BOUNDS = 'lower_bounds'
UPPER_BOUNDS = 'upper_bounds'