Recently I was trying to solve a semidefinite program that used both entrywise inequalities and positive semidefinite inequalities, but I was getting unexpected results. A minimum example is the following program:
cvx_begin cvx_precision best; variable X(2,2) symmetric nonnegative maximize X(1,2) subject to: X(1,1) <= 1; X(2,2) <= 1; cvx_end
This program outputs an optimal value of +Inf, categorizing it as unbounded. This is indeed correct, as the only constraints are on the diagonals, the off diagonal entry X(1,2) can be arbitrarily large. However, adding the sdp keyword causes the program to “solve” (incorrectly) the problem with an optimal value of 1.0, which would be the best if X were positive semidefinite, but that is not the implied constraint.
I believe that what is happening is that cvx is taking the nonnegative keyword, and internally turning that into a >=0 inequality on the backend, which due to the sdp modifier is treated as a positive semidefinite constraint, rather than entry wise.
I didn’t see anything alluding to this switch on the variables page or on the sdp docs, so if it’s intended, it could be a bit clearer.