concatenation error in call_mosek_dual

17 views
Skip to first unread message

Michael Hibbard

unread,
Jul 23, 2019, 5:46:32 PM7/23/19
to YALMIP
Hi Professor,

I am trying to run a toy problem in which the objective function is to maximize the entropy of a probability distribution subject to some quadratic constraint (which, in the case of this toy problem, should be trivially satisfied). I am using YALMIP R20190425 with MOSEK 9.0.94. The code is:

% toy problem 
clc;clear all

x = sdpvar(5,1);

constraints = [];
constraints = [constraints, x >= 0];
constraints = [constraints, x <= 1];
constraints = [constraints, sum(x) == 1];
for i = 1:5
    constraints = [constraints, cpower(x(i,1),2) <= 1];
end

obj = entropy(x);
ops = sdpsettings('solver','mosek','verbose',0,'debug',1);
optimize(constraints,-obj,ops);
sol = value(obj);
xVals = value(x);


If I comment out the for loop, the optimization yields the expected result of x(i) = 0.2 for all i. Furthermore, if I change the objective function to simply sum(x), the optimization returns the expected result of 1. However, including both the quadratic constraints and entropy term yields the following output error:


Error using horzcat
Dimensions of matrices being concatenated are not
consistent.

Error in call_mosek_dual (line 39)
        prob.cones.type = [prob.cones.type 3];

Error in callmosek>call_mosek_lpqpsocpsdp (line
97)
        [x,D_struc,problem,r,res,solvertime,prob]
        = call_mosek_dual(model);

Error in callmosek (line 51)
    [x,D_struc,problem,r,res,solvertime,prob] =
    call_mosek_lpqpsocpsdp(model);

Error in solvesdp (line 361)
    eval(['output = ' solver.call
    '(interfacedata);']);

Error in optimize (line 31)
[varargout{1:nargout}] = solvesdp(varargin{:});

Error in practice (line 17)
optimize(constraints,-obj,ops);


I am not sure how to change the code to not produce this concatenation error, or if I am missing something else completely. Any help would be appreciated, thank you!

Johan Löfberg

unread,
Jul 24, 2019, 2:23:30 AM7/24/19
to YALMIP
Yes, it was a bug which has fixed already in develop which you thus will have to use until next official release

BTW, cpower(x(i,1),2) <= 1 can simply be written as x(i,1)^2 <= 1. cpower is intended for more exotic powers
Reply all
Reply to author
Forward
0 new messages