snopt / snopt-matlab

Matlab interface for sparse nonlinear optimizer SNOPT
MIT License
55 stars 23 forks source link

snoptmex confused about dimensions when there are no constraints #18

Open johanlofberg opened 4 years ago

johanlofberg commented 4 years ago

In testing Snopt 3.0 support in YALMIP, I noticed it crashes on a silly QP without any constraints, called via general nonlinear snopt.

Code to reproduce

f_df = @(x)(deal(x'*x,x'))
G = [1 1];
snopt([0;0], [-inf;-inf], [inf;inf], [0;0], [0;0],-inf, inf, 0, 0, f_df,0, 1,[],G)

Error using snoptmex
iGfun has incorrect column dimension     2.  Should be length     1
Error in solve_snopt (line 17)
 xstate,Fstate,itn,mjritn] = snoptmex(mexopt, ...
Error in snopt (line 434)
 xstate,Fstate,output] = solve_snopt(istart, stopFun, name, ... 
gfferran commented 3 years ago

Similarly, when running the examples from /matlab/runNPexamples.m, the following error takes place:

Error using snoptmex
xupp has incorrect column dimension     7.  Should be length     1
Error in snsolve (line 276)
      snoptmex(solveopt, ...
Error in toymin (line 35)
[x,fval,INFO,output,lambda,states] = snsolve( @toyObj, x0, A, b, Aeq, beq, lb, ub, ...
Error in runNPexamples (line 20)
[x,F,info] = toymin;