This is a syntax question. I am trying to construct a constraint ensuring sum(A*x) is PSD while minimizing x
In the following code I am adding each term of the summation manually (6 in this case but may be a lot more), it solves with no problem. None of the loops I tried work, is it possible to construct the matrix first including the variables, then set the >=0 constraint? If so, how?
Also, how do I set a constraint ensuring each item of the X array is greater than or equal to 0 in the SDP mode? The constraint I put in (commented out below) results in an error.
n = size(A,3);
Constraint_sum = 0;
for i=1:n, Constraint_sum = Constraint_sum + A(:,:,i) * X(i); end
Constraint_sum >= 0
X(:) >= 0 % but X >= 0 is also fine, so I don't know what your problem is
I ran this with the A in your linked data_2.mat problem (18 by 18 by 10); and it solved to a result of numerically about all zeros.
I’m not sure exactly how well formulated or interesting your model is, but that’s for you to work out.
You might also want to think about the scaling on your sample A matrix. Having your entries be around 1e9 probably is not a wonderful thing, but I’m not sure it is causing harm either, though. Perhaps you should use
I had run my posted code without error message when I first posted it. I just tried it again in a fresh MATLAB session, and it executes just fine, whether using X >= 0 or X( >= 0, which should be and are equivalent. By the way, if X is square, you are in SDP mode, and you want X >= 0 elementwise, not in LMI sense, you can use X( >= 0. That’s why I showed it, even though in your case, X is not square, so X >= 0 can’t be interpreted to be in LMI sense.
Please post you entire MATLAB/CVX code starting from a fresh MATLAB session. What version/build of CVX are you using? If your problem is not due to something which is obvious to me, you may have to wait until mcg arrives.
You should file a bug report for 3.0beta, Build 1161 .
Well, that is unless my code is illegal (invalid expression operations?) and mcg decided to “lay down the law” in 3.0 and close a loophole in 2.1.
Because I haven’t yet felt a compelling need for the new features in 3.0, can’t have that installed simultaneously with 2.1, and don’t want the hassle of swtiching back and forth, I’m biding my time and waiting for 3.0 to mature a little more before switching over.