stevengj / nlopt

library for nonlinear optimization, wrapping many algorithms for global and local, constrained or unconstrained, optimization

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bobyqa uninitialised variables in rare cases

ocommowi opened this issue · comments

Hello,

I know this is a follow-up to issue #36 but I do not know how to re-open it. I stumbled on the same problem (segmentation fault in altmov_ due to two variables being uninitialised) when using bobyqa together with the augmented lagrangian and a small tolerance as stopping criterion (10^-12).

I ended up modifying the code of bobyqa a very little which made it work:

  • line 764 : int ksav = 1;
  • line 768 : int ibdsav = 1;

This is only an ugly correction but I would be curious to know if someone has a better option to avoid this (I suspect all of this comes from the optimised parameters being a tiny little outside the bounds when entering bobyqa - from auglag - , which does not check for it)

Thanks

hi, do you have an example that helps reproduce the issue ? which compiler are you using ?

Hi, well unfortunately the cost function being optimized is quite complex and very difficult to extract from the tool. I will try to find a simpler example but not sure I will be able to make the bug appear again. That being said when I looked at issue #36, it really sounded like the exact same crash problem.

gcc gives even more "-Wmaybe-uninitialized" warnings

could you check if #134 does solve your problem ?

I'm still interested in knowing your compiler.

I would say yes, I am going to try, thanks ! However, in tour PR, I would be careful in bobyqa. Since it's a translation of a fortran code with indexes starting at 1, I think it is better to make the default values of the index variables (such as the ones I mentioned earlier) be 1 instead of 0. I might be wrong though, I get lost easily with these indexing problems

I hope the code doesn't rely on it being uninitialized to something>1 then!
Please do test.