# [ot-users] constraint error FORM

Anita Laera anita.laera87 at gmail.com
Wed Mar 15 12:59:13 CET 2017

I am using Cobyla and the only 0.1 I can find is the maximum residual error.

The maximum values I set for all the errors are:
- absolute error = 0.001
- relative error = 0.001
- constraint error = 8.5
- residual error = 0.1

I have also another question related to the convergence.
I have a very similar case as the one explained before apart from the
number of input parameters, that are 3.

In FORM, using Cobyla, the convergence is reached if either absolute and
relative error are below the threshold or constraint and residual error are
below the threshold.

The convergence is reached after 65 iterations when the errors are:
abs = 0.000761284523
rel = 0.00138743025
cons = 2.67538622   (also in this case the constraint error calculated as
f(x) - s is 0.1 larger than what is returned by getConstraintError(), in
fact it is 2.77538622)
res = 0.0000854386493

By plotting the error history I can see that already from the 10th
iteration both the residual and the constraint error are lower than the
maximum value I set. The absolute and relative error are still quite large.
It performs anyway 65 iterations to converge (with the final error results
written above).
Considering the low values of all the errors, the results are quite good
but I cannot understand what is the stop criterion of the analysis.
If at each iteration the errors are checked, than the analysis should have
converged much earlier.

Thank you,
Anita

2017-03-15 11:25 GMT+01:00 regis lebrun <regis_anne.lebrun_dutfoy at yahoo.fr>:

> Hi Anita,
>
>
> Here is how things are computed:
> + When you call FORM::run(), there is a call to Analytical::run(), then
> the AnalyticalResult is converted into a FORMResult.
> + The method Analytical::run() converts the event into a StandardEvent,
> which is used to build an OptimizationProblem formulated into the standard
> space. This optimization problem (minimize the squared norm of u subject to
> f(T(u)) >= s, assuming that your event is a threshold exceedance) is solved
> by the solver you provided up to the tolerances you wanted.
> + The corresponding OptimizationResult is stored into the
> AnalyticalResult, it is what you get when you call AnalyticalResult::getOptimizationResult()
> or FORMResult::getOptimizationResult(). You can then call
> OptimizationResult::getConstraintError().
> + The optimal point, found in the standard space, is also transformed back
> to the initial space. You get it when you call FORMResult::
> getPhysicalDesignPoint()
>
> The most surprising thing in your problem is the fact that the value you
> get is *exactly* the correct value up to a shift of *exactly* 0.1. It looks
> like a kind of finite difference step has been added somewhere or something
> in the same spirit.
>
> Could you please tell me the optimization solver you used for the
> computation? If there is a bug somewhere, it may be there, as the different
> error history are rebuilt after the resolution of the problem and not
> directly given by the algorithm.
>
> Do you have something equal to 0.1 in your script?
>
> Cheers
>
> Régis
>
>
> ________________________________
> De : Anita Laera <anita.laera87 at gmail.com>
> À : regis lebrun <regis_anne.lebrun_dutfoy at yahoo.fr>
> Cc : "users at openturns.org" <users at openturns.org>
> Envoyé le : Mercredi 15 mars 2017 9h47
> Objet : Re: [ot-users] constraint error FORM
>
>
>
> Hi Regis,
>
> I am going to explain how I address this problem, to understand if it is
> correct.
>
> I have five input parameters and, every time the function _exec(x) is
> executed, I print the value of each variable and the result obtained from
> that combination of input values. The values I print are in the physical
> space.
> At the end of the FORM analysis, I get the value of the design point in
> the physical space and I search for that combination of parameters in the
> list of printed input variables. The result associated to these parameters
> is the one that I compare with the threshold to calculate the constraint
> error.
>
> To make an example with numbers, I have 5 input parameters with
> distributions:
> param_1 = TruncatedNormal(20, 1, 16, 24)
> param_2 = TruncatedNormal(17.5, 0.88, 14, 21)
> param_3 = TruncatedNormal(20, 1, 16, 24)
> param_4 = TruncatedNormal(20, 1, 16, 24)
> param_5 = TruncatedNormal(20, 1, 16, 24)
>
> The threshold of the criterion I have chosen is 850.
>
> Every time _exec() is called (at each evaluation), I have a list of input
> parameters and the corresponding result, for example:
> [20.0673673248819, 17.3184136978776, 19.9079471477259, 20.1402093633652,
> 20.0223766740268] and the result is [825.665964705004]
>
>
> At the end of the analysis, the design point is:
>
>
> standard_space_point: ['param_1 = 0.1997867549606676', 'param_2 =
> -0.055279300017051544', 'param_3 = -0.0628992654226241', 'param_4 =
> 0.5183599165842491', 'param_5 = -0.10839510883000002']
>
> physical_space_point: ['param_1 = 20.199773930262452', 'param_2 =
> 17.451357610548104', 'param_3 = 19.937104724030977', 'param_4 =
> 20.518323977607277', 'param_5 = 19.89161178413688']
>
> I take the values corresponding to the physical space point and I find the
> corresponding result, i.e. 845.307471892986. Does this correspond to
> f(x_opt)?
> Then I calculate the constraint error as |845.307471892986 - 850| =
> 4.692528107014
>
> Is this the correct procedure? If not, how do I get the constraint error
> without using getConstraintError()?
> In this example, the value that is returned by getConstraintError() is
> 4.59252810701402 and I want to understand how this is calculated.
>
>
>
>
>
> 2017-03-14 17:48 GMT+01:00 regis lebrun <regis_anne.lebrun_dutfoy at yahoo.fr
> >:
>
> Hi Anita,
> >
> >You are right, the constraint error is an obsolute error on the
> constraint. It is equal to |f(x_opt) - s| = |f(T(u_opt)) - s| where f is
> your code, T the inverse iso-probabilistic transformation that maps the
> standard space into the physical space, u_opt the design point (so in the
> standard space) and x_opt = T(u_opt) its image in the physical space.
> >
> >Are you 100% sure that you compute f at the correct point in your
> verification? If you compare f(u_opt) with s, it is wrong (and I suspect
> that you did it ;-)). Otherwise there is a bug and we need more input from
> your side in order to catch it.
> >
> >Cheers
> >
> >Régis
> >
> >
> >
> >______________________________ __
> >De : Anita Laera <anita.laera87 at gmail.com>
> >À : users at openturns.org
> >Envoyé le : Mardi 14 mars 2017 15h25
> >Objet : [ot-users] constraint error FORM
> >
> >
> >
> >
> >Hi all,
> >I have a simple question regarding the constraint error of a FORM
> analysis, the constraint error is defined as |f(u_n) - s| , i.e. the
> absolute difference between the result and the threshold.
> >
> >In my case, the result in the design point is 845.307471892986 and the
> threshold is 850 (in the physical space).
> >I would expect the constraint error to be about 4.69, but the value
> obtained with the method getConstraintError() is 4.59. Why?
> >
> >If I calculate the difference between the result and the threshold for
> each performed evaluation, I never find 4.59.
> >
> >Could it be different because it is calculated in the standard space u?
> How could I verify the value?
> >
> >Thank you for your time!
> >______________________________ _________________
> >OpenTURNS users mailing list
> >users at openturns.org
> >http://openturns.org/mailman/ listinfo/users
> >
>
> _______________________________________________
> OpenTURNS users mailing list
> users at openturns.org
> http://openturns.org/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://openturns.org/pipermail/users/attachments/20170315/895ebec7/attachment.html>