I want to solve the following problem using CVX MATLAB , and since it is only one of the non-convex constraints, I used Gaussian Random for it, but in the end the answer we get is NAN.
Thank you for your help.
and my code is written as follows:
var_e = var_u;
cvx_begin %sdp %quiet
variable X(n,n) hermitian
X == hermitian_semidefinite(L+1);
%% Gaussian randomization and x generation
I presume the solver failed, in some way, but you don’t show us the CVX and solver output, so I don’t know. <Edit: I no longer believe the sentence in this paragraph to be true - see my next post. But the remainder of this post is not withdrawn.>
I don’t know what
var_e supposed to do, but having a number such as
1e-11.5 may cause numerical difficulties or unreliability in the solver.
Why are you multiplying both sides of a constraint by
1e6? That is not a good thing to do.
I don’t know why you have the constraint
(X(n,n))>=0;, but that only constrains one element of X`, namely, the n,n element of it. it does not, for instance, constrain all elements of the diagonal. And it is redundant because the semidefinite constraint forces all diagonal elements to be nonnegative.
Also, the strict inequality constraints will only be enforced as
>=. If you need strict positivity, you’ll need to make the RHS something like 1e-5. Actually, your constraints on
ep2 do nothing, because you set them to double precision values and did not declare them as variables, so those “constraints” will be evaluated by MATLAB (not CVX) as true, and do nothing in your optimization problem.
There’s probably plenty more wrong with your formulation ( i haven’t checked), so hopefully you will reexamine everything.
If you can use CvX 2.2 with Mosek 9.x as solver, use that. Otherwise, follow the advice at CVXQUAD: How to use CVXQUAD's Pade Approximant instead of CVX's unreliable Successive Approximation for GP mode, log, exp, entr, rel_entr, kl_div, log_det, det_rootn, exponential cone. CVXQUAD's Quantum (Matrix) Entropy & Matrix Log related functions
Re-reading your post, it looks like the CVX optimization problem was solved, with optimal value
X = eye(5), but in sparse form. I believe the first
L elements of
x are zero, which result in
NaN when divided by their absolute value. Hence
p is a 4 by 1 vector of
NaN, and therefore
alpha is a diagonal matrix with
NaN values on the diagonal. These
NaN values have nothing to do with CVX. They occurred in “straight” MATLAB due to dividing zero by zero in
Given all the issues with your CVX program, some of which were described in my previous post, I would have no confidence that the identity matrix is the correct solution to the problem toy wanted to solve. As for
x=x./abs(x);, I don’t know what the intended use is, but perhaps elements of
x which have zero should remain at zero when it is zero prior to that statement. That would be the same as using MATLAB’s
sign function, i.e.,
x = sign(x) instead of
Thank you very much for your help