Issue with running YALMIP

28 views
Skip to first unread message

Shishir Pandey

unread,
Sep 3, 2015, 12:34:08 AM9/3/15
to YALMIP
Hi

I have SDTP3 installed on my system. I have tried to run the following code:

% Generate some clusters
K
= 4;
N
= 12;
centers
= randn(2,K);
H
= repmat(centers,1,N/K) + randn(2,N)*.1;

% c(i,j) row j belong to cluster i
c
= binvar(K,N,'full')
Model = [sum(c,1)==1];
objective
= 0;
for i = 1:K
    objective
= objective + logdet(eye(2) + H*diag(c(i,:))*H');
end

ops=sdpsettings('
solver','bnb','bnb.solver','sdpt3')
optimize(Model,-objective,ops)
value(c)

I get the following message when I try to run the code. The answer that I get is all Nan.





Thanks.
--
sp
Auto Generated Inline Image 1

Johan Löfberg

unread,
Sep 3, 2015, 1:39:18 AM9/3/15
to YALMIP
If you turn on the debug flag as it recommends you to do, you will see that bnb crashes in a helper function called computecost. Hence, edit computecost.m and change it to (I forgot to tell you this, found this bug will coding the example for stackexchange)

function cost = computecost(f,c,Q,x,p);

cost = f+c'*x+x'*Q*x;
if ~isequal(p.K.m,0)
    top = size(p.F_struc,1)-sum(p.K.m.^2)+1;
    for i = 1:length(p.K.m)
        X = p.F_struc(top:top + p.K.m(i)^2-1,:)*[1;x];
        X = reshape(X,p.K.m(i),p.K.m(i));
        cost = cost - sum(real(log(real(eig(X)))));
        top = top + p.K.m(i)^2;
    end
end


Reply all
Reply to author
Forward
0 new messages