OptimizationResult

class OptimizationResult(*args)

Optimization result.

Returned by optimization solvers, see OptimizationAlgorithm.

Parameters
problemOptimizationProblem

Problem being solved.

Methods

computeLagrangeMultipliers(*args)

Compute the Lagrange multipliers.

drawErrorHistory()

Draw the convergence criteria history.

drawOptimalValueHistory()

Draw the optimal value history.

getAbsoluteError()

Accessor to the absolute error.

getAbsoluteErrorHistory()

Accessor to the evolution of the absolute error.

getClassName()

Accessor to the object's name.

getConstraintError()

Accessor to the constraint error.

getConstraintErrorHistory()

Accessor to the evolution of the constraint error.

getEvaluationNumber()

Accessor to the number of evaluations.

getId()

Accessor to the object's id.

getInputSample()

Accessor to the input sample.

getIterationNumber()

Accessor to the number of iterations.

getName()

Accessor to the object's name.

getOptimalPoint()

Accessor to the optimal point.

getOptimalValue()

Accessor to the optimal value.

getOutputSample()

Accessor to the output sample.

getProblem()

Accessor to the underlying optimization problem.

getRelativeError()

Accessor to the relative error.

getRelativeErrorHistory()

Accessor to the evolution of the relative error.

getResidualError()

Accessor to the residual error.

getResidualErrorHistory()

Accessor to the evolution of the residual error.

getShadowedId()

Accessor to the object's shadowed id.

getVisibility()

Accessor to the object's visibility state.

hasName()

Test if the object is named.

hasVisibleName()

Test if the object has a distinguishable name.

setEvaluationNumber(evaluationNumber)

Accessor to the number of evaluation.

setIterationNumber(iterationNumber)

Accessor to the number of iterations.

setName(name)

Accessor to the object's name.

setOptimalPoint(optimalPoint)

Accessor to the optimal point.

setOptimalValue(optimalValue)

Accessor to the optimal value.

setProblem(problem)

Accessor to the underlying optimization problem.

setShadowedId(id)

Accessor to the object's shadowed id.

setVisibility(visible)

Accessor to the object's visibility state.

store

__init__(*args)
computeLagrangeMultipliers(*args)

Compute the Lagrange multipliers.

Parameters
xsequence of float, optional

Location where the multipliers are computed If not provided, the optimal point is used

Returns
lagrangeMultipliersequence of float

Lagrange multipliers of the problem at point x. It needs an extra call to the objective function gradient unless it can be computed during the optimization (AbdoRackwitz or SQP).

Notes

The Lagrange multipliers \vect{\lambda} are associated with the following Lagrangian formulation of the optimization problem:

\cL(\vect{x}, \vect{\lambda}_{eq}, \vect{\lambda}_{\ell}, \vect{\lambda}_{u}, \vect{\lambda}_{ineq}) = J(\vect{x}) + \Tr{\vect{\lambda}}_{eq} g(\vect{x}) + \Tr{\vect{\lambda}}_{\ell} (\vect{x}-\vect{\ell})^{+} + \Tr{\vect{\lambda}}_{u} (\vect{u}-\vect{x})^{+} + \Tr{\vect{\lambda}}_{ineq}  h^{+}(\vect{x})

where \vect{\alpha}^{+}=(\max(0,\alpha_1),\hdots,\max(0,\alpha_n)).

The Lagrange multipliers are stored as (\vect{\lambda}_{eq}, \vect{\lambda}_{\ell}, \vect{\lambda}_{u}, \vect{\lambda}_{ineq}), where:
  • \vect{\lambda}_{eq} is of dimension 0 if there is no equality constraint, else of dimension the dimension of g(\vect{x}) ie the number of scalar equality constraints

  • \vect{\lambda}_{\ell} and \vect{\lambda}_{u} are of dimension 0 if there is no bound constraint, else of dimension of \vect{x}

  • \vect{\lambda}_{eq} is of dimension 0 if there is no inequality constraint, else of dimension the dimension of h(\vect{x}) ie the number of scalar inequality constraints

The vector \vect{\lambda} is solution of the following linear system:

\Tr{\vect{\lambda}}_{eq}\left[\dfrac{\partial g}{\partial\vect{x}}(\vect{x})\right]+
\Tr{\vect{\lambda}}_{\ell}\left[\dfrac{\partial (\vect{x}-\vect{\ell})^{+}}{\partial\vect{x}}(\vect{x})\right]+
\Tr{\vect{\lambda}}_{u}\left[\dfrac{\partial (\vect{u}-\vect{x})^{+}}{\partial\vect{x}}(\vect{x})\right]+
\Tr{\vect{\lambda}}_{ineq}\left[\dfrac{\partial h}{\partial\vect{x}}(\vect{x})\right]=-\dfrac{\partial J}{\partial\vect{x}}(\vect{x})

