MATLAB quits with second call to SNOPT

84 views
Skip to first unread message

Delyle Polet

unread,
Jul 4, 2016, 4:43:40 PM7/4/16
to SNOPT
Hello,

SNOPT seems to force-quit MATLAB if a specific error occurs and SNOPT is called again.

Minimum working example: for the "toymin" problem in the matlab/examples/fmincon directory, set G = []; in the toyCon function.

Running 'toymin' once, the following error is produced:

Error using snoptmex
G has incorrect row dimension     3.  Should be length     4

Error in snsolve (line 194)
[x,F,exitflag,xmul,Fmul,xstate,Fstate,itn,mjritn] = snoptmex( solveopt, x0,
...

Error in toymin (line 35)
[x,fval,INFO,lambda] = snsolve( @toyObj, x0, A, b, Aeq, beq, lb, ub, @toyCon,
options);

Running 'toymin' again, MATLAB quits. The problem persists even if "clear" is called in between calls to toymin.

I am running SNOPT 7.5 on MATLAB 2015b for Macintosh.

Thank you,

Delyle 

SNOPT

unread,
Jul 6, 2016, 1:44:49 AM7/6/16
to SNOPT
Hi Delyle,

Has toyObj.m been modified?  The original returns G with 4 entries, not 3, so I'm not sure why you're getting that error.

Also, making sure Matlab doesn't crash because of unexpected errors or force-quits is on my list of things to do...but it will take some time for me to implement.

--Elizabeth

Delyle Polet

unread,
Jul 6, 2016, 11:05:46 AM7/6/16
to SNOPT, sn...@googlegroups.com
Hello Elizabeth,

Yes, I deliberately modified toyObj.m, setting G=[]; (Apologies, in my original post I said toyCon was modified, when indeed it was toyObj). I did this to reproduce the bug, where two calls to SNOPT with this modified objective function lead to MATLAB crashing.

Delyle

SNOPT

unread,
Jul 6, 2016, 7:07:27 PM7/6/16
to SNOPT
Hi Delyle,

There is a bug though with snsolve and returning G = [].  Ideally that should be allowed, so I will try to fix that.  I can see other cases with snsolve that can cause this kind of error as well, so I'll try to get all of them fixed asap.

Also, fixing the matlab interface so it doesn't crash after an unexpected error or a force-quit in the middle of the run is high on my todo list.

In the meantime, to do what I think you want crash-free I would recommend instead of G = []; that you return
G = [ NaN NaN NaN NaN];
NaN indicates that you don't know/didn't compute that particular derivative and SNOPT will estimate it with finite differences.  You can even do this for some (and not all) components of G.

--Elizabeth

Delyle Polet

unread,
Jul 7, 2016, 4:08:44 PM7/7/16
to SNOPT, sn...@googlegroups.com
Thanks, your advice did help me with my problem

Delyle
Reply all
Reply to author
Forward
0 new messages