CVX failed after some iteration


(Tohidi) #1

This is my problem and when I run after some iteration, I have followed reply. please help me.

Cones | Errors |
Mov/Act | Centering Exp cone Poly cone | Status
--------±--------------------------------±--------
352/352 | 8.000e+00 4.544e+01 0.000e+00 | Solved
288/288 | 8.000e+00 9.053e+00 9.698e-05 | Solved
239/247 | 8.000e+00 1.557e-01 0.000e+00 | Solved
21/167 | 8.000e+00 2.492e+00 8.504e-08 | Solved
2/ 52 | 8.000e+00 4.079e+00 6.018e-07 | Failed
6/ 54 | 8.000e+00 1.049e+01 5.591e-07 | Failed
6/ 54 | 8.000e+00s 1.736e+01s 5.292e-07 | Failed
6/ 55 | 8.000e+00 2.408e+01 7.145e-07 | Failed
6/ 55 | 8.000e+00s 3.153e+01s 5.026e-07 | Solved
7/ 7 | 8.000e+00 3.619e+01 0.000e+00 | Solved
28/ 99 | 8.000e+00 4.398e+01 2.560e-01 | Failed
26/ 90 | 8.000e+00 5.144e+01 1.312e-01 | Failed
32/113 | 8.000e+00 5.930e+01 3.150e-01 | Failed
29/307 | 8.000e+00 6.645e+01 3.049e+00 | Failed
31/ 91 | 8.000e+00 7.053e+01 1.117e-01 | Failed
30/114 | 8.000e+00 7.872e+01 2.265e+00 | Failed

Status: Failed
Optimal value (cvx_optval): NaN

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% initialization
N_k_UL=int.N_k_UL; %max number of subchannel for each user for UL
N_k_DL=int.N_k_DL; %max number of subchannel for each user for UL
Rmax_DL=int.Rmax_DL;
Rmax_UL=int.Rmax_UL;
numRRH=int.numRRH; %number of RRH
numuser=int.n

Blockquote

umuser; % number of users
numsub=int.numsub; % number of subcarriers
E_1=int.E_1;
omega_UL=int.omega_UL;
omega_DL=int.omega_DL;
% Pmax_m=int.Pmax_m;
Pmax_k=int.Pmax_k;
%Dmax=int.Dmax;
D_k=int.D_k;
var_noise=int.var_noise;
Wn=int.Wn;
flag_alfa=1;
iteration_alfa=1;
flag_alfa_NAN=0;
lambda_k=int.lambda_k;

if iteration==1
landa_DL = (0.06-0.01)*rand(size(x_DL_pre));
beta_DL = (0.06-0.01)*rand(size(x_DL_pre));
landa_UL = (0.06-0.01)*rand(size(x_UL_pre));
beta_UL = (0.06-0.01)*rand(size(x_UL_pre));
else
landa_DL=1./(x_DL_pre.^2+1);
beta_DL=(x_DL_pre.^2)./(x_DL_pre.^2+1);
landa_UL=1./(x_UL_pre.^2+1);
beta_UL=(x_UL_pre.^2)./(x_UL_pre.^2+1);
end
while (flag_alfa)

display(iteration_alfa);
R_UL=log2(1+h_UL.*P_UL/var_noise);
R_DL=log2(1+h_DL.*P_DL/var_noise);

%% cvx %%%%
cvx_begin gp
cvx_precision low
cvx_solver sedumi
%% variables
variables alfa_UL(numuser,numsub,numRRH)
variables alfa_DL(numuser,numsub,numRRH)
variables y_DL(numuser)
variables y_UL(numuser)
variables x_DL(numuser,numRRH)
variables x_UL(numuser,numRRH)
variables s_DL(numuser,numRRH)
variables s_UL(numuser,numRRH)

%% objective function
obj=sum(sum(sum(alfa_UL(:,:,:).*P_UL(:,:,:),1),2),3)+sum(sum(sum(alfa_DL(:,:,:).*P_DL(:,:,:),1),2),3);
minimize obj
%% constraint
subject to
alfa_UL <= ones(size(alfa_UL))
alfa_UL >= zeros(size(alfa_UL))
alfa_DL <= ones(size(alfa_DL))
alfa_DL >= zeros(size(alfa_DL))
s_DL >= zeros(size(s_DL))
s_UL >= zeros(size(s_UL))

