# Problems with scipy's optimize

I have a random bug with scipy's optimize . I use it in the context of SageMath 9 (Python 3.7.3). I checked 3 algorithms : shgo, dual_annealing and full_optimize. All don't work well (at all !).

I optimise with a 3 parameters functions with given bounds. The algorithm randomly sends to my error function the "1e-8" value for any of the 3 parameters. I displayed the vector + error to understand it. AS you can see, in this case, the first parameter is 1e-8 whereas it is outside the bounds. Sometimes it happens for the second parameter, or the 3rd ....

[3.95049282e-19 3.03055607e-20 1.96212098e+29] 0.0030238733573031864
[3.95273920e-19 3.05821352e-20 1.90997635e+29] 0.002957956545311753
[3.95037412e-19 3.04080173e-20 1.93312145e+29] 0.0029572689364709224
sage.all_cmdline:33: IntegrationWarning: The occurrence of roundoff error is detected, which prevents
the requested tolerance from being achieved.  The error may be
underestimated.
[1.00000000e-08 3.04080173e-20 1.93312145e+29] 1.0713560755245306
Overflow
[3.95037412e-19 3.04080173e-20 1.93312145e+29] 0.0029572689364709224


The behaviour is the same for all of them. However the value inserted is not always the same, I noticed 3 : 1e-10, 1e-8 and 1.49011612e-08

Moreover, all do not send nice values. For example, the full_optimize always send values close to the highest bound. Perhaps are the value computed with a simple linear average and I guess it should not be the case.

my bounds are :

bounds = [(1*e,4*e),(0.1*e,0.5*e),(1e5,1e40)]


with e=1.6e-19

Is there an alternative for optimization in sagemath ?

regards, Mike

edit retag close merge delete