Problem using optimizer with Octave

39 views
Skip to first unread message

Tobias L

unread,
May 24, 2017, 9:14:05 AM5/24/17
to YALMIP
Hi Johan,

I tried to use the optimizer command to speedup many optimizations with different inputs to the objective.
Unfortunately it seems that the optimizer command behaves strange in octave, but works fine in Matlab.

Consider the following simple example, tested with Octave (4.0 Linux / 4.2.1 Windows).

min a*x
s.t. 1 <= x <= 10

x=sdpvar; a=sdpvar;
p=optimizer([x>=1, x<=10], a*x', sdpsettings('solver', 'glpk'), a, x);
[l,f]=p(-1)

>> l = 1 

It gets even more strange when using the solver sdpt3, then I get
>> l = 5.5000
for a = 1 and a = -1

However, using optimize gives the correct solution (as does Matlab with the above and solver=linprog):
optimize([x>=1, x<=10], -1*x', sdpsettings('solver', 'glpk')) % or sdpt3
l = value(x)

>> l = 10

Do you have any clue what is causing this problem and is there a chance to fix it?

Thank you and best regards
Tobias

Johan Löfberg

unread,
May 24, 2017, 9:17:24 AM5/24/17
to YALMIP
I will try to get Octave installed and see, but it will not be done in a couple of days

Your best and fastest bet is to simply put a break in callglpkoctave (breaks-points possible in octave?...) and see if the correct data is sent to the solver, and then debug from there


Tobias L

unread,
May 24, 2017, 10:03:49 AM5/24/17
to YALMIP
Thanks for the quick reply.

After stepping through callglpkoctave I can confirm that the data gets corrupted when using the optimizer command.

Instead of A=[-1 0; 1 0]; B=[-1; 10]; C=-1 as when directly calling optimize,
it gets A=[-1 0; 1 0; 0 -1; 0 -4]; B=[-1; 10; 1; 0]; C=[0 1];

Thank you for your time.

Johan Löfberg

unread,
May 24, 2017, 4:15:47 PM5/24/17
to YALMIP
Add R = []; on line 444 in lmi/categorizeproblem

Tobias L

unread,
May 25, 2017, 7:04:04 AM5/25/17
to YALMIP
Great, it works now.

Thank you for the quick fix!
Reply all
Reply to author
Forward
0 new messages