Though CVX accepts the problem, it returns NaN as the cvx_optval

S_Matrix and H_Matrix are known, and they are of same size

R is a known vector

S_Matrix is a binary matrix of size [K,N]; i.e., S_Matrix contains only 0 and 1

       S=(S_Matrix~=0); 


       cvx_begin quiet

       variable p_opt(K,N)
       minimize(sum(p_opt(S_Matrix)))   
 
 
       subject to
 
       p_opt(S) >= 0;
    
        for k=1:K
            pc=S_Matrix(k,:);
            ps=H_Matrix(k,:);
            logical_s=logical(ps~=0);
            pp=p_opt(k,:);
            prod((1/N)*(log(2)(1+pp(logical_s).*pc(logical_s))))<=R(k);
        end
    
    
     cvx_end
     Result=cvx_optval;

CVX returns NaN as the cvx_optval

Perhaps the answer is obvious without it, but may I suggest you include the complete reproducible problem, with all input matrices, vectors, and parameters fully populated?

Does cvx_status show Failed? Failed
The solver failed to make sufficient progress towards a solution, even to within the “relaxed” tolerance setting. The values of cvx_optval and primal and dual variables are filled with NaN. This result can occur because of numerical problems within SeDuMi,

often because the problem is particularly “nasty” in some way (e.g., a non-zero duality gap). This is per the CVX User Guide.

@Mark L. Stone: Thanks for your comments. I have edited my problem and provided the problem statement. I have also checked that the elements of pp (from the matlab part) are also NaN. Note that p_opt (K,N) are optimization variables. Please look at my problem statement and suggest me a way…

As previously requested, please provide all the input data so that your problem may be reproduced. Also, don’t invoke cvx_begin with quiet when you are having difficulty figuring out what is going on - you should want to see information about the solution progress (or difficulties).

Also, in addition to not invoking cvx_begin with quiet, try solving it with all the solvers you have available. Look at the detailed solution progress information they report.

@Mark L. Stone: I have solved my problem. In fact, for some of the parameters, the problem was not feasible. Thanks…

For the record, I am assembling the comments into this answer, which shows the problem to have now been satisfactorily resolved.


Perhaps the answer is obvious without it, but may I suggest you include the complete reproducible problem, with all input matrices, vectors, and parameters fully populated?

Does cvx_status show Failed? Failed The solver failed to make sufficient progress towards a solution, even to within the “relaxed” tolerance setting. The values of cvx_optval and primal and dual variables are filled with NaN. This result can occur because of numerical problems within SeDuMi, often because the problem is particularly “nasty” in some way (e.g., a non-zero duality gap). This is per the CVX User Guide.
Mark L. Stone (28 hours ago)

@Mark L. Stone: Thanks for your comments. I have edited my problem and provided the problem statement. I have also checked that the elements of pp (from the matlab part) are also NaN. Note that p_opt (K,N) are optimization variables. Please look at my problem statement and suggest me a way…
Juan (10 hours ago)

As previously requested, please provide all the input data so that your problem may be reproduced. Also, don’t invoke cvx_begin with quiet when you are having difficulty figuring out what is going on - you should want to see information about the solution progress (or difficulties).
Mark L. Stone (7 hours ago)

Also, in addition to not invoking cvx_begin with quiet, try solving it with all the solvers you have available. Look at the detailed solution progress information they report.
Mark L. Stone (6 hours ago)

@Mark L. Stone: I have solved my problem. In fact, for some of the parameters, the problem was not feasible. Thanks…
Juan (6 hours ago)