NLopt.jl icon indicating copy to clipboard operation
NLopt.jl copied to clipboard

"nlopt failure" should be recoverable

Open kasrllc opened this issue 11 years ago • 4 comments

In the function "chk", you often throw which causes the final value of the optimum to be unavailable. In some cases, the optimum is still useful. It would be better to have access to this.

kasrllc avatar May 16 '14 16:05 kasrllc

I agree (I just ran into this myself).

One can work around this by keeping track of the current best variable in the objective function, but it's a bit ugly.

dfannius avatar May 10 '16 14:05 dfannius

Which exception in particular are you thinking of as being recoverable? In general, the underlying nlopt library may not save the final value best of the optimum on failures.

stevengj avatar Jun 01 '16 18:06 stevengj

At least NLOPT_ROUNDOFF_LIMITED should be recoverable, since the documentation specifically states that "the optimization still typically returns a useful result" in this case.

dfannius avatar Jun 07 '16 13:06 dfannius

Looking at the code, I see that in fact chk() already handles the NLOPT_ROUNDOFF_LIMITED case, so that's good.

dfannius avatar Jun 30 '16 13:06 dfannius

Closing as stale.

We graceful handle ROUNDOFF_LIMITED and FORCED_STOP errors.

Please re-open if you're still interested in this and have a different error code that you'd like to be recoverable.

odow avatar Jan 25 '23 02:01 odow