I am trying to solve Joint optimization problem with the CVX toolbox and second sub problem becomes concave + Convex as the sub problem gives negative powers (Even if I specify nonnegative ). Then program stops running . Please help me in this regardng

Ok Sir.

I am getting this error as:

Unrecognized field name “sol”.

Error in cvx_mosek

Error in cvxprob/solve (line 435)
[ x, status, tprec, iters ] = shim.solve( At, b, c, cones, quiet, prec, solv.settings, eargs{:} );

Error in cvx_end (line 88)
solve( prob );

Error in Opt_power_beamforming (line 226)
cvx_end

MATLAB code has given as follows:

% Modern optimization solver
cvx_solver mosek

        % Solving problem (P4)
        cvx_begin  quiet
        
        variable w_k_opt(Mr_rec,K) complex
        
        % Compute objective function (eq.11)
        [obj_Rxbeam] = objective_Rxbeam(K,w_k_opt,h_theta,P_rand,g_theta,h_s_i,v,sigma_sqr_t,sigma_sqr,a_k,b_k);
        obj = obj_Rxbeam;
        
        maximize real(obj)
        
        % constraints
        
        % Individual Rate constraint (QoS) (eq.15)
        
        % for k=1:K
        %     %n = pow_pos((norm(w_k_opt(:,k)'*h_theta(:,k))),2)*P1(k);
        %     f=zeros(1,1);
        %     for mm=1:K
        %         if mm~=k
        %             f=  f + pow_pos(norm(w_k_opt(:,k)'*h_theta(:,mm)),2)*P_rand(mm);
        %             %b1(:,k) = b;
        %         end
        %     end
        %     c1 = pow_pos(norm(w_k_opt(:,k)'*g_theta*v),2);
        %     d1 = pow_pos(norm(w_k_opt(:,k)'*h_s_i*v),2);
        %     e1 = pow_pos(norm(w_k_opt(:,k)'),2);
        % 
        %     (2^(R_min)-1)*( f + c1*sigma_sqr_t + d1 + e1*sigma_sqr)...
        %         <= (2*real ( w_k_initial(:,k)'*h_theta(:,k)*h_theta(:,k)'*w_k_opt(:,k))...
        %         -  norm ( w_k_initial(:,k)'*h_theta(:,k) )^2 ) *P_rand(k);
        % 
        % end
        
        cvx_end
1 Like

Make sure you are using CVX 2.2, not CVX 3.0beta.

What is the output of
mosekdiag

If that is successful, perhaps the MATLAB session is corrupted, in which case starting a new MATLAB session might resolve this. Or perhaps the CVX installation got corrupted, in which case reinstalling CVX in a new MATLAB session might resolve it.

1 Like

Yes cvx version is 2.2. Even after restarting the MATLAB session, same error occurs. I have not displaying the result in command window.

If I type mosekdiag in command window, then it is displaying as OK

1 Like

Do not use quiet and you should see in the log output what the problem is.

Unrecognized field name “sol”.

means that there was an error while running Mosek and the solution was not computed. Usually it is with either a license problem (which you claim is fine), or some humongous coefficients Mosek refuses to accept etc. The log output should explain the issue.

1 Like

Yes Sir, I am displaying the results in the command window now.

Now, the error is given as follows:

Calling Mosek 9.1.9: 320 variables, 130 equality constraints

MOSEK Version 9.1.9 (Build date: 2019-11-21 11:34:40)
Copyright (c) MOSEK ApS, Denmark. WWW: mosek.com
Platform: Windows/64-X86

MOSEK warning 57: A large value of 7.7e+11 has been specified in c for variable ‘’ (203).
MOSEK warning 57: A large value of 3.4e+11 has been specified in c for variable ‘’ (209).
MOSEK warning 57: A large value of 9.7e+11 has been specified in c for variable ‘’ (215).
MOSEK warning 57: A large value of 7.4e+11 has been specified in c for variable ‘’ (221).
Mosek error: MSK_RES_ERR_HUGE_C (A huge value in absolute size is specified for one an objective coefficient.)

Status: Error
Optimal value (cvx_optval): NaN

Unrecognized field name “sol”.

Error in cvx_mosek

Error in cvxprob/solve (line 435)
[ x, status, tprec, iters ] = shim.solve( At, b, c, cones, quiet, prec, solv.settings, eargs{:} );

Error in cvx_end (line 88)
solve( prob );

Error in Opt_power_beamforming (line 227)
cvx_end

1 Like

If this occurs on an iteration subsequent to the first, perhaps it’s a result of your alternating optimization diverging. You claimed it converges, I never did.

1 Like

Yes Sir, This is an iterative algorithm and optimized values from the sub problem-1 given to the sub problem-2.

The error occurs at solving sub problem-2.

Sir, What should be the solution to this issue?

1 Like

Make your algorithm more robust. how to do so is out of scope of this forum.

Or use a non-convex optimization solver under YALMIP.

1 Like

My optimization problem is convex only. If I use non-convex optimization solver YALMIP , will there any change in the solution?

1 Like

If your optimization problem is convex, why are you performing alternating optimization? It would appear that even though each subproblem is convex, the original (overall) problem is not convex.

1 Like

Yes Sir. Original problem is non-convex. Hence, we divide original problem into three sub problems and each sub problem becomes convex.
Each sub problem is getting solved using CVX without any issues , but when we do alternative optimization problem arises.
To get overall optimal solution. we are trying to perform AO algorithm as given below:

1 Like

Your problem is non-convex. Perhaps you’ll be luckier with a different starting value (initialization).

In reality, step 9 is until Convergence or Divergence or Neither. In your case, you are achieving divergence. Perhaps you should re-read my link above.

if the algorithm authors claim it always converges, I’ll let you resolve that with them.

1 Like

This error means you had coefficients bigger than 1e+16 somewhere. Surely you don’t want to solve optimization problems with that scaling, so you probably need to look at your data before feeding it into the solver again.

You can also use Mosek 10.1 instead of the older 9.1. It will not help with this error, but you may get better performance and stability overall once you tame the numerical issues.

1 Like

Yes sir, I will try to use Mosek 10.1 and Will verify the data before feeding to solver

1 Like

How to verify the data before feeding it to solver Sir? I do not know the procedure and there is no initial points to the CVX optimization problem as it will optimize based on the data given.

For example code is given as follows:

% Inner loop for N_sim random simulations
for sim=1:samples

       [g_t,g_r,d_t,d_r,G_t,G_r,h_r,h_d,w_0,h_s_i,h_theta,g_theta,w_k,v] = Channel_generator(C0_db,K,Mt_trans,Mr_rec,N,sigmaSI_sqr,antennaSpacing,alpha_BS_Target,alpha_RIS_Target,alpha_BS_RIS,alpha_UE_RIS,alpha_UE_BS,Rician,phi,Loc_BS,Loc_Target,Loc_RIS,Loc_UE);
                    
        %**************************************************************************
        % Optimize Uplink transmit power allocation
        %**************************************************************************
       
        % Random power (Is feasible ?)
        P_rand = P1;% Initial value

        [~,~,~,~,main_obj1] = objective_main(K,w_k,h_theta,P_rand,g_theta,h_s_i,v,sigma_sqr_t,sigma_sqr,rho_UE,rho_BS,P_BS,P_UE,P_RIS);

        EE_small_unopt(:,sim)=main_obj1; % Store unoptimized EE for each small scale setup

        % P_rand = rand(K,1)*P; % Random power allocated to each user
        % 
        % [~,~,~,~,main_obj2] = objective_main(K,w_k,h_theta,P_rand,g_theta,h_s_i,v,sigma_sqr_t,sigma_sqr,rho_UE,rho_BS,P_BS,P_UE,P_RIS);
        % 
        % EE_small_unopt1(:,sim)=main_obj2; % Store unoptimized EE for each small scale setup
        % 
        % Objective function related to power optimization
        J =  zeros(1,N_iter);

        for iter = 1 : N_iter
            p = iter; 

            % Update y (eq.2) and z_k (eq.4)
            [~,SINR_sqr,~,update_y,~] = objective_main(K,w_k,h_theta,P_rand,g_theta,h_s_i,v,sigma_sqr_t,sigma_sqr,rho_UE,rho_BS,P_BS,P_UE,P_RIS);

            y=update_y; % Update y
            z=SINR_sqr; % Update z

            % Modern optimization solver  
            cvx_solver mosek

            cvx_begin quiet

            variable  P_opt(K) nonnegative
            
            % Compute objective function (eq.5)
             [obj_power] = objective_power(K,w_k,h_theta,P_opt,g_theta,h_s_i,v,sigma_sqr_t,sigma_sqr,rho_UE,rho_BS,P_BS,P_UE,P_RIS,y,z);
             obj = obj_power;
            
             maximize real(obj)

             subject to
            
            % constraints

            %Target sensing constraint (eq.6)
            temp = 0;
            for k = 1:K

            temp = temp + ( norm( w_0'*h_theta(:,k) )^2 )*(P_opt(k));

            end

            Gamma_t*( temp + norm(w_0'*h_s_i*v)^2 + sigma_sqr*( norm(w_0')^2 ) )...
                 <= sigma_sqr_t*(norm(w_0'*g_theta*v)^2);

            % Individual Rate constraint (QoS) (eq.7)
            
            % for k=1:K
            % a2 = (norm(w_k(:,k)'*h_theta(:,k))^2)*P_opt(k);
            % b2=zeros(1,1);
            % for mm=1:K
            %     if mm~=k
            %         b2 =  b2 + (norm(w_k(:,k)'*h_theta(:,mm))^2)*P_opt(mm);
            %         %b1(:,k) = b;
            %     end
            % end
            % c2(k) = norm(w_k(:,k)'*g_theta*v)^2;
            % d2(k) = norm(w_k(:,k)'*h_s_i*v)^2;
            % e2(k) = norm(w_k(:,k)')^2 ;
            % 
            % (2^(R_min)-1)*( b2 + c2(k)*sigma_sqr_t + d2(k) + e2(k)*sigma_sqr)...
            %          <= a2 ;          
            % 
            % end
                            
            % Individual Power Constraint (eq.8c)
            
            for k = 1:K

               P_opt(k) <= P;

               P_opt(k) >=0;

               
            end

           cvx_end
                  

        % cvx_status 

        if strcmp(cvx_status,'Solved') || strcmp(cvx_status, 'Inaccurate/Solved') %|| strcmp(cvx_status,'Failed') 

            P_rand = P_opt;

        else

           % P_opt = P_rand;   % default value

        end
         %P_opt
        % compute objective function
        [~,~,~,~,main_obj] = objective_main(K,w_k,h_theta,P_rand,g_theta,h_s_i,v,sigma_sqr_t,sigma_sqr,rho_UE,rho_BS,P_BS,P_UE,P_RIS);
        J(iter) = real(main_obj);
        %transmit_rate_UE;

        % test stopping criterion

        if N_iter > 1

            abs(J(N_iter) - J(N_iter-1)) <= tol;

            break;
        end
   
  end

Please help me in this regard.
Thanks in advance!

You can use MATLAB (double precision) commands and functions to check your input data. That does not involve CVX. Perhaps you are generating the input data in a bad way, in which case you should fix it. How to generate Monte Carlo input data in a good way is out of scope of this forum.

If you are using SCA without being an expert in computational non-convex nonlinear optimization, don’t be surprised if you have a never ending series of difficulties. Again, you’re pretty much on your own. it’s your research project, not the forum readers’ research project.

I am not asking you to fix the data for my optimization problem. Please note this first, sir. I know that this is my own project. I am aware about the forum will help in resolving the issues while coming across the issues in the code but not entire things need to be solved in this forum. You are thinking too much that you are helping everything required for the users, please come out of that illusion Sir.
Just I am asking about the verification of the data before feeding to the solver and the range of data that can be accepted by the solver (Mosek).
And which data to be verified before feeding to the solver, I mean constraints, objectives, or anything in the optimization problem (that is the reason why I have provided the code in my question)?

My optimization problem is convex only. If you know the answer exactly, then only respond to my question, otherwise leave it Sir. If you know, where to verify the data before feeding to solver, plz explain. Otherwise, let other experts respond to the question.
Better to answer properly before saying proverbs. I am sorry to say this Sir.
I hope that your cooperation will continue for my future questions.

If you do

cvx_solver_settings('write', 'dump.ptf')

then you will get a file which contains the problem Mosek received. You can look around that file ina text editor to see what data exactly the solver gets.

There is no way for CVX user, to somehow check the data between the definition of your CVX problem and calling the solver. What you can do is to ensure your data is reasonable and that the operations appearing in your CVX model are reasonable, so that you can convince yourself that you can expect the final solver model will be reasonable, too.

Thank you so much for the response Sir. I will follow your instructions and run the code. I will reach out to you if I have any issues.

The mosek solver file is shown below:



MATLAB command says that it is a version 10.1.25, but it displayed as 9.1.9.

Please help me in analyzing the data so that I can correct my code and if necessary, use a solver or optimization tool.

I have another doubt regarding programming with the solver, I am using MOSEK solver for the CVX code, Can I write program with the mosek syntax (separate programming is available for mosek)? Can I get out of this issues with it?
Please clarify in these things Sir!
Thanks in advance!