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.

getCallsNumber()

Accessor to the number of calls.

getClassName()

Accessor to the object's name.

getConstraintError()

Accessor to the constraint error.

getConstraintErrorHistory()

Accessor to the evolution of the constraint error.

getFinalPoints()

Accessor to the final points.

getFinalValues()

Accessor to the final values.

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.

getParetoFrontsIndices()

Accessor to the Pareto fronts indices in the final population.

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.

getStatus()

Accessor to the generic status.

getStatusMessage()

Accessor to the specialized status string.

getTimeDuration()

Accessor to the elapsed time.

hasName()

Test if the object is named.

setCallsNumber(callsNumber)

Accessor to the number calls.

setFinalPoints(finalPoints)

Accessor to the final points.

setFinalValues(finalValues)

Accessor to the final values.

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.

setParetoFrontsIndices(indices)

Accessor to the Pareto fronts indices in the final population.

setProblem(problem)

Accessor to the underlying optimization problem.

setStatus(status)

Accessor to the generic status.

setStatusMessage(statusMessage)

Accessor to the specialized status string.

setTimeDuration(time)

Accessor to the elapsed time.

getEvaluationNumber

setEvaluationNumber

__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.

getCallsNumber()

Accessor to the number of calls.

Returns:
callsNumberint

Number of objective calls.

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.

getFinalPoints()

Accessor to the final points.

Returns:
finalPointsSample

Final population. For non-evolutionary algorithms this will return the optimal point.

getFinalValues()

Accessor to the final values.

Returns:
finalValuesSample

Values at the final points. For non-evolutionary algorithms this will return the optimal value.

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

getParetoFrontsIndices()

Accessor to the Pareto fronts indices in the final population.

In the multi-objective case, it consists of stratas of points in the final population. The first front contains the best candidates according to the objectives.

Returns:
indiceslist of Indices

Pareto fronts indices

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.

getStatus()

Accessor to the generic status.

Returns:
statusint

Status flag, possible values SUCCESS, FAILURE, TIMEOUT, INTERRUPTION, MAXIMUMCALLS

getStatusMessage()

Accessor to the specialized status string.

Returns:
statusMessagestr

Convergence or error message

getTimeDuration()

Accessor to the elapsed time.

Returns:
timefloat

Optimization duration in seconds

hasName()

Test if the object is named.

Returns:
hasNamebool

True if the name is not empty.

setCallsNumber(callsNumber)

Accessor to the number calls.

Parameters:
callsNumberint

Number of objective calls.

setFinalPoints(finalPoints)

Accessor to the final points.

Parameters:
finalPointsSample

Final population

setFinalValues(finalValues)

Accessor to the final values.

Parameters:
finalValuesSample

Values at the final points

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

setParetoFrontsIndices(indices)

Accessor to the Pareto fronts indices in the final population.

Parameters:
indices2-d sequence of int

Pareto fronts indices

setProblem(problem)

Accessor to the underlying optimization problem.

Parameters:
problemOptimizationProblem

Problem corresponding to the result

setStatus(status)

Accessor to the generic status.

Parameters:
statusint

Status flag, possible values SUCCESS, FAILURE, TIMEOUT, INTERRUPTION, MAXIMUMCALLS

setStatusMessage(statusMessage)

Accessor to the specialized status string.

Parameters:
statusMessagestr

Convergence or error message

setTimeDuration(time)

Accessor to the elapsed time.

Parameters:
timefloat

Optimization duration in seconds

Examples using the class

Use the FORM - SORM algorithms

Use the FORM - SORM algorithms

Using the FORM - SORM algorithms on a nonlinear function

Using the FORM - SORM algorithms on a nonlinear function

Optimization with constraints

Optimization with constraints

Optimization using NLopt

Optimization using NLopt

Mix/max search using optimization

Mix/max search using optimization

Optimization using bonmin

Optimization using bonmin

Quick start guide to optimization

Quick start guide to optimization

Optimization of the Rastrigin test function

Optimization of the Rastrigin test function

Optimization using dlib

Optimization using dlib

EfficientGlobalOptimization examples

EfficientGlobalOptimization examples