LINPROG fails to converge for some problems

25 views
Skip to first unread message

Allez-y

unread,
Jun 27, 2019, 1:41:20 PM6/27/19
to YALMIP
Dear Johan,

I would like to know why LINPROG fails to compute the optimal solution for the following problems:

----------------------------------------------------------------------------------------------------------------------------
% First example: true optimal solution X* = [3 0]', J* = 6 --> LINPROG returns X = [ ], J = [ ]
c = -[2 1];
Ad = [1 1 ; -1 0];
bd = [3 -2]';

options = optimoptions('linprog','Algorithm','dual-simplex');
[X, J, exitflag] = linprog(c,Ad,bd,[],[],[],[],[],options);

% Second example: true optimal solution X* = [0 3]', J* = -6 --> LINPROG returns X = [-1 3]', J = -7
c = [1 -2];
Ad = [-1 -1 ; 1 -1 ; 0 1];
bd = [-2 -1 3];

options = optimoptions('linprog','Algorithm','dual-simplex');
[X, J, exitflag] = linprog(c,Ad,bd,[],[],[],[],[],options);
----------------------------------------------------------------------------------------------------------------------------

Thanks.

Allez-y

unread,
Jun 27, 2019, 1:58:27 PM6/27/19
to YALMIP
I'm so sorry, I have understood my mistake. I thought LINPROG worked on x >= 0 by default. In fact, I must enforce such constraint too.

So doing, we obtain:

% First example:
c = -[2 1];
Ad = [1 1 ; -1 0 ; -1 0 ; 0 -1];
bd = [3 -2 0 0]';

options = optimoptions('linprog','Algorithm','dual-simplex');
[X, J, exitflag] = linprog(c,Ad,bd,[],[],[],[],[],options);

% Second example:
c = [1 -2];
Ad = [-1 -1 ; 1 -1 ; 0 1; -1 0 ; 0 -1];
bd = [-2 -1 3 0 0];
Reply all
Reply to author
Forward
0 new messages