%% c1
for m=1:numRRH
sum(sum(alfa_DL(:,:,m).*P_DL(:,:,m),2),1) <=Pmax_m
end
%% c2
for n=1:numsub
sum(sum(alfa_UL(:,n,:),1),3) <=1 ;
sum(sum(alfa_DL(:,n,:),1),3) <=1 ;
end

%% for c3
for n=1:numsub 
  noo_DL(:,n,:)=alfa_DL_pre(:,n,:)./sum(alfa_DL_pre(:,:,:),2);     
  noo_UL(:,n,:)=alfa_UL_pre(:,n,:)./sum(alfa_UL_pre(:,:,:),2);      
  for m=1:numRRH
   eta_DL(:,n,m)=alfa_DL_pre(:,n,m)./sum(sum(alfa_DL_pre(:,:,:),2),3);      
   eta_UL(:,n,m)=alfa_UL_pre(:,n,m)./sum(sum(alfa_UL_pre(:,:,:),2),3);
  end
end
noo_DL(isnan(noo_DL))=0;
noo_UL(isnan(noo_UL))=0;
 for k=1:numuser
      sum(sum(alfa_UL(k,:,:).*P_UL(k,:,:),2),3)<=Pmax_k
   for m=1:numRRH        
     %% c3
       %c.3.1      for downlink
        (s_DL(k,m)).^(-1)+x_DL(k,m).*y_DL(k).*s_DL(k,m).^(-1)<=1
       % %c.3.1      for uplink
        (s_UL(k,m)).^(-1)+x_UL(k,m).*y_UL(k).*s_UL(k,m).^(-1)<=1
       %c.3.2      for downlink
     0.01.*((landa_DL(k,m)).^(landa_DL(k,m)).*s_DL(k,m)).*((x_DL(k,m).^2)./beta_DL(k,m)).^(-beta_DL(k,m))<=1
       %c.3.2      for uplink
     0.01.*((landa_UL(k,m)).^(landa_UL(k,m)).*s_UL(k,m)).*((x_UL(k,m).^2)./beta_UL(k,m)).^(-beta_UL(k,m))<=1
       %c.3.3      for downlink
         no_DL(1,:)=noo_DL(k,:,m);             
        [n_no_DL]=find(no_DL~=0);
         c3_3_DL=1;
        if numel(n_no_DL) ~=0    
           for nnoDL=1:numel(n_no_DL)
            c3_3_DL=c3_3_DL.*(alfa_DL(k,n_no_DL(nnoDL),m)./noo_DL(k,n_no_DL(nnoDL),m)).^(-noo_DL(k,n_no_DL(nnoDL),m));
           end
             x_DL(k,m).*c3_3_DL==1;
        end
         %c.3.3      for uplink
          no_UL(1,:)=noo_UL(k,:,m);
          c3_3_UL=1;
          [n_no_UL]=find(no_UL~=0);
          if numel(find(no_UL))~=0     
             for nnoUL=1:numel(n_no_UL)
             c3_3_UL=c3_3_UL.*(alfa_UL(k,n_no_UL(nnoUL),m)./noo_UL(k,n_no_UL(nnoUL),m)).^(-noo_UL(k,n_no_UL(nnoUL),m));
             end
              x_UL(k,m).*c3_3_UL==1;
          end
        
      %% c5
      % for uplink
      (1/Rmax_UL(m)).*(sum(sum(alfa_UL(:,:,m).*R_UL(:,:,m),2),1))<=1;
      % for Downlink
      (1/Rmax_DL(m)).*(sum(sum(alfa_DL(:,:,m).*R_DL(:,:,m),2),1))<=1;
        
   end
    %c.3.4      for downlink
          etta_DL(:,:)=eta_DL(k,:,:);
          [n_etta_DL,m_etta_DL]=find(etta_DL~=0);
          cDL_3_4=1;
         if numel(find(etta_DL))~=0
          for gg=1:numel(n_etta_DL)
             cDL_3_4=cDL_3_4.*(alfa_DL(k,n_etta_DL(gg),m_etta_DL(gg))./etta_DL(n_etta_DL(gg),m_etta_DL(gg))).^(-etta_DL(n_etta_DL(gg),m_etta_DL(gg)));
          end
           y_DL(k).*cDL_3_4==1;
        end
           etta_UL(:,:)=eta_UL(k,:,:);
           [n_etta_UL,m_etta_UL]=find(etta_UL~=0);
           cUL_3_4=1;
          if numel(find(etta_UL))~=0
            for ggg=1:numel(n_etta_UL)
             cUL_3_4=cUL_3_4.*(alfa_UL(k,n_etta_UL(ggg),m_etta_UL(ggg))./etta_UL(n_etta_UL(ggg),m_etta_UL(ggg))).^(-etta_UL(n_etta_UL(ggg),m_etta_UL(ggg)));             
            end
           y_UL(k).*cUL_3_4==1;
         end
   
    %% c8
     R_K_UL_pre(k,1)=sum(sum(alfa_UL_pre(k,:,:).*R_UL(k,:,:),2),3);
     R_K_DL_pre(k,1)=sum(sum(alfa_DL_pre(k,:,:).*R_DL(k,:,:),2),3);
     
     tof(k,:,:)=alfa_UL_pre(k,:,:).*R_UL(k,:,:)./(sum(sum(alfa_UL_pre(k,:,:).*R_UL(k,:,:),2),3));
     bof(k,:,:)=alfa_DL_pre(k,:,:).*R_DL(k,:,:)./(sum(sum(alfa_DL_pre(k,:,:).*R_DL(k,:,:),2),3));
     toff(:,:)=tof(k,:,:);
     [n_toff,m_toff]=find(toff~=0);
           c88_UL=1;
     if numel(find(toff))~=0
            for ttt=1:numel(n_toff) 
              c88_UL=c88_UL.*(alfa_UL(k,n_toff(ttt),m_toff(ttt)).*R_UL(k,n_toff(ttt),m_toff(ttt))./tof(k,n_toff(ttt),m_toff(ttt))).^(-tof(k,n_toff(ttt),m_toff(ttt)));
            end
            (2./D_k+lambda_k).*c88_UL<=1
             c88_UL<=1./lambda_k.*0.95;
     end
     boff(:,:)=bof(k,:,:);
     [n_boff,m_boff]=find(boff~=0);
     c88_DL=1;
     if numel(find(boff))~=0
            for bbb=1:numel(n_boff) 
              c88_DL=c88_DL.*(alfa_DL(k,n_boff(bbb),m_boff(bbb)).*R_DL(k,n_boff(bbb),m_boff(bbb))./bof(k,n_boff(bbb),m_boff(bbb))).^(-bof(k,n_boff(bbb),m_boff(bbb)));
            end
           (2./D_k+lambda_k).*c88_DL<=1
             c88_DL<=1./(lambda_k).*0.95;
     end       
       
 end

