You are here

NLOPT fatal error -1

6 posts / 0 new
Last post
carey's picture
Offline
Joined: 10/19/2009 - 15:38
NLOPT fatal error -1

Am helping a grad student who got the error message:
Error in runHelper(model, frontendStart, intervals, silent, suppressWarnings, :
NLOPT fatal error -1

When I search on "NLOPT fatal error -1" on the site, the only thing I get is:
Rev 4444 and /trunk/ Rev 4445
which just gives code for writing ""NLOPT fatal error -1."

Anyway you can inform us mortals about what "NLOPT fatal error -1" means?

PS It would also be nice to give English outputs for "fatal error -2", -3, -4, etc.

jpritikin's picture
Offline
Joined: 05/24/2012 - 00:35
How to reproduce?

Do you have code that will reliably reproduce NLOPT fatal error -1? Can you share it?

carey's picture
Offline
Joined: 10/19/2009 - 15:38
It is not my code. I was just

It is not my code. I was just helping someone. I'll ask if he would be willing to share the code.

neale's picture
Offline
Joined: 07/31/2009 - 15:14
Probably incomputable fit function

I expect that it results from the fit function being impossible to evaluate for these specific values. Typical culprits include non-positive definite expected covariance matrices, thresholds out of order, or anything that results in a likelihood that is zero or less (difficult to take logs). As Rob notes, parameter bounds can prevent some of these problems. Revising the model specification may also help (though beware of, e.g., Cholesky problems).

To diagnose better, I recommend examining exactly what happens during optimization by creating a checkpointing file with information on every single function evaluation. The options for this are:

##
## Uncomment the next two lines to send the file to a temporary directory, otherwise it should end up in wherever getwd() is
#directory <- tempdir()
#mxOption(NULL, "Checkpoint Directory", directory)
mxOption(NULL, "Checkpoint Units", "evaluations")
mxOption(NULL, "Checkpoint Count", 1)

The output file will be named whatever the top level mxModel is named with the extension .omx and can be read into R if needed. Take a look at the change in parameter values between the last two lines in the file, as the last one likely generated the error.

AdminRobK's picture
Offline
Joined: 01/24/2014 - 12:15
checkpoint=TRUE

And don't forget to use the checkpoint=TRUE argument to mxRun().

AdminRobK's picture
Offline
Joined: 01/24/2014 - 12:15
Try again with box constraints or different optimizer

AFAIK, "NLOPT fatal error -1" is thrown when SLSQP (which belongs to the NLOPT collection of numerical optimizers) prematurely terminates; in that regard, it is similar to NPSOL status code -1. As I've explained in another thread, assuming the model is identified, there are two things worth trying in order to resolve "NLOPT fatal error -1." One thing to try is to place lbounds and ubounds that allow for a wide range of feasible parameter values. The idea there is place generous, but finite, boundaries on free parameters to keep the optimizer from drifting into absurdly extreme values and fouling up.

The other thing to try is to switch optimizers to NPSOL if available (or possibly even to CSOLNP). Switching to NPSOL is as simple as adding mxOption(NULL,"Default optimizer","NPSOL") near the beginning of the script and re-running it.

I know from experience that there are optimization problems on which SLSQP chokes (at least without box constraints) but which NPSOL can successfully solve. On the other hand, there are problems where NPSOL gets stuck at a local minimum whereas SLSQP appears to find the global minimum.

Log in or register to post comments