# 'Infeasibility' ouput by mosek

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-eta
EE)>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)
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 - 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

First change the scaling, for instance by changing units. Mosek doesn’t "like’ coefficients which are non-zero and close to 0 in magnitude; and has expressed its displeasure by warning you. Very large magnitude coefficients are also bad.

Second: if still infeasible and Mosek’s warnings have been eliminated: Follow the advice in https://yalmip.github.io/debugginginfeasible/, except for section 1

Thank you for your advice! After scaling, Mosek’s warning have been eliminated, but output failed. Is that mean there is something wrong in my model. Or it is still about the usage of CVX.

clear,clc
%% 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-27;
D = ones(K,1)51e3; %bits
fmax = 5*1e8; %Hz
xi = db2lin(-15); %dB
ch_realization = 1;
ep = 0.51;
ee = 0;
PT=[3];
EE_PT = zeros(length(PT),1);
c = 2.463; d=1.635; v=0.826;
for req = 1:length(PT)
Pt = PT(req);
for cr = 1:ch_realization
% h = ch(pb2ue);
h = channle_gain(ue2mec);
g = channle_gain(pb2ue);
G = xi.*h.*g./(B.*db2lin(sigma-30));
H = h./(B.db2lin(sigma-30));
%% Dinkelbach
eta = 0;
N = 200;
n=1;
R = 10;
E = 0;
iteration = [];
while(n<N&&abs(R-etaE)>1e-3)
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));
expression R
expression E
expression EH
expression target
F = f.*1e9;
r = T.*F.*inv_pos©+ B.t.(-rel_entr(ones(K,1),1+Pt.G)) + B.(-rel_entr(tau,tau+z.*H));
e = T.*pow_p(f,3) + z + tau.Pc_tr + t.(Pc_bs);
R = sum®;
E = sum(e);
EH = ep.*Pt.g.(sum(t)-t);
% EH = ((c.*Pt.*g+d)./(Pt.g+v)-d/v);
target = R - etaE;
% target = R;
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
ee = ee+eta/ch_realization;
end
EE_PT(req) = ee;
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)
Platform: Windows/64-X86

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.00
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 - solved problem : the primal
Optimizer - Constraints : 20
Optimizer - Cones : 12
Optimizer - Scalar variables : 53 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 : 120 after factor : 120
Factor - dense dim. : 0 flops : 1.95e+03
ITE PFEAS DFEAS GFEAS PRSTATUS POBJ DOBJ MU TIME
0 1.0e+05 1.3e+00 4.8e+00 0.00e+00 3.838979600e+00 0.000000000e+00 1.0e+00 0.05
1 1.8e+04 2.3e-01 2.0e+00 -1.00e+00 2.984059295e+01 3.068649862e+01 1.8e-01 0.14
2 5.6e+03 7.3e-02 1.1e+00 -1.00e+00 2.000398908e+02 2.129452342e+02 5.6e-02 0.14
3 7.8e+02 1.0e-02 4.3e-01 -1.00e+00 1.668055958e+03 1.791815484e+03 7.8e-03 0.14
4 1.6e+02 2.1e-03 1.9e-01 -1.00e+00 8.205718180e+03 8.828580257e+03 1.6e-03 0.16
5 3.3e+01 4.3e-04 8.9e-02 -1.01e+00 4.124311376e+04 4.438814152e+04 3.3e-04 0.16
6 2.4e+00 3.1e-05 2.9e-02 -1.05e+00 8.164982848e+05 8.777124573e+05 2.4e-05 0.17
7 4.2e-01 5.4e-06 1.1e-02 -1.10e+00 4.176693448e+06 4.456333362e+06 4.2e-06 0.17
8 1.6e-01 2.0e-06 3.5e-03 -2.17e-01 3.361645631e+06 3.572634799e+06 1.6e-06 0.17
9 5.0e-02 6.5e-07 5.9e-04 6.64e-01 2.563229691e+06 2.622232177e+06 5.0e-07 0.17
10 2.3e-02 3.0e-07 2.4e-04 5.73e-01 2.056962192e+06 2.103714620e+06 2.3e-07 0.17
11 7.2e-03 9.3e-08 5.2e-05 7.20e-01 1.553413852e+06 1.576153972e+06 7.2e-08 0.19
12 3.1e-03 4.0e-08 2.2e-05 3.91e-01 1.273238883e+06 1.293848084e+06 3.1e-08 0.19
13 1.1e-03 1.4e-08 5.7e-06 5.27e-01 1.008192216e+06 1.020688728e+06 1.1e-08 0.20
14 3.4e-04 4.4e-09 1.8e-06 2.73e-01 7.706732633e+05 7.821099310e+05 3.4e-09 0.20
15 1.1e-04 1.4e-09 4.6e-07 3.85e-01 5.964429562e+05 6.041579066e+05 1.1e-09 0.20
16 2.4e-05 3.1e-10 9.8e-08 2.06e-01 3.899432677e+05 3.969244998e+05 2.4e-10 0.20
17 6.4e-06 8.2e-11 2.4e-08 2.38e-01 2.475184864e+05 2.534722265e+05 6.4e-11 0.20
18 2.4e-06 3.0e-11 7.7e-09 3.21e-01 1.888246134e+05 1.934304368e+05 2.4e-11 0.20
19 7.8e-07 1.0e-11 2.1e-09 4.22e-01 1.415278296e+05 1.444626695e+05 7.8e-12 0.22
20 3.6e-07 4.7e-12 9.7e-10 1.83e-01 1.166533250e+05 1.197263126e+05 3.6e-12 0.22
21 7.9e-08 1.0e-12 1.6e-10 3.59e-01 8.072066518e+04 8.249639265e+04 7.9e-13 0.22
22 2.7e-08 3.5e-13 5.6e-11 1.61e-01 5.980062120e+04 6.162668523e+04 2.7e-13 0.22
23 8.4e-09 1.1e-13 1.4e-11 3.35e-01 4.310673385e+04 4.437011722e+04 8.4e-14 0.22
24 3.5e-09 4.6e-14 6.4e-12 1.28e-01 3.274252781e+04 3.413106502e+04 3.5e-14 0.23
25 8.0e-10 1.0e-14 1.1e-12 3.87e-01 1.974918455e+04 2.049445534e+04 8.0e-15 0.23
26 2.3e-10 3.0e-15 3.3e-13 1.10e-01 1.074733874e+04 1.161158785e+04 2.3e-15 0.25
27 5.9e-11 7.6e-16 7.2e-14 2.73e-01 3.952817485e+03 4.594539527e+03 5.9e-16 0.25
28 1.7e-11 2.2e-16 2.8e-14 -1.00e-01 -2.494717938e+02 9.615362393e+02 1.7e-16 0.25
29 9.8e-12 2.7e-17 1.0e-14 -8.09e-01 -9.587400059e+03 4.192816380e+03 2.1e-17 0.27
30 5.4e-12 2.5e-20 5.0e-14 -9.57e-01 -1.177215124e+07 1.937079736e+03 2.0e-20 0.27
31 4.1e-12 1.9e-20 4.1e-14 -1.00e+00 -1.569671388e+07 1.937079734e+03 1.5e-20 0.27
32 2.0e-12 9.6e-21 5.9e-14 -1.00e+00 -3.139472428e+07 1.937079730e+03 7.4e-21 0.28
33 6.8e-14 1.5e-25 1.0e-11 -1.00e+00 -2.053631651e+12 1.936917017e+03 1.1e-25 0.28
34 6.8e-14 1.5e-25 1.0e-11 -1.00e+00 -2.053631651e+12 1.936917017e+03 1.1e-25 0.28
35 6.8e-14 1.5e-25 1.0e-11 -1.00e+00 -2.053631651e+12 1.936917017e+03 1.1e-25 0.28
Optimizer terminated. Time: 0.34

Interior-point solution summary
Problem status : ILL_POSED
Solution status : DUAL_ILLPOSED_CER
Primal. obj: -4.3507777617e-07 nrm: 1e+01 Viol. con: 1e-13 var: 0e+00 cones: 0e+00
Optimizer summary
Optimizer - time: 0.34
Interior-point - iterations : 36 time: 0.30
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: Failed
Optimal value (cvx_optval): NaN

Mosek reports your problem as dual ill-posed. Because Mosek is provided the dual by CVX, that means Mosek has assessed the primal (as you entered it in CVX) to be ill-posed. I will defer to Mosek personnel to provide more specific guidance.

Primal ill-posed is more or less the same as primal infeasible. Indeed when looking at the log output that would be my conclusion about the problem.

So that gets us to my recommendation to the OP in my first post: