# The MOSEK generates infeasible solution of a feasible problem

The following code outputs an infeasible solution, but the problem is indeed feasible! May someone help me to figure it out and thanks!

For example, the optimized a and b are
a =

1.0e-08 *

``````0.5729
0.5629
``````

b =

1.0e-08 *

``````0.5602    0.5713
0.5782    0.5653
``````

The objective is 0.1284.

The result is obviously not correct since a and b violate the constraints. However, the problem is indeed feasible, for example when a = [0.5;0.5] and b=[0 1; 1 0], the problem is feasible.

MATLAB CODE (this code can run without errors)

``````clear all
rng(0)
%%
T=2;
L = 2;
alph = 1;
bta = 1;
D = ones(T, 1);
P = 10; % Watt`
N0 = 1e-3*10^(-174/10); % Watt/Hz, -174 dbm/Hz
W = 100e6; % W MHz
N = 10;
ksi = 0.5; % A/Watt
h = exprnd(1e-6, N, T); % channel gain, simplified
R = 1e7; % 10Mbps
tau = 1; % tau seconds video
miu = 1e6*[50, 150]'; % bitrate
%%
Delta = (exp(1)/(2*pi)*P^2/N0*(ksi*sum(h, 1)).^2)';
V = repmat((miu*tau)', T, 1);
%% BnB
cvx_solver mosek
cvx_precision high
cvx_begin
variable b(T, L)
variable a(T, 1)

obj = 1/T*sum(rel_entr(1, alph./D.*sum(b.*V, 2)));

minimize(obj)

subject to

0 <= b <= 1;
sum(b,2) == 1;
0 <= a <= 1;
sum(a) == 1
-tau*rel_entr(a.*W, a.*W+Delta) >= sum(b.*V, 2);

cvx_end
b = full(b);
qoe = -1/T*sum(rel_entr(1, alph./D.*sum(b.*V, 2)))
``````

Output

CVX Warning:
Models involving “rel_entr” or other functions in the log, exp, and entropy
family are solved using an experimental successive approximation method.
This method is slower and less reliable than the method CVX employs for
other models. Please see the section of the user’s guide entitled
The successive approximation method
for more details about the approach, and for instructions on how to
suppress this warning message in the future.

## Calling Mosek 9.1.9: 27 variables, 9 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 57: A large value of 5.2e+10 has been specified in c for variable ‘’ (23).
MOSEK warning 57: A large value of 3.7e+10 has been specified in c for variable ‘’ (26).
Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 9
Cones : 3
Scalar variables : 27
Matrix variables : 0
Integer variables : 0

Optimizer started.
Presolve started.
Linear dependency checker started.
Linear dependency checker terminated.
Eliminator started.
Freed constraints in eliminator : 2
Eliminator terminated.
Eliminator started.
Freed constraints in eliminator : 0
Eliminator terminated.
Eliminator - tries : 2 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 : 9
Cones : 3
Scalar variables : 27
Matrix variables : 0
Integer variables : 0

Optimizer - solved problem : the primal
Optimizer - Constraints : 6
Optimizer - Cones : 4
Optimizer - Scalar variables : 26 conic : 14
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 : 21 after factor : 21
Factor - dense dim. : 0 flops : 2.79e+02
ITE PFEAS DFEAS GFEAS PRSTATUS POBJ DOBJ MU TIME
0 1.0e+00 5.2e+10 1.1e+11 0.00e+00 1.141272097e+11 -4.025510008e-01 1.0e+00 0.03
1 1.2e-01 6.2e+09 4.0e+10 -1.00e+00 1.141244680e+11 -6.189938641e+00 1.2e-01 0.08
2 1.9e-02 1.0e+09 1.6e+10 -1.00e+00 1.141242944e+11 -3.586542216e+01 1.9e-02 0.08
3 6.8e-03 3.5e+08 9.4e+09 -1.00e+00 1.141242815e+11 -9.518210206e+01 6.8e-03 0.08
4 1.9e-03 9.7e+07 4.9e+09 -1.00e+00 1.141242762e+11 -3.554443936e+02 1.9e-03 0.09
5 5.3e-05 2.8e+06 8.3e+08 -1.00e+00 1.141238554e+11 -1.235443378e+04 5.3e-05 0.09
6 6.4e-07 3.3e+04 9.1e+07 -1.00e+00 1.140890586e+11 -1.094891031e+06 6.4e-07 0.09
7 7.8e-09 4.0e+02 9.9e+06 -9.99e-01 1.112885239e+11 -8.997440240e+07 7.8e-09 0.09
8 6.1e-09 1.4e+01 1.4e+06 -9.54e-01 6.426330097e+10 -1.561326813e+09 2.7e-10 0.09
9 3.1e-09 6.3e+00 5.9e+05 -1.59e-01 4.126593215e+10 -1.512412990e+09 1.2e-10 0.11
10 3.0e-09 5.9e+00 5.4e+05 3.00e-01 3.932531344e+10 -1.444784481e+09 1.1e-10 0.11
11 2.0e-09 1.5e+00 6.7e+04 3.17e-01 1.211608038e+10 -5.291480873e+08 3.0e-11 0.11
12 5.8e-10 1.7e-01 2.9e+03 7.50e-01 1.501952555e+09 -8.676488459e+07 3.6e-12 0.11
13 5.8e-10 1.7e-01 2.9e+03 9.73e-01 1.501952555e+09 -8.676488459e+07 3.6e-12 0.13
14 5.8e-10 1.7e-01 2.9e+03 9.73e-01 1.501952555e+09 -8.676488459e+07 3.6e-12 0.13
Optimizer terminated. Time: 0.16

Interior-point solution summary
Problem status : UNKNOWN
Solution status : UNKNOWN
Primal. obj: 1.5019525550e+09 nrm: 6e+08 Viol. con: 7e+08 var: 0e+00 cones: 0e+00
Dual. obj: -8.6764884591e+07 nrm: 5e+10 Viol. con: 0e+00 var: 8e+08 cones: 0e+00
Optimizer summary
Optimizer - time: 0.16
Interior-point - iterations : 15 time: 0.13
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: Inaccurate/Unbounded
Optimal value (cvx_optval): -Inf

qoe =

``0.1284``

Mosek is warning you that you have coefficients of order 2e+10. If the rest of the problem is just as bad then the solver probably falls apart numerically. So first you must very seriously fix the scaling.

Also, never use `cvx_precision high` with Mosek.

And if you want anybody to re-run and reproduce your code then please copy it all as preformatted text. It is impossibly to copy your current code without missing a lot of characters.

Also why not try the latest Mosek instead of 9.1

Thank you Professor. I have preformatted the text. LATER, I will try to re-run the code according to your suggestion.

I have no toolboxes required to run your code but you might be into numerically shaky ground even before you start to optimize. For example

``````>> N0

N0 =

3.9811e-21

>> exp(1)/(2*pi)*P^2/N0

ans =

1.0867e+22

``````

Thank you very much. Are you saying that I should avoid such large numbers in the code? Can you give me some hints or examples of how to rescale these large numbers?

Yes it is better to avoid such numbers, and that is also why Mosek warns you. Usually this is achieved by a change of units, for example instead of milimeters you use meters etc. Only you can know how to execute something like that in your model.