Thank you for your reply.
I have modified my code, and use the ecos solver. I got the optimal solution, but the optimal value of variables didn’t satisfied the constrains.
The code:
clc; clear all;
k = 8; % The number of user in a small cell
n = 0.1;
%Simulation parameters
N0 = 1e-10; % noise power spectral density(W/Hz)
Wul = 1e7; Wdl = 1e7; % The uplink and downlink bandwidth (Hz)
Pumax = 0.25; Pdmax = 20; %0.1 100 %0.25 20 % The uplink and downlink power(w)
FC = 10^11; % The cloudlet server processing capacity(CPU cycles/s)
luk = 1.78*10^-6; % The amount of energy spent by the mobile device to extract each bit of offloaded data from the video source(J/bit)
ldk = 0.625; % Parameter that captures the mobile receiving energy expenditure per second in the downlink(J/s)
BIk = 1e4*ones(1,k); %1e4 % Input bits from each user k to the cloudlet in the uplink (1Mbits)
BIs = n*BIk; % Shared input bits that can be sent by any of the users
BOk = 1e4*ones(1,k); % Out bits from the cloudlet to each user k in the downlink (1Mbits)
BOs = n*BOk; % Shared output bits that delivered to all users
Vk = 1000*BIk; % Processing the input BIk by executing Vk CPU cycles at the cloudlet (CPU cycles)
Vs = n*Vk; % Shared CPU cycles
Tmax = 0.15; %0.3 % Maximum latency constraint(0.15s/0.05s)
%Initialize the z = [Pul,Bls,f,Pdl,PdM,TuS,TdS]
Pulk0 = [0.20 0.20 0.20 0.20 0.20 0.20 0.20 0.20]; % The uplink power(w)of user k
Pdlk0 =[2.37 2.45 2.47 2.42 2.42 2.30 2.41 2.34]; % The downlink power(w)to user k
PdlM0 = [18.97]; % Transmit power (w) for multicasting
% A fraction of BIsk bits of the BIs shared bits transmited by user k
BIsk0 = [2456.0 2209.3 21236.3 24730.7 14584.0 2982.3 22563.3 9237.7];
fk0 = [0.11 0.11 0.13 0.12 0.11 0.11 0.11 0.11];
fs0 = 0.72; % Fractions of the processing power FC assigned to run the Vk CPU cycles exclusively for user k and the VS shared CPU cycles
f0 = [fk0,fs0];
Rulk0 = (Wul/k)*log2(1+Pulk0/(N0*Wul/k)); % The downlink power after rayleigh fading
Rdlk0 = (Wdl/k)*log2(1+Pdlk0/(N0*Wdl/k)); % Multicasting power after rayleigh fading
RdlMk0 = Wdl*log2(1+PdlM0/(N0*Wdl)); % Transmitting rate to users for multicasting
TuS0 = max(BIsk0./Rulk0); % The time to complete the shared uplink transmissions (s)
TdS0 = max(BOs./RdlMk0); % The downlink transmission time to multicast BOs bits
T = max((BIk - BIs + BIsk0)./(Rulk0)+(Vk-Vs)/(FC.*fk0)+Vs/(FC*fs0)+(BOk-BOs)./(Rdlk0)+max(BIsk0./Rulk0)+max(BOs./(RdlMk0)))
z0 = [Pulk0,BIsk0,f0,Pdlk0,PdlM0,TuS0,TdS0];
cvx_begin
cvx_solver ecos
%cvx_solver mosek
%cvx_solver SeDuMi
variables Pulk(1,k) BIsk(1,k) fk(1,k) fs Pdlk(1,k) PdlM TuS TdS;
f = [fk,fs];
z = [Pulk,BIsk,f,Pdlk,PdlM,TuS,TdS];
Rulk = (Wul/k)*log(1+Pulk/(N0*Wul/k))/log(2);
Rdlk = (Wdl/k)*log(1+Pdlk/(N0*Wdl/k))/log(2);
RdlMk = Wdl*log(1+PdlM/(N0*Wdl))/log(2);
% The overall downlink mobile energy consumption for user k
Edlk = ((BOk-BOs).*inv_pos(Rdlk)+(BOs.*inv_pos(RdlMk)))*ldk;
% Mobile energy consumption of uplink transmission
e1 = Pulk0.*(BIk-BIs+BIsk0).*inv_pos(Rulk);
e2 = Pulk0.*(BIk-BIs+BIsk)./Rulk0;
e3 = Pulk.*(BIk-BIs+BIsk0)./Rulk0;
e4 = luk*(BIk-BIs+BIsk);
Eulk = e1+e2+e3+(z-z0)*diag(z0)*(z-z0)'+e4;
% Rewrite the latency constraints C.2
g1 = square_pos(BIsk+inv_pos(Rulk));
g2 = BIsk0.*BIsk0;
g3 = 1./(Rulk0.*Rulk0);
g4 = BIsk0.*(BIsk-BIsk0);
g5 = 1+(Pulk0)/(N0*Wul/k);
g6 = Rulk0./(Rulk0.*Rulk0.*Rulk0.*Rulk0);
g7 = inv_pos(Rulk)-1./Rulk0;
gk = 1/2*(g1-g2-g3)-(g4-(g6./g5).*g7);
minimize(sum(Eulk+Edlk))
subject to
(BIk - BIs + BIsk0).*inv_pos(Rulk)+(Vk-Vs)/FC.*inv_pos(fk)+Vs/FC*inv_pos(fs)+(BOk-BOs).*inv_pos(Rdlk) <= Tmax - TuS - TdS; % Constraint C.1
gk <= TuS; % Constraint C.2
%gk > 1e-3;
(BOs.*inv_pos(RdlMk)) <= TdS; % Constraint C.3
%(BOs.*inv_pos(RdlMk)) > 1e-5;
TuS+TdS <= Tmax;
TuS > 1e-3;
TdS > 1e-5;
TuS <= 0.2;
TdS <= 0.02;
sum(fk) <= 1; % Constraint C.4
fk > 1e-5;
fs <= 1;
fs > 1e-5;
sum(BIsk) == BIs; % Constraint C.5
sum(Pdlk) <= Pdmax; % Constraint C.6
Pdlk <= Pdmax;
PdlM <= Pdmax;
Pulk <= Pumax;
Pdlk > 1e-3;
PdlM > 1e-3;
Pulk > 1e-3;
BIsk <= BIs;
BIsk > 1e-3;
cvx_end
Rulk = Wul/k*log2(1+Pulk/(N0*Wul/k));
Eulk = (Pulk./Rulk+luk).*(BIk-BIs+BIsk);
Rdlk = Wdl/k*log2(1+Pdlk/(N0*Wdl/k));
RdlMk = Wdl*log2(1+PdlM/(N0*Wul));
Edlk = ((BOk-BOs)./Rdlk+BOs./RdlMk)*ldk;
TuS = max(BIsk0./Rulk0);
TdS = max(BOs./RdlMk0);
z = [Pulk,BIsk,f,Pdlk,PdlM,TuS,TdS];
T = max((BIk - BIs + BIsk)./(Rulk)+(Vk-Vs)/(FC.*fk)+Vs/(FC*fs)+(BOk-BOs)./(Rdlk)+max(BIsk./Rulk)+max(BOs./(RdlMk)))
energy=sum(Eulk+Edlk)
The result:
Successive approximation method to be employed.
For improved efficiency, ECOS is solving the dual problem.
ECOS will be called several times to refine the solution.
Original size: 441 variables, 187 equality constraints
17 exponentials add 136 variables, 85 equality constraints
Cones | Errors |
Mov/Act | Centering Exp cone Poly cone | Status
--------±--------------------------------±--------
0/ 17 | 5.671e-04 2.730e-07 2.730e-07 | Solved
Status: Solved
Optimal value (cvx_optval): +8.16234e+13
Pulk
Pulk =
1 至 7 列
0.0831 0.0831 0.0831 0.0831 0.0831 0.0831 0.0831
8 列
0.0831
BIsk
BIsk =
1.0e+04 *
1 至 7 列
-1.1078 -1.3144 0.8074 0.9654 0.4910 -0.7950 0.8678
8 列
0.1856
fk
fk =
1 至 7 列
0.1053 0.1053 0.1053 0.1053 0.1053 0.1053 0.1053
8 列
0.1053
fs
fs =
0.4000
Pdlk
Pdlk =
1 至 7 列
3.6307 3.6307 3.6307 3.6307 3.6307 3.6307 3.6307
8 列
3.6307
sum(Pdlk)
ans =
29.0453
PdlM
PdlM =
7.6776
TuS
TuS =
0.0019
TdS
TdS =
7.0366e-06
In my constrains, I expect the variables are positive, obviously, BIsk didn’t satisfied,and I need the sum(Pdlk) <= Pdmax=20, but sum(Pdlk) = 29.0453.
It seems that my constrains didn’t work. Is there have some errors in my code?
Thank you!