cureos / csnumerics

Portable numerical algorithms in C#
GNU Lesser General Public License v3.0
32 stars 11 forks source link

BOBYQA gets stuck in infinite loop. #7

Closed mfeemster closed 6 years ago

mfeemster commented 6 years ago

After calling BOBYQA successfully several thousand times in a row, it seems to be getting stuck on specific data sets. It gets into an infinite loop internally which stops calling the penalty delegate, and just stays in that loop forever. It keeps bouncing between:

if (resid <= ZERO) goto L_90;

and

if (crvmin != ZERO) goto L_50;

Upon debugging inspection, I see the s[], hq[] and other arrays have huge values in them like 2.3E141, ds is -4.9272591443386037E+132 and shs is Infinity. This leads me to believe something is wrong.

I am trying to solve for a few variables in reasonable ranges like -1000 to 1000 and am not doing anything out of the ordinary.

Do you have any idea what might lead to this and how I can overcome it?

I also am unsure what to do with the TrustRegion properties. I leave them as their default of -1.0. Would setting them to something different help out here?

Thanks.

mfeemster commented 6 years ago

Never mind, I've found the problem. My penalty function was returning some very large numbers in rare cases. Once I solved that, I no longer get the infinite loop.

anders9ustafsson commented 6 years ago

Glad to hear you worked things out, @mfeemster!