Error using Intlinprog (matlab 2016a) and latest YALMIP

1,070 views
Skip to first unread message

Navindran Davendralingam

unread,
Oct 12, 2016, 2:41:33 AM10/12/16
to YALMIP
Hi Johan,

I'm running Matlab 2016a w/ Gurobi and Intlinprog as my MIP solvers and your most recent version of YALMIP. When I run with Gurobi, it solves fine. However, when I run with intlinprog, I find the following error.

clear all;close all;yalmip clear;clc
x1 = sdpvar(1,1);
x2 = sdpvar(1,1);

Constraints = [];
Constraints = [Constraints, x1<=5, x2<=6];
Objective = x1+x2;
solvesdp(Constraints,-Objective,sdpsettings('solver','intlinprog'))

ans = 

    yalmiptime: NaN
    solvertime: NaN
          info: 'Unknown problem in solver (Turn on 'debug' in sdpsettings) (Error using intlinprog…'
       problem: 9

Matlab has made improvements to their intlinprog solver in 2016a and 2016b versions (I've been in contact with them on another issue). When I type 'help intlinprog', I get the following which indicates they may have changed their input file format to the Gurobi input matlab format. (See below). not sure if this helps.

Please advise, and, thanks very much for all your help.

Navin



help intlinprog
 intlinprog A mixed integer linear programming example using the
    Gurobi MATLAB interface
 
    This example is based on the intlinprog interface defined in the
    MATLAB Optimization Toolbox. The Optimization Toolbox
    is a registered trademark of The MathWorks, Inc.
 
    x = intlinprog(f,intcon,A,b) solves the problem:
 
    minimize     f'*x
    subject to   A*x <= b
                 x(j) integer, when j is in the vector
                 intcon of integer constraints
 
    x = intlinprog(f,intcon,A,b,Aeq,beq) solves the problem:
 
    minimize     f'*x
    subject to     A*x <= b,
                 Aeq*x == beq
                 x(j) integer, where j is in the vector
                 intcon of integer constraints
 
    x = intlinprog(f,intcon,A,b,Aeq,beq,lb,ub) solves the problem:
 
    minimize     f'*x
    subject to     A*x <= b,
                 Aeq*x == beq,
           lb <=     x <= ub.
                 x(j) integer, where j is in the vector
                 intcon of integer constraints
 
    You can set lb(j) = -inf, if x(j) has no lower bound,
    and ub(j) = inf, if x(j) has no upper bound.
 
    [x, fval] = intlinprog(f, intcon, A, b) returns the objective value
    at the solution. That is, fval = f'*x.
 
    [x, fval, exitflag] = intlinprog(f, intcon, A, b) returns an exitflag
    containing the status of the optimization. The values for
    exitflag and corresponding status codes are:
     2 - Solver stopped prematurely. Integer feasible point found.
     1 - Optimal solution found.
     0 - Solver stopped prematurely. No integer feasible point found.
    -2 - No feasible point found.
    -3 - Problem is unbounded.

Johan Löfberg

unread,
Oct 12, 2016, 2:57:29 AM10/12/16
to YALMIP
The problem is that YALMIP will find gurobis version of intlinprog, which doesn't use the same format as the true intlinprog it tries to shadow

>> which intlinprog
C:\gurobi650\win64\examples\matlab\intlinprog.m

Hence, you either use intlinprog (the real one) and then you have to remove gurobi from your path,  or you use gurobi  with it's real name (i.e., solver flag 'gurobi')

Johan Löfberg

unread,
Oct 12, 2016, 2:59:01 AM10/12/16
to YALMIP

optimize(Constraints,-Objective,sdpsettings('solver','intlinprog','debug',1))
Error using intlinprog
Too many input arguments.

Error in callintlinprog (line 43)
[x,fval,exitflag,output] = intlinprog(c, intcon, A, b, Aeq, beq, lb, ub,ops);

Error in solvesdp (line 350)
    eval(['output = ' solver.call '(interfacedata);']);
 
which intlinprog
C:\gurobi650\win64\examples\matlab\intlinprog.m
rmpath(genpath('C:\gurobi650\win64'))

optimize(Constraints,-Objective,sdpsettings('solver','intlinprog','debug',1))
LP:                Optimal objective value is -11.000000.                                           


Optimal solution found.

No integer variables specified. Intlinprog solved the linear problem.


ans = 

  struct with fields:

    yalmiptime: 0.1501
    solvertime: 0.2819
          info: 'Successfully solved (INTLINPROG)'
       problem: 0


Johan Löfberg

unread,
Oct 12, 2016, 3:00:11 AM10/12/16
to YALMIP
Btw, solvesdp is obsolete.It is called optimize now


Navindran Davendralingam

unread,
Oct 12, 2016, 3:07:16 AM10/12/16
to YALMIP
That fixed it - thank you very much! (Also - got it on the 'solvesdp' update to 'optimize' now. Will switch)

Mark L. Stone

unread,
Oct 12, 2016, 3:30:14 AM10/12/16
to YALMIP
Some of these "my version is better than Optimization Toolbox's, so I'll cut in front of theirs" can be a little annoying.

Case in point, MOSEK's quaqdprog jumps in front of Optimization Toolbox's quadprog,  I guess because it is better.  Then you call quadprog to solve a non-convex QP, which Optimization Toolbox's could (at least attempt to do if given a chance), MOSEK jumps in because its quadprog is better. Then MOSEK"s quadprog says it won't accept the QP because it is not convex. Result, "no one" even attempts to solve your non-convex QP.  Could MOSEK';s quadprog jump in, and if the QP is non-convex, hand it over to Optimization Toolbox's quadprog?  It doesn't work that way now.

Johan Löfberg

unread,
Oct 12, 2016, 3:38:31 AM10/12/16
to YALMIP
Agree 100%. Adds confusion, and a possibility for bugs like these because all of a sudden the package which claims to mimick has to keep up with any changes in another package, opening up of configuration/versioning issues.

Navindran Davendralingam

unread,
Dec 6, 2016, 12:30:52 PM12/6/16
to YALMIP
Hi Johan,

Quick follow up: the optimization problem now runs with your prior suggestion of removing Gurobi.However, intlinprog  (2016a/b) goes into the iterations, and then after a while, terminates with all results being NaN (I think it's actually solved it but some reason cannot convert variables back to being readable somehow). When I run the exact model in Matlab 2015a - takes longer to solve since it's the old version of intlinprog, but I have no problems. When I test Yalmip with a simple test problem, it works fine of course with Matlab 2016a/b. The problem I'm running is large, but is still solvable in about 30 seconds using Gurobi (I removed it during the intlinprog of course as you suggested). Unfortunately, I cannot share the model to replicate due to privacy caveats (sorry-I know this doesn't help at all!). However, is there something that jumps  out immediately to you?

thanks again for all your help!

Johan Löfberg

unread,
Dec 6, 2016, 1:11:43 PM12/6/16
to YALMIP
No, without an actual reproducible example, I can not see why the recovery of optimal values would fail. Works here (2016b, intlinprog). Can you show the complete display, and the diagnostic from optimize

Johan Löfberg

unread,
Dec 6, 2016, 1:13:48 PM12/6/16
to YALMIP
If you can supply anonymous data, i.e., not the model, use the flag 'savedebug' and send the file intlinprogdebug.mat to me (joh...@isy.liu.se)
Reply all
Reply to author
Forward
0 new messages