1%feature("docstring") OT::OptimizationResult
2"Optimization result.
3
4Returned by optimization solvers, see :class:`~openturns.OptimizationAlgorithm`.
5
6Parameters
7----------
8problem : :class:`~openturns.OptimizationProblem`
9    Problem being solved."
10
11// ---------------------------------------------------------------------
12
13%feature("docstring") OT::OptimizationResult::getAbsoluteError
14"Accessor to the absolute error.
15
16Returns
17-------
18absoluteError : float
19    Absolute error of the input point :math:`\vect{x}`, defined by :math:`\epsilon^a_n=\|\vect{x}_{n+1}-\vect{x}_n\|_{\infty}` where :math:`\vect{x}_{n+1}` and :math:`\vect{x}_n` are two consecutive approximations of the optimum."
20
21// ---------------------------------------------------------------------
22
23%feature("docstring") OT::OptimizationResult::getAbsoluteErrorHistory
24"Accessor to the evolution of the absolute error.
25
26Returns
27-------
28absoluteErrorHistory : :class:`~openturns.Sample`
29    Value of the absolute error at each function evaluation."
30
31// ---------------------------------------------------------------------
32
33%feature("docstring") OT::OptimizationResult::getConstraintError
34"Accessor to the constraint error.
35
36Returns
37-------
38constraintError : float
39    Constraint error, defined by :math:`\gamma_n=\|g(\vect{x}_n)\|_{\infty}` where :math:`\vect{x}_n` is the current approximation of the optimum and :math:`g` is the function that gathers all the equality and inequality constraints (violated values only)."
40
41// ---------------------------------------------------------------------
42
43%feature("docstring") OT::OptimizationResult::getConstraintErrorHistory
44"Accessor to the evolution of the constraint error.
45
46Returns
47-------
48constraintErrorHistory : :class:`~openturns.Sample`
49    Value of the constraint error at each function evaluation."
50
51// ---------------------------------------------------------------------
52
53%feature("docstring") OT::OptimizationResult::setEvaluationNumber
54"Accessor to the number of evaluation.
55
56Parameters
57----------
58evaluationNumber : int
59    Number of evaluations."
60
61// ---------------------------------------------------------------------
62
63%feature("docstring") OT::OptimizationResult::getEvaluationNumber
64"Accessor to the number of evaluations.
65
66Returns
67-------
68evaluationNumber : int
69    Number of evaluations."
70
71// ---------------------------------------------------------------------
72
73%feature("docstring") OT::OptimizationResult::setIterationNumber
74"Accessor to the number of iterations.
75
76Parameters
77----------
78iterationNumber : int
79    Number of iterations."
80
81// ---------------------------------------------------------------------
82
83%feature("docstring") OT::OptimizationResult::getIterationNumber
84"Accessor to the number of iterations.
85
86Returns
87-------
88iterationNumber : int
89    Number of iterations."
90
91// ---------------------------------------------------------------------
92
93%feature("docstring") OT::OptimizationResult::getRelativeError
94"Accessor to the relative error.
95
96Returns
97-------
98relativeError : float
99    Relative error of the input point :math:`\vect{x}`. If :math:`\|\vect{x}_{n+1}\|_{\infty}\neq 0`, then the relative error is :math:`\epsilon^r_n=\epsilon^a_n/\|\vect{x}_{n+1}\|_{\infty}` where :math:`\epsilon^a_n=\|\vect{x}_{n+1}-\vect{x}_n\|_{\infty}` is the absolute error. Otherwise, the relative error is :math:`\epsilon^r_n=-1`."
100
101// ---------------------------------------------------------------------
102
103%feature("docstring") OT::OptimizationResult::getRelativeErrorHistory
104"Accessor to the evolution of the relative error.
105
106Returns
107-------
108relativeErrorHistory : :class:`~openturns.Sample`
109    Value of the relative error at each function evaluation."
110
111// ---------------------------------------------------------------------
112
113%feature("docstring") OT::OptimizationResult::getResidualError
114"Accessor to the residual error.
115
116Returns
117-------
118residualError : float
119    Relative error, defined by :math:`\epsilon^r_n=\frac{\|f(\vect{x}_{n+1})-f(\vect{x}_{n})\|}{\|f(\vect{x}_{n+1})\|}` if :math:`\|f(\vect{x}_{n+1})\|\neq 0`, else :math:`\epsilon^r_n=-1`."
120
121// ---------------------------------------------------------------------
122
123%feature("docstring") OT::OptimizationResult::getResidualErrorHistory
124"Accessor to the evolution of the residual error.
125
126Returns
127-------
128residualErrorHistory : :class:`~openturns.Sample`
129    Value of the residual error at each function evaluation."
130
131// ---------------------------------------------------------------------
132
133%feature("docstring") OT::OptimizationResult::setOptimalPoint
134"Accessor to the optimal point.
135
136Parameters
137----------
138optimalPoint : :class:`~openturns.Point`
139    Optimal point"
140
141// ---------------------------------------------------------------------
142
143%feature("docstring") OT::OptimizationResult::getOptimalPoint
144"Accessor to the optimal point.
145
146Returns
147-------
148optimalPoint : :class:`~openturns.Point`
149    Optimal point"
150
151// ---------------------------------------------------------------------
152
153%feature("docstring") OT::OptimizationResult::computeLagrangeMultipliers
154"Compute the Lagrange multipliers.
155
156Parameters
157----------
158x : sequence of float, optional
159    Location where the multipliers are computed
160    If not provided, the optimal point is used
161
162Returns
163-------
164lagrangeMultiplier : sequence of float
165    Lagrange multipliers of the problem at point x.
166    It needs an extra call to the objective function gradient unless it can be
167    computed during the optimization (AbdoRackwitz or SQP).
168
169Notes
170-----
171The Lagrange multipliers :math:`\vect{\lambda}` are associated with the following Lagrangian formulation of the optimization problem:
172
173.. math::
174
175    \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})
176
177where :math:`\vect{\alpha}^{+}=(\max(0,\alpha_1),\hdots,\max(0,\alpha_n))`.
178
179The Lagrange multipliers are stored as :math:`(\vect{\lambda}_{eq}, \vect{\lambda}_{\ell}, \vect{\lambda}_{u}, \vect{\lambda}_{ineq})`, where:
180    - :math:`\vect{\lambda}_{eq}` is of dimension 0 if there is no equality
181      constraint, else of dimension the dimension of :math:`g(\vect{x})` ie the number of scalar equality constraints
182    - :math:`\vect{\lambda}_{\ell}` and :math:`\vect{\lambda}_{u}` are of dimension 0 if there is no bound constraint, else of dimension of :math:`\vect{x}`
183    - :math:`\vect{\lambda}_{eq}` is of dimension 0 if there is no inequality constraint, else of dimension the dimension of :math:`h(\vect{x})` ie the number of scalar inequality constraints
184
185The vector :math:`\vect{\lambda}` is solution of the following linear system:
186
187.. math::
188
189    \Tr{\vect{\lambda}}_{eq}\left[\dfrac{\partial g}{\partial\vect{x}}(\vect{x})\right]+
190    \Tr{\vect{\lambda}}_{\ell}\left[\dfrac{\partial (\vect{x}-\vect{\ell})^{+}}{\partial\vect{x}}(\vect{x})\right]+
191    \Tr{\vect{\lambda}}_{u}\left[\dfrac{\partial (\vect{u}-\vect{x})^{+}}{\partial\vect{x}}(\vect{x})\right]+
192    \Tr{\vect{\lambda}}_{ineq}\left[\dfrac{\partial h}{\partial\vect{x}}(\vect{x})\right]=-\dfrac{\partial J}{\partial\vect{x}}(\vect{x})
193
194If there is no constraint of any kind, :math:`\vect{\lambda}` is of dimension 0, as well as if no constraint is active."
195
196// ---------------------------------------------------------------------
197
198%feature("docstring") OT::OptimizationResult::setOptimalValue
199"Accessor to the optimal value.
200
201Parameters
202----------
203optimalValue : :class:`~openturns.Point`
204    Value at the optimal point"
205
206// ---------------------------------------------------------------------
207
208%feature("docstring") OT::OptimizationResult::getOptimalValue
209"Accessor to the optimal value.
210
211Returns
212-------
213optimalValue : :class:`~openturns.Point`
214    Value at the optimal point"
215
216// ---------------------------------------------------------------------
217
218%feature("docstring") OT::OptimizationResult::getInputSample
219"Accessor to the input sample.
220
221Returns
222-------
223inputSample : :class:`~openturns.Sample`
224    Input points used by the solver"
225
226// ---------------------------------------------------------------------
227
228%feature("docstring") OT::OptimizationResult::getOutputSample
229"Accessor to the output sample.
230
231Returns
232-------
233outputSample : :class:`~openturns.Sample`
234    Output points used by the solver"
235
236// ---------------------------------------------------------------------
237
238%feature("docstring") OT::OptimizationResult::setProblem
239"Accessor to the underlying optimization problem.
240
241Parameters
242----------
243problem : :class:`~openturns.OptimizationProblem`
244    Problem corresponding to the result"
245
246// ---------------------------------------------------------------------
247
248%feature("docstring") OT::OptimizationResult::getProblem
249"Accessor to the underlying optimization problem.
250
251Returns
252-------
253problem : :class:`~openturns.OptimizationProblem`
254    Problem corresponding to the result"
255
256// ---------------------------------------------------------------------
257
258%feature("docstring") OT::OptimizationResult::drawErrorHistory
259"Draw the convergence criteria history.
260
261Returns
262-------
263graph : :class:`~openturns.Graph`
264    Convergence criteria history graph"
265
266// ---------------------------------------------------------------------
267
268%feature("docstring") OT::OptimizationResult::drawOptimalValueHistory
269"Draw the optimal value history.
270
271Returns
272-------
273graph : :class:`~openturns.Graph`
274    Optimal value history graph"
275