I have tried to sovle a problem which is said to be convex and have been solved by Lagrange duality. But i failed and my code and the output of the cvx are shown below. I guess the reason is that the coefficient are too big or too small, but i have no idea how to rescale it yet. Is there any advice? Thanks in advance.
%% simulation setting
K = 4;
pb2ue = [12 10 15 13]’; %meters
ue2mec = [30 35 20 25]’; %meters
T = 1; %second
B = 1e5; % Hz
Pt = 3; % W
Pc_tr = 1e-3;
Pc_bs = 1e-4;
sigma = -120; %dBm/Hz
C = 1000; %cycles/bit
kappa = 1e-26;
D = ones(K,1)201e3; %bits
fmax = 5*1e8; %Hz
xi = db2lin(-15); %dB
ep = 0.51;
h = channle_gain(ue2mec);
g = channle_gain(pb2ue);
G = xi.*h.*g./(B.*db2lin(sigma-30));
H = h./(B.db2lin(sigma-30));
eta = 0;
N = 200;
n=1;
RR = 10;
EE = 0;
while(n<N&&abs(RR-etaEE)>1e-3)
if(n==1)
eta = 0;
else
eta = RR/EE;
end
cvx_clear
cvx_begin
cvx_solver mosek
variables t(K) tau(K) f(K) z(K)
r=cvx(zeros(K,1));
e=cvx(zeros(K,1));
r = T.*f.*inv_pos(C)+ B.*t.*(-rel_entr(ones(K,1),1+Pt.*G)) + B.*(-rel_entr(tau,tau+z.*H));
e = T.*pow_p(f,3).*kappa + z + tau.*Pc_tr + t.*(Pc_bs);
R = sum(r);
E = sum(e);
EH = ep.*Pt.*g.*(sum(t)-t);
target = R - eta*E;
maximize( target );
subject to
for k =1:K
t(k)>=0;
z(k)>=0;
tau(k)>=0;
f(k)>=0;
r(k) - D(k) >= 0;
e(k) - EH(k) <= 0;
end
sum(tau+t)<=T;
cvx_end
RR = R;
EE = E;
n=n+1;
end
function ch=channle_gain(dist)
[m,n] = size(dist);
rho_0 = 1e-3;
rho = rho_0*(dist.^(-3));
CH=sqrt(rho/2).(randn(m,n)+1jrandn(m,n));
ch = abs(CH).^2;
end
function lin = db2lin(db)
lin = 10^(db/10);
end
Calling Mosek 9.1.9: 61 variables, 28 equality constraints
For improved efficiency, Mosek is solving the dual problem.
MOSEK Version 9.1.9 (Build date: 2019-11-21 11:34:40)
Copyright © MOSEK ApS, Denmark. WWW: mosek.com
Platform: Windows/64-X86
MOSEK warning 710: #1 (nearly) zero elements are specified in sparse col ‘’ (5) of matrix ‘A’.
MOSEK warning 710: #1 (nearly) zero elements are specified in sparse col ‘’ (11) of matrix ‘A’.
MOSEK warning 710: #1 (nearly) zero elements are specified in sparse col ‘’ (17) of matrix ‘A’.
MOSEK warning 710: #1 (nearly) zero elements are specified in sparse col ‘’ (23) of matrix ‘A’.
Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 28
Cones : 12
Scalar variables : 61
Matrix variables : 0
Integer variables : 0
Optimizer started.
Presolve started.
Linear dependency checker started.
Linear dependency checker terminated.
Eliminator started.
Freed constraints in eliminator : 0
Eliminator terminated.
Eliminator - tries : 1 time : 0.00
Lin. dep. - tries : 1 time : 0.02
Lin. dep. - number : 0
Presolve terminated. Time: 0.03
Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 28
Cones : 12
Scalar variables : 61
Matrix variables : 0
Integer variables : 0
Optimizer - threads : 4
Optimizer - solved problem : the primal
Optimizer - Constraints : 20
Optimizer - Cones : 12
Optimizer - Scalar variables : 57 conic : 36
Optimizer - Semi-definite variables: 0 scalarized : 0
Factor - setup time : 0.00 dense det. time : 0.00
Factor - ML order time : 0.00 GP order time : 0.00
Factor - nonzeros before factor : 84 after factor : 84
Factor - dense dim. : 0 flops : 1.03e+03
ITE PFEAS DFEAS GFEAS PRSTATUS POBJ DOBJ MU TIME
0 1.3e+00 1.3e+00 4.4e+00 0.00e+00 3.355918399e+00 0.000000000e+00 1.0e+00 0.05
1 2.7e-01 2.7e-01 4.1e-01 2.25e-01 8.723423894e-01 0.000000000e+00 2.1e-01 0.13
2 5.0e-02 5.0e-02 6.6e-02 8.98e-01 1.496586177e-01 0.000000000e+00 3.9e-02 0.14
3 9.5e-03 9.4e-03 2.8e-02 -7.95e-01 -4.585071210e-01 0.000000000e+00 7.3e-03 0.14
4 1.8e-03 1.8e-03 1.2e-02 -9.15e-01 -3.730947772e+00 0.000000000e+00 1.4e-03 0.16
5 4.3e-04 4.2e-04 6.1e-03 -9.70e-01 -1.790631065e+01 0.000000000e+00 3.3e-04 0.16
6 1.4e-04 1.4e-04 3.7e-03 -1.04e+00 -5.973116899e+01 0.000000000e+00 1.1e-04 0.16
7 3.9e-05 3.8e-05 1.8e-03 -9.39e-01 -1.893208258e+02 0.000000000e+00 3.0e-05 0.16
8 7.5e-06 7.4e-06 8.4e-04 -1.05e+00 -1.130565243e+03 0.000000000e+00 5.7e-06 0.17
9 2.2e-06 2.2e-06 4.8e-04 -1.08e+00 -4.083325748e+03 0.000000000e+00 1.7e-06 0.17
10 3.3e-07 3.2e-07 1.5e-04 -9.05e-01 -1.958643905e+04 0.000000000e+00 2.5e-07 0.17
11 7.2e-08 7.1e-08 7.4e-05 -1.03e+00 -9.550102054e+04 0.000000000e+00 5.5e-08 0.19
12 1.9e-08 1.9e-08 4.4e-05 -1.08e+00 -4.744901542e+05 0.000000000e+00 1.5e-08 0.19
13 2.5e-09 2.5e-09 1.4e-05 -9.43e-01 -2.653740351e+06 0.000000000e+00 1.9e-09 0.19
14 5.0e-10 5.0e-10 6.6e-06 -1.01e+00 -1.573712778e+07 0.000000000e+00 3.8e-10 0.19
Optimizer terminated. Time: 0.27
Interior-point solution summary
Problem status : DUAL_INFEASIBLE
Solution status : DUAL_INFEASIBLE_CER
Primal. obj: -7.8751251385e-02 nrm: 2e+03 Viol. con: 4e-07 var: 0e+00 cones: 2e-10
Optimizer summary
Optimizer - time: 0.27
Interior-point - iterations : 14 time: 0.20
Basis identification - time: 0.00
Primal - iterations : 0 time: 0.00
Dual - iterations : 0 time: 0.00
Clean primal - iterations : 0 time: 0.00
Clean dual - iterations : 0 time: 0.00
Simplex - time: 0.00
Primal simplex - iterations : 0 time: 0.00
Dual simplex - iterations : 0 time: 0.00
Mixed integer - relaxations: 0 time: 0.00
Status: Infeasible
Optimal value (cvx_optval): +Inf