Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: nlopt failure #33

Open
jeff-regier opened this issue Feb 22, 2015 · 14 comments
Open

ERROR: nlopt failure #33

jeff-regier opened this issue Feb 22, 2015 · 14 comments

Comments

@jeff-regier
Copy link

I often encounter "ERROR: nlopt failure" when I run NLopt with ftol_abs set to let less than 1e-6. Is that behavior to be expected? I'd like to set ftol_abs to about 1e-8. The derivatives I pass to NLopt are all analytic, and I've verified them in test cases by comparing them to results from numeric differentiation. Are these errors likely due to numerical instability, i.e. slight incompatibilities between the objective function's values the derivatives? Or are there other common causes of nlopt failures? Are there any standard ways to work around this type of error?
Thanks.

@stevengj
Copy link
Member

Which algorithm are you using?

At some point, you will run into roundoff-error limitations, although in that case NLopt should ideally throw a "roundoff-limited" exception.

@jeff-regier
Copy link
Author

LD_LBFGS. I've never encountered a "roundoff-limited" exception, only "nlopt failure".

@stevengj
Copy link
Member

Do you have a simple test case that illustrates this?

@jeff-regier
Copy link
Author

I don't, unfortunately. I realize that makes it pretty difficult to diagnose the problem without one. The problem only appears for fairly complicated optimization problems. If I can recreate it without a lot of optimization variables, I'll post the code here.

@stevengj
Copy link
Member

See also stevengj/nlopt#28 (a vaguely similar issue with SLSQP, which I'm also having difficulty reproducing).

@danamm
Copy link

danamm commented May 7, 2015

Using NLopt (LD_LBFGS solver in Julia), I am receiving nlopt failure error. I am suspicious that the options are not set properly. I am wondering how to check that option parameters passed is actually set correctly?

I ask because I am setting fairly large values as below

NLopt.ftol_abs!(opts, 0.1);
NLopt.xtol_abs!(opts, 0.1);    
NLopt.ftol_rel!(opts, 0.1);
NLopt.xtol_rel!(opts, 0.1);
NLopt.maxeval!(opts, 100);   
NLopt.min_objective!(opts, fun);
NLopt.lower_bounds!(opts, 0.0);
obj, X, ret = NLopt.optimize(opts, X0)

But what I see is that, while objective is fixed up to 6 digits, solution up to 9 digits, and gradient is small (order of 1e-7 to 1e-15) the optimization does not stop, until it sends an

nlopt failure Error

which there is no clue why the error happens.

@stevengj
Copy link
Member

If the options are incorrect it would throw a different exception. The BFGS failures are a bit harder to diagnose (in part because the Fortran BFGS code I am calling is rather opaque), but usually stem from you gradient not being accurate enough. Do you have an analytical gradient? If so, have you checked it against a finite-difference approximation?

@danamm
Copy link

danamm commented May 16, 2015

Yes, analytical gradients are used, and I have checked correctness against Calculus.gradient.

@jotwin
Copy link

jotwin commented May 18, 2017

I'm getting this problem too in my complicated optimization. I'm using LBFGS and analytic gradients. I've never seen a roundoff error, only "nlopt failure -1". It goes away if I relax ftol_abs. Sorry I don't have a simple test case.

@reem21090
Copy link

I am using NLOPT on G1 CEC test problem, I use the lower bounds as start points which are all in the feasible region. However, The error

nlopt.RoundoffLimited: NLopt roundoff-limited

appears, but after running several times it may not appear but then appears again.

It doesn't make the code predictable, so I wonder if its due to a bug in the nlopt library, please advise me how to get over it. Thanks

@mzaffalon
Copy link
Contributor

@reem21090 Can you provide a minimal working example of your code?

@reem21090
Copy link

reem21090 commented Jun 8, 2019

@reem21090 Can you provide a minimal working example of your code?

Thank you, it's working well now. But I am suspicious about this unpredictable behavior.

@liuliucen
Copy link

Hi,
here is my minimal working example code which always gives a roundoff error
i really don't know how to solve it.
any suggestions?
main.txt

@jonas-eschle
Copy link

So for me, I've got this error a lot when the initial points are too close to the minimum. So I'll artificially set the somewhere else (e.g. by the sqrt(inv_hessian)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants