Feasible problem results in 'Infeasible' `cvx_status`

I’m running the below optimization to project a variable Zs to Zs_proj. Zs contains N submatrices, each of size NxN. The code below asks that in the projected version each of these submatrices be positive semidefinite with trace 1, and that the sum over these submatrices be the identity matrix. Clearly, if we just set the i-th submatrix to be a zeros matrix with a single 1 in entry (i, i), all the constraints are satisfied. However, for some Zs inputs, cvx fails with the result ‘Infeasible’. I’ve tried a variety of values for the cvx_precision setting, but ‘Infeasible’ persists.

Any suggestions as to how to make this code work consistently?

cvx_begin
  variable Zs_proj(N, N, N);
  minimize(sum((Zs(:) - Zs_proj(:)).^2));
  subject to
    sum(Zs_proj, 3) == eye(N);
    for r = 1:N
      Zs_proj(:, :, r) == semidefinite(N);
      trace(Zs_proj(:, :, r)) == 1;
    end
cvx_end
1 Like

What happens if you try another semidefinite solver? For example, switch to SDPT3 from SeDuMi, or vice versa? Also, try replacing your objective with norm(Zs(:)-Zs_proj(:)).

Thanks mcg! Switching the solver to sedumi worked. (I also changed the objective to “norm” as you suggested. Without the sedumi solver though, this still resulted in ‘Infeasible’ in some cases.)

By the way, you can actually write Zs_proj == semidefinite(N,N,N) and take it out of your for loop. Not that it really saves you anything.