CVX: Ineffectiveness of restraints

clc
clear
global numUsers numSubband W noise_power R_s Pow d_bar v
format short
beta_0 = 10^-9 ;
ka = 4;
Ka = 3;
numUsers = 10; %number of users
numSubband_all = 5:5;%16;
npsd = -174; %noise power spectral density dBm/Hz
W = 10^6; %subband bandwidth 1MHz
noise_power = 10^(-14.4) * 10e13;
Q_b = [3000,3000];
v = 50;
T_opt = zeros(1,length(numSubband_all));
H1 = 100ones(numUsers,1); %无人机高度
H = 100;
%for i = 1:length(numSubband_all)
lengthArea = 1000;
widthArea = 1000;
Quav = [lengthArea
rand(1, 1),widthArearand(1, 1),];
numSubband = numSubband_all(i); %number of subband
Pow = load(‘Pow.mat’);Pow = struct2cell(Pow);Pow = cell2mat(Pow);
d_bar = load(‘d_bar.mat’);d_bar = struct2cell(d_bar); d_bar = cell2mat(d_bar);
R_s = load(‘R_s.mat’);R_s = struct2cell(R_s);R_s = cell2mat(R_s);
ruser = load(‘user_location.mat’);ruser = struct2cell(ruser);ruser = cell2mat(ruser);
omega = 1;
% Normalization
% To generate a Rayleigh fading channel gain
% Rician factor
% To generate a Rician fading channel gain
d = pdist2(ruser, Quav, ‘euclidean’);
d = d+ H1.^2;
beta = sqrt(beta_0 * 1e26) ./ d ; % 大尺度
g_rayleigh = load(‘g_rayleigh.mat’);g_rayleigh = struct2cell(g_rayleigh);g_rayleigh = cell2mat(g_rayleigh);
g_rician = sqrt(Ka/(Ka+1)) + sqrt(1/(Ka+1)) * g_rayleigh;
g_rician_dB = 20 * log10(abs(g_rician));
g_rician = 10 .^ (g_rician_dB / 10);
for i3 = 1:numSubband
g(:,i3) = g_rician(:,i3) .
beta ;
end
%transmission data rates of different users with different subbands
R_t = Wlog2(1+Powones(1,numSubband).g/noise_power) ;
e_all = 1./(R_s
ones(1,numSubband)) + 1./( R_t) ;
[Assigned_subband_index,cost] = assignmentoptimal(- e_all.^-1);%should maximize the sum of the weight, while the function is minimization!!!
Scheduled_user_index = find(Assigned_subband_index~=0);
Alpha_of_ScheUser = e_all(sub2ind(size(e_all),find(Assigned_subband_index~=0), Assigned_subband_index(Assigned_subband_index~=0)));
d_opt = d_bar./Alpha_of_ScheUser/(sum(Alpha_of_ScheUser.^(-1)));
for k=1:length(d_opt)
index_subband(k) = Assigned_subband_index(Scheduled_user_index(k));
end
for k=1:length(d_opt)
t_s(k) = d_opt(k) / R_s(Scheduled_user_index(k));
t_c(k) = d_opt(k) / R_t(Scheduled_user_index(k),index_subband(k));
t_total(k) = t_s(k) + t_c(k);
end
T_hover = max(t_total);
Q_d = [Quav - Q_b, H];
Tround1 = norm(Q_d) /v;
objection_0 = T_hover + Tround1;
iteration =1;
T(iteration) = objection_0;
%while 1
len1 = length(Scheduled_user_index);
cvx_begin
% cvx_solver mosek
cvx_solver sedumi
variable Q(1,2)
variable mu1 nonnegative
variable gamma1(1,len1)
expression R_LB(1,len1)
for k = 1:len1
index = Scheduled_user_index(k);
index_subband = Assigned_subband_index(Scheduled_user_index(k));
g_c = g_rician(index,index_subband);
ita = 1e-9 * Pow(index)* g_c sqrt(beta_0 10e26) /noise_power;
R_LB(k) = W*(-rel_entr(1,(1+ita/ (1e-9 * (pow_pos(norm((Quav-ruser(index,:)),2),2)+H^2))))/log(2)) + ita * W * (-1)*(pow_pos(norm((ruser(index,:)-Q),2),2)-pow_pos(norm((Quav-ruser(index,:)),2),2)) /(((pow_pos(norm((Quav-ruser(index,:)),2),2)+H^2) 1e-9 +ita)(pow_pos(norm((ruser(index,:)-Quav),2),2)+H^2)*log(2));
end
Q_d = [Q - Q_b, H];
Tround = norm(Q_d) /v;
objection = mu1 + Tround ;
minimize objection
subject to
for k = 1: len1
mu1 >= (d_opt(k) / R_s(Scheduled_user_index(k)) + d_opt(k) * inv_pos(gamma1(k)));

            end
            for k= 1:len1
                      R_LB(k) >= gamma1(k);
            end
               abs( Q(1,1))<= 1000;
               abs( Q(1,2))<= 1000;  
       cvx_end
       disp(Q)
       disp(mu1)
       disp(Tround)

