A simple SDP in CVXOPT

55 views
Skip to first unread message

Navid Reyhanian

unread,
Oct 21, 2022, 1:17:24 AM10/21/22
to CVXOPT
Hi all,

I'm trying to implement a very simple SDP (in standard form) in python. Please see the matlab code below:
A1 = [[1 0 1];[0 3 7];[1 7 5]]
A2 = [[0,2,8];[2,6,0];[8,0,4]]
B=[[1,2,3];[2,9,0];[3,0,7]]
cvx_begin sdp %quiet
variable X(3,3) hermitian semidefinite
minimize(sum(sum(B.*X)))
sum(sum(A1.*X))<=11
sum(sum(A2.*X))<=19
X>=0
cvx_end
For this simple code, I am trying to write a python equivalent using CVXOPT as attached using conelp. I have been using conelp since it was not very clear to me how to use solver.sdp to solve the standard SDP form (and not LMI). I get the below error from CVXOPT:
Rank(A) < p or Rank([G; A]) < n
Any help will be much appreciated.

Best regards,
Navid





test_with_cvxopt2.py

Martin

unread,
Oct 21, 2022, 5:30:56 AM10/21/22
to CVXOPT
Your data matrices should be symmetric. CVXOPT will only use the lower triangular part and simply ignores the strictly upper triangular part. The error message is due to the fact that you have redundant constraints. Specifically, the introduction of a 3x3 slack variable involves 6 rows in G rather than 9.

Navid Reyhanian

unread,
Oct 22, 2022, 3:14:57 AM10/22/22
to CVXOPT
That's right. Thanks a lot, Martin for your note. 
Reply all
Reply to author
Forward
0 new messages