Help debugging `nlopt failure: -1` errors

question

#1

Any tips on debugging nlopt failure: -1 errors? There is no information in the error message to understand what happened. Sometimes I have found that this occurs because I am computing something wrong in the gradient. But in other occasions I just can’t tell what happened. Is there a list of possible issues that can lead to this error?


#2

It looks like that string is defined here and the function chk is called on setting parameters. I don’t think the C library is more specific than that.

I do have the same problem from time to time, for instance trying to set constraints on algorithms that do not take any and I would also benefit from finer error messages.


#3

In my particular scenario, I don’t have any constrains, and I am using :LD_LBFGS.


#4

What is the cause of your errors?


#5

I don’t know, that’s the problem. I already checked that the gradient is being computed correctly, and that it does not go to infinity. I’m not sure what else could be the cause of this.


#6

Can you post the code?


#7

I fear it is a very complicated optimization problem. That’s why I framed the question a bit more generally. I am interested in all the possible issues that could give raise to the nlopt failure: -1 error, or at least the most common causes, if such a list is possible.


#8

I’m experiencing the same issue. I also have a pretty complicated optimization problem with 5 constraint functions. I’m using the LD_SLSQP algorithm.


#9

Do similar problems arise with a different solver (e.g. Ipopt)?


#10

The most common cause is that your gradient is wrong, and so the algorithm gives up.


#11

So if I use autodiff I should never get this error. I will try that and see.