Optimization results for all variables are nan?

Hello, I’m new to cvx and I want to solve the following SDR problem, CVX does not report an error, but in the end all optimization results(W1, W2, W3, gamm) are NAN:

function [rate_tmp,W_tmp] = ISAC_sub1(h_matr,n_val,a_matr,R_min,p_max,rho,alpha_vec,beta_vec,N,W_bfrc)
W_bfr1 = W_bfrc(:,:,1);
W_bfr2 = W_bfrc(:,:,2);
W_bfr3 = W_bfrc(:,:,3);
N=N;
cvx_begin sdp quiet
variable W1(4,4) hermitian semidefinite
variable W2(4,4) hermitian semidefinite
variable W3(4,4) hermitian semidefinite
variable gamm(3)
maximize(sum(gamm)+a_matr(:,1)’*(W1+W2+W3)a_matr(:,1)+a_matr(:,2)’(W1+W2+W3)*a_matr(:,2));
subject to
log(n_val+real(trace(h_matr(:,1)*h_matr(:,1)’*W1))+real(trace(h_matr(:,1)*h_matr(:,1)’*W2))+real(trace(h_matr(:,1)*h_matr(:,1)’*W3)))/log(2)
-alpha_vec(1)-(real(trace(h_matr(:,1)h_matr(:,1)’(W2-W_bfr2)))+real(trace(h_matr(:,1)h_matr(:,1)’(W3-W_bfr3))))/beta_vec(1)-gamm(1) >= 0

            log(n_val+real(trace(h_matr(:,2)*h_matr(:,2)'*W1))+real(trace(h_matr(:,2)*h_matr(:,2)'*W2))+real(trace(h_matr(:,2)*h_matr(:,2)'*W3)))/log(2)
                        -alpha_vec(2)-(real(trace(h_matr(:,2)*h_matr(:,2)'*(W2-W_bfr2)))+real(trace(h_matr(:,2)*h_matr(:,2)'*(W3-W_bfr3))))/beta_vec(2)-gamm(1) >= 0
                        
            log(n_val+real(trace(h_matr(:,3)*h_matr(:,3)'*W1))+real(trace(h_matr(:,3)*h_matr(:,3)'*W2))+real(trace(h_matr(:,3)*h_matr(:,3)'*W3)))/log(2)
                        -alpha_vec(3)-(real(trace(h_matr(:,3)*h_matr(:,3)'*(W2-W_bfr2)))+real(trace(h_matr(:,3)*h_matr(:,3)'*(W3-W_bfr3))))/beta_vec(3)-gamm(1) >= 0
                        
            log(n_val+real(trace(h_matr(:,2)*h_matr(:,2)'*W2))+real(trace(h_matr(:,2)*h_matr(:,2)'*W3)))/log(2)
                        -alpha_vec(4)-(real(trace(h_matr(:,2)*h_matr(:,2)'*(W3-W_bfr3))))/beta_vec(4)-gamm(2) >= 0
                        
            log(n_val+real(trace(h_matr(:,3)*h_matr(:,3)'*W2))+real(trace(h_matr(:,3)*h_matr(:,3)'*W3)))/log(2)
                        -alpha_vec(5)-(real(trace(h_matr(:,3)*h_matr(:,3)'*(W3-W_bfr3))))/beta_vec(5)-gamm(2) >= 0
                        
            log(n_val+real(trace(h_matr(:,3)*h_matr(:,3)'*W3)))/log(2)
                        -alpha_vec(6)-gamm(3) >= 0
            gamm(1)-R_min>=0
            gamm(2)-R_min>=0
            gamm(3)-R_min>=0
            real(trace(W1)+trace(W2)+trace(W3)) <= p_max
    cvx_end
    W_tmp = zeros(N,N,3);
    W_tmp(:,:,1) = W1;W_tmp(:,:,2) = W2;W_tmp(:,:,3) = W3;
    rate_tmp = cvx_optval;

end

where n_val is a scalar, h_matr is a 43 matrix and a_matr is a 42 matrix, W_bfr is a constant matrix of the same form as W1-W3.

I have checked the formatting of the optimization question and found no errors. This problem is a bit complicated, and its prototype is:

I would be very grateful if I can get your some guidance.

Remove quiet and re-run. Then you will see solver and CVX output. I presume either the solver failed, or the result is infeasible, or unbounded.

if CVX reports infeasible, all except for section 1 of https://yalmip.github.io/debugginginfeasible also apply to CVX.

If CVX reports unbounded follow advice in https://yalmip.github.io/debuggingunbounded .

Note, the solver might report a different status than CVX, because it might have been sent the dual by CVX (CVX output will tel you if it sent the dual).

If the solver failed, use Mosek (with CVX 2.2) if possible. 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

Thank you very much! Thanks for your detailed answer

But now I’m stuck in another difficulty, I followed the first method you said, Remove quiet and re-run, and got the CVX output. However, as you can see, the problem is an SCA method, yet the objective function in its optimization result always keeps the same value for each iteration(after second iteration). In addition, although I changed the value of h_matr several times and re-run the program, the obtained objective function value is still the same, but the result of the variable W_opt is changing.(and I have used Mosek to solve them)

If you are using SCa, you don’t appear to show the code which shows that. You haven’t shown any output.

Crude unsafeguarded SCA is unreliable - you can look at some links at http://ask.cvxr.com/search?q=sca%20unsafeguarded%20unreliable .