result:

Calling SeDuMi 1.3.4: 76 variables, 36 equality constraints
For improved efficiency, SeDuMi is solving the dual problem.

SeDuMi 1.3.4 by AdvOL, 2005-2008 and Jos F. Sturm, 1998-2003.
Alg = 2: xz-corrector, Adaptive Step-Differentiation, theta = 0.250, beta = 0.500
eqs m = 36, order n = 60, dim = 77, blocks = 17
nnz(A) = 114 + 0, nnz(ADA) = 196, nnz(L) = 123
it : by gap delta rate t/tP t/tD* feas cg cg prec
0 : 3.16E+06 0.000
1 : 1.22E+04 7.69E+05 0.000 0.2431 0.9000 0.9000 1.87 1 1 1.6E+00
2 : 5.51E+03 1.96E+05 0.000 0.2550 0.9000 0.9000 1.65 1 1 6.5E-01
3 : -9.00E+03 6.29E+04 0.000 0.3211 0.9000 0.9000 1.61 1 1 4.2E-01
4 : -4.24E+03 2.15E+04 0.000 0.3419 0.9000 0.9000 1.40 1 1 3.5E-01
5 : -1.21E+03 6.55E+03 0.000 0.3043 0.9000 0.9000 1.20 1 1 3.1E-01
6 : -2.72E+02 2.22E+03 0.000 0.3388 0.9000 0.9000 1.19 1 1 2.8E-01
7 : -6.85E+01 6.93E+02 0.000 0.3126 0.9000 0.9000 1.21 1 1 2.4E-01
8 : -7.48E+01 2.50E+02 0.000 0.3599 0.9000 0.9000 1.07 1 1 2.6E-01
9 : -7.32E+01 7.53E+01 0.000 0.3018 0.9000 0.9000 1.07 1 1 3.7E-01
10 : -6.60E+01 2.38E+01 0.000 0.3164 0.9000 0.9000 1.10 1 1 1.6E-01
11 : -5.91E+01 5.91E+00 0.000 0.2480 0.9000 0.9000 1.13 1 1 3.9E-02
12 : -5.68E+01 1.65E+00 0.000 0.2796 0.9000 0.9000 1.19 1 1 8.9E-03
13 : -5.66E+01 8.64E-02 0.000 0.0523 0.9900 0.9900 1.25 1 1 3.5E-04
14 : -5.66E+01 1.62E-02 0.000 0.1875 0.9000 0.9000 1.07 1 2 6.1E-05
15 : -5.66E+01 3.48E-03 0.000 0.2146 0.9000 0.9000 1.01 2 2 1.3E-05
16 : -5.66E+01 8.62E-05 0.000 0.0248 0.9900 0.9900 1.00 4 4 3.4E-07
17 : -5.66E+01 2.66E-05 0.000 0.3080 0.9079 0.9000 0.80 6 6 1.4E-07
18 : -5.66E+01 1.17E-05 0.126 0.4401 0.9000 0.0000 0.59 12 13 8.5E-08
19 : -5.66E+01 4.80E-06 0.000 0.4104 0.9033 0.9000 0.43 14 23 4.0E-08
20 : -5.66E+01 1.35E-06 0.000 0.2812 0.9067 0.9000 0.25 32 31 3.5E-08
21 : -5.66E+01 1.75E-20 0.000 0.0000 0.8579 0.9000 -0.44 33 27 1.8E-12

iter seconds digits cx by
21 0.2 Inf -5.6603899492e+01 -5.6603897391e+01
|Ax-b| = 1.8e-12, [Ay-c]_+ = 1.4E-06, |x|= 8.0e+01, |y|= 8.2e+06

Detailed timing (sec)
Pre IPM Post
1.200E-02 7.600E-02 2.997E-03
Max-norms: ||b||=1, ||c|| = 3.409312e+06,
Cholesky |add|=6, |skip| = 0, ||L.L|| = 13354.2.

Status: Solved
Optimal value (cvx_optval): +56.6039

999.9997 999.9997

4.2344e-07

56.6039

Although the result is solved, it is clear that the constraints on mu1 are not working, can you give me some advice?

What exactly is not working on the constraints on mu1? 4.2344e-07 is nonnegative. I don 't know whether mu1 >= (d_opt(k) / R_s(Scheduled_user_index(k)) + d_opt(k) * inv_pos(gamma1(k))); within feasbility tolerance because you haven’t shown us the value of the RHS.

Note that the displayed value of Tround is not necessarily correct, because it is an expression, which CVX doesn’t necessarily populate with its optimal value after cvx_end; To be sure you see the optimal value,. you have to recompute it after cvx_end starting from CVX variables, but not expressions. Note that something can be an expression even it it not declared as an expression, as is the case with Tround.