%%
cvx_end


(Mark L. Stone) #2

Try using CVXQUAD. Follow the directions in 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 .


(Tohidi) #3

Thanks for your reply.
To install CVXQUAD only copy its file in the installation MATLAB paths? I read https://github.com/hfawzi/cvxquad, but not fully understand what I do. I’m grateful if you more help me.


(Mark L. Stone) #4

Place the cvxquad-master directory (folder) wherever you want. Then add it to the MATLAB path.


(Tohidi) #5

Thanks for your reply.
Surry, How “add the folder to my MATLAB path?”
Is it means I copy it where MATLAB was installed?


(Mark L. Stone) #6

Use the Set Path icon in the MATLAB toolbar

or

help addpath

addpath Add directory to search path.
addpath DIRNAME prepends the specified directory to the current
matlabpath. Surround the DIRNAME in quotes if the name contains a
space. If DIRNAME is a set of multiple directories separated by path
separators, then each of the specified directories will be added.

addpath DIR1 DIR2 DIR3 ...  prepends all the specified directories to
the path.

addpath ... -END    appends the specified directories.
addpath ... -BEGIN  prepends the specified directories.
addpath ... -FROZEN disables directory change detection for directories
                    being added.

Use the functional form of addpath, such as addpath('dir1','dir2',...),
when the directory specification is stored in a string.

P = addpath(...) returns the path prior to adding the specified paths.

Examples
    addpath c:\matlab\work
    addpath /home/user/matlab
    addpath /home/user/matlab:/home/user/matlab/test:
    addpath /home/user/matlab /home/user/matlab/test

See also rmpath, pathtool, path, savepath, userpath, genpath, rehash.

(Tohidi) #7

A million thanks for your reply.
I was used cvxquad-master. Like previous for one iteration problem solved and iteration 2 failed.
What do you propose I do?


(Mark L. Stone) #8

You haven’t provided a reproducible problem. Therefore readers can not reproduce your difficulty to try to resolve it.

Pllease show all solver and CVX output. Have you examined all the input data used for the iteration which fails?


(Tohidi) #9

Can I have your Email address to send complete problem?
Thanks


(Mark L. Stone) #10

Please post as well as you can on the forum. We do not use email on this forum.