If there is no constraint of any kind, \vect{\lambda} is of dimension 0, as well as if no constraint is active.

drawErrorHistory()

Draw the convergence criteria history.

Returns
graphGraph

Convergence criteria history graph

drawOptimalValueHistory()

Draw the optimal value history.

Returns
graphGraph

Optimal value history graph

getAbsoluteError()

Accessor to the absolute error.

Returns
absoluteErrorfloat

Absolute error of the input point \vect{x}, defined by \epsilon^a_n=\|\vect{x}_{n+1}-\vect{x}_n\|_{\infty} where \vect{x}_{n+1} and \vect{x}_n are two consecutive approximations of the optimum.

getAbsoluteErrorHistory()

Accessor to the evolution of the absolute error.

Returns
absoluteErrorHistorySample

Value of the absolute error at each function evaluation.

getClassName()

Accessor to the object’s name.

Returns
class_namestr

The object class name (object.__class__.__name__).

getConstraintError()

Accessor to the constraint error.

Returns
constraintErrorfloat

Constraint error, defined by \gamma_n=\|g(\vect{x}_n)\|_{\infty} where \vect{x}_n is the current approximation of the optimum and g is the function that gathers all the equality and inequality constraints (violated values only).

getConstraintErrorHistory()

Accessor to the evolution of the constraint error.

Returns
constraintErrorHistorySample

Value of the constraint error at each function evaluation.

getEvaluationNumber()

Accessor to the number of evaluations.

Returns
evaluationNumberint

Number of evaluations.

getId()

Accessor to the object’s id.

Returns
idint

Internal unique identifier.

getInputSample()

Accessor to the input sample.

Returns
inputSampleSample

Input points used by the solver

getIterationNumber()

Accessor to the number of iterations.

Returns
iterationNumberint

Number of iterations.

getName()

Accessor to the object’s name.

Returns
namestr

The name of the object.

getOptimalPoint()

Accessor to the optimal point.

Returns
optimalPointPoint

Optimal point

getOptimalValue()

Accessor to the optimal value.

Returns
optimalValuePoint

Value at the optimal point

getOutputSample()

Accessor to the output sample.

Returns
outputSampleSample

Output points used by the solver

getProblem()

Accessor to the underlying optimization problem.

Returns
problemOptimizationProblem

Problem corresponding to the result

getRelativeError()

Accessor to the relative error.

Returns
relativeErrorfloat

Relative error of the input point \vect{x}. If \|\vect{x}_{n+1}\|_{\infty}\neq 0, then the relative error is \epsilon^r_n=\epsilon^a_n/\|\vect{x}_{n+1}\|_{\infty} where \epsilon^a_n=\|\vect{x}_{n+1}-\vect{x}_n\|_{\infty} is the absolute error. Otherwise, the relative error is \epsilon^r_n=-1.

getRelativeErrorHistory()

Accessor to the evolution of the relative error.

Returns
relativeErrorHistorySample

Value of the relative error at each function evaluation.

getResidualError()

Accessor to the residual error.

Returns
residualErrorfloat

Relative error, defined by \epsilon^r_n=\frac{\|f(\vect{x}_{n+1})-f(\vect{x}_{n})\|}{\|f(\vect{x}_{n+1})\|} if \|f(\vect{x}_{n+1})\|\neq 0, else \epsilon^r_n=-1.

getResidualErrorHistory()

Accessor to the evolution of the residual error.

Returns
residualErrorHistorySample

Value of the residual error at each function evaluation.

getShadowedId()

Accessor to the object’s shadowed id.

Returns
idint

Internal unique identifier.

getVisibility()

Accessor to the object’s visibility state.

Returns
visiblebool

Visibility flag.

hasName()

Test if the object is named.

Returns
hasNamebool

True if the name is not empty.

hasVisibleName()

Test if the object has a distinguishable name.

Returns
hasVisibleNamebool

True if the name is not empty and not the default one.

setEvaluationNumber(evaluationNumber)

Accessor to the number of evaluation.

Parameters
evaluationNumberint

Number of evaluations.

setIterationNumber(iterationNumber)

Accessor to the number of iterations.

Parameters
iterationNumberint

Number of iterations.

setName(name)

Accessor to the object’s name.

Parameters
namestr

The name of the object.

setOptimalPoint(optimalPoint)

Accessor to the optimal point.

Parameters
optimalPointPoint

Optimal point

setOptimalValue(optimalValue)

Accessor to the optimal value.

Parameters
optimalValuePoint

Value at the optimal point

setProblem(problem)

Accessor to the underlying optimization problem.

Parameters
problemOptimizationProblem

Problem corresponding to the result

setShadowedId(id)

Accessor to the object’s shadowed id.

Parameters
idint

Internal unique identifier.

setVisibility(visible)

Accessor to the object’s visibility state.

Parameters
visiblebool

Visibility flag.