Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix writesdpa.m sedumi form: A vs At #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

plusk01
Copy link

@plusk01 plusk01 commented Jun 13, 2019

Using YALMIP , the following model is parsed correctly:

y = sdpvar(4,1,'full');
A0 = [0 0; 0 0];
A1 = [1 0; 0 0]; A2 = [0 1; 1 0]; A3 = [0 0; 0 1]; A4 = -eye(2);
G = y(1)*A1 + y(2)*A2 + y(3)*A3 + y(4)*A4 - A0;
A = [y(1) y(2); y(2) y(3)];
F = [];
F = [F, G <= 0];
% F = [F, norm(A,2) <= 10];
optimize(F,y(4),sdpsettings('solver','csdp'))

But when the sedumi form is passed to csdp.m to write in spda form, it is parsed incorrectly, with writespda.m complaining about A being nonsymmetric:

Expanding c to the appropriate size
Number of constraints: 4 
Number of SDP blocks: 1 
Number of LP vars: 0 
Non symmetric A.s matrix! 
Non symmetric A.s matrix! 
Non symmetric A.s matrix! 

YALMIP is correctly passing At,b,c,K to csdp.m, which has the following function signature:

%
% [x,y,z,info]=csdp(At,b,c,K,pars,x0,y0,z0)
%
% Uses CSDP to solve a problem in SeDuMi format.

However, it appears that writespda.m is not actually taking in sedumi (i.e., A vs At):

%  This function takes a problem in SeDuMi MATLAB format and writes it out 
%  in SDPA sparse format.  
%
%  Usage:
%
%  ret=writesdpa(fname,A,b,c,K,pars)
%
%      fname           Name of SDPA file, in quotes
%      A,b,c,K         Problem in SeDuMi form

It seems that most of the time everything works correctly because of the A vs At check in writespda.m; except for when A is square, like in the following sdpa file (corresponding to the model listed above):

4 
1 
2 
0 0 0 1
1 1 1 1 -1
2 1 1 2 -1
3 1 2 2 -1
4 1 1 1  1
4 1 2 2  1

@CLAassistant
Copy link

CLAassistant commented Jun 24, 2020

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants