# Why are the results using mosek and SeDuMi so different

``````cvx_begin
cvx_solver Mosek_5
variables eta2(length(wDk)) PJ_plus(1, N)  PS_plus(1, N)
expressions secrecy_rate2(3, N) interference2(2,N)
maximize (sum(eta2))
subject to
for k = 1:length(wDk)
for n = 1:N
h_S_Dk = PS_plus(n) * rho0 / (norm(qS(:,n) - wDk(:, k))^2 + H1^2);
term1 = log(1 + h_S_Dk / sigma2) / log(2);

h_J_E = PJ_plus(n) * rho0 / ((norm(qJ(:,n) - wE_hat) + rE)^2 + H2^2) + sigma2;
term2 = log(h_J_E) / log(2);

h_J_E_old = PJ_old(n) * rho0 / ((norm(qJ(:,n) - wE_hat) + rE)^2 + H2^2);
h_S_E_old = PS_old(n) * rho0 / ((norm(qS(:,n) - wE_hat) - rE)^2 + H1^2);
term3 = log(h_J_E_old + sigma2 + h_S_E_old) / log(2);

num = rho0 * ((PJ_plus(n) - PJ_old(n)) / ((norm(qJ(:,n) - wE_hat) + rE)^2 + H2^2) + ...
(PS_plus(n) - PS_old(n)) / ((norm(qS(:,n) - wE_hat) - rE)^2 + H1^2));
den = log(2) * (h_J_E_old + sigma2 + h_S_E_old);
term4 = num / den;

secrecy_rate2(k, n) = term1 + term2 - term3 - term4;
end
sum(theta(k, :).* secrecy_rate2(k,:))/ N >= eta2(k);
eta2(k) >= Rmin;
end

0 <= PS_plus <= Pmax_S;
sum(PS_plus) / N <= pS_ave;
0 <= PJ_plus<= Pmax_J;
sum(PJ_plus) / N <= pJ_ave;

for r = 1:size(wUr, 2)
for n = 1:N
interference2(r,n) = PJ_plus(n) * rho0 / (norm(qJ(:,n) - wUr(:, r))^2 + H2^2) + ...
PS_plus(n) * rho0 / (norm(qS(:,n) - wUr(:, r))^2 + H1^2);
end
sum(interference2(r,:))/ N <= Gamma_r;
end
cvx_end
``````

Figure 1 shows the results of using mosek.

Figure 2 shows the results of using SeDuMi.

## Mosek_5’s Log Calling Mosek_5 10.2.1: 707 variables, 307 equality constraints

MOSEK Version 10.2.1 (Build date: 2024-6-13 08:55:41)
Copyright (c) MOSEK ApS, Denmark WWW: mosek.com
Platform: Windows/64-X86

MOSEK warning 710 (MSK_RES_WRN_ZEROS_IN_SPARSE_COL): #2 (nearly) zero elements are specified in sparse col ‘’ (409) of matrix ‘A’.
MOSEK warning 710 (MSK_RES_WRN_ZEROS_IN_SPARSE_COL): #2 (nearly) zero elements are specified in sparse col ‘’ (415) of matrix ‘A’.
MOSEK warning 710 (MSK_RES_WRN_ZEROS_IN_SPARSE_COL): #2 (nearly) zero elements are specified in sparse col ‘’ (421) of matrix ‘A’.
MOSEK warning 710 (MSK_RES_WRN_ZEROS_IN_SPARSE_COL): #2 (nearly) zero elements are specified in sparse col ‘’ (427) of matrix ‘A’.
MOSEK warning 710 (MSK_RES_WRN_ZEROS_IN_SPARSE_COL): #2 (nearly) zero elements are specified in sparse col ‘’ (433) of matrix ‘A’.
MOSEK warning 710 (MSK_RES_WRN_ZEROS_IN_SPARSE_COL): #2 (nearly) zero elements are specified in sparse col ‘’ (439) of matrix ‘A’.
MOSEK warning 710 (MSK_RES_WRN_ZEROS_IN_SPARSE_COL): #2 (nearly) zero elements are specified in sparse col ‘’ (445) of matrix ‘A’.
MOSEK warning 710 (MSK_RES_WRN_ZEROS_IN_SPARSE_COL): #2 (nearly) zero elements are specified in sparse col ‘’ (451) of matrix ‘A’.
MOSEK warning 710 (MSK_RES_WRN_ZEROS_IN_SPARSE_COL): #2 (nearly) zero elements are specified in sparse col ‘’ (457) of matrix ‘A’.
MOSEK warning 710 (MSK_RES_WRN_ZEROS_IN_SPARSE_COL): #2 (nearly) zero elements are specified in sparse col ‘’ (463) of matrix ‘A’.
Warning number 710 is disabled.
Problem
Name :
Objective sense : minimize
Type : CONIC (conic optimization problem)
Constraints : 307
Affine conic cons. : 0
Disjunctive cons. : 0
Cones : 100
Scalar variables : 707
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 started.
Freed constraints in eliminator : 0
Eliminator terminated.
Eliminator - tries : 2 time : 0.00
Lin. dep. - tries : 1 time : 0.00
Lin. dep. - primal attempts : 1 successes : 1
Lin. dep. - dual attempts : 0 successes : 0
Lin. dep. - primal deps. : 0 dual deps. : 0
Presolve terminated. Time: 0.00
Optimizer - solved problem : the primal
Optimizer - Constraints : 57
Optimizer - Cones : 100
Optimizer - Scalar variables : 357 conic : 300
Optimizer - Semi-definite variables: 0 scalarized : 0
Factor - setup time : 0.00
Factor - dense det. time : 0.00 GP order time : 0.00
Factor - nonzeros before factor : 272 after factor : 275
Factor - dense dim. : 0 flops : 4.07e+03
ITE PFEAS DFEAS GFEAS PRSTATUS POBJ DOBJ MU TIME
0 6.9e+08 1.3e+00 8.2e+01 0.00e+00 0.000000000e+00 -8.051020016e+01 1.0e+00 0.00
1 3.3e+08 6.2e-01 5.6e+01 -9.97e-01 1.962656365e+00 -7.727360190e+01 4.8e-01 0.00
2 2.2e+08 4.1e-01 4.6e+01 -9.90e-01 8.978850696e-01 -7.702338385e+01 3.2e-01 0.00
3 6.9e+07 1.3e-01 2.5e+01 -9.81e-01 1.079498781e+00 -6.839165862e+01 1.0e-01 0.00
4 1.4e+07 2.6e-02 9.8e+00 -9.10e-01 1.871761708e-01 -2.880323892e+01 2.0e-02 0.00
5 3.6e+06 6.7e-03 2.7e+00 -4.31e-01 -1.719103724e+00 5.222646757e+00 5.2e-03 0.00
6 1.2e+06 2.3e-03 5.3e-01 5.05e-01 -2.914426615e+00 -1.857752946e+00 1.8e-03 0.00
7 1.5e+05 2.7e-04 1.8e-02 9.16e-01 -3.629379417e+00 -4.086793051e+00 2.1e-04 0.00
8 4.1e+04 7.7e-05 2.6e-03 1.16e+00 -5.363022646e+00 -5.478505901e+00 6.0e-05 0.00
9 1.8e+04 3.3e-05 7.8e-04 1.05e+00 -2.105610008e+01 -2.108952504e+01 2.6e-05 0.00
10 2.8e+03 5.3e-06 5.4e-05 9.61e-01 -2.453094147e+01 -2.453308952e+01 4.1e-06 0.00
11 7.6e+02 1.4e-06 9.8e-06 7.29e-01 -2.363441483e+01 -2.363175181e+01 1.1e-06 0.00
12 2.6e+02 4.8e-07 2.3e-06 7.05e-01 -2.304067877e+01 -2.303851172e+01 3.7e-07 0.00
13 1.5e+02 2.8e-07 1.5e-06 3.34e-01 -2.250573221e+01 -2.250162671e+01 2.2e-07 0.00
14 4.0e+01 7.5e-08 2.8e-07 4.92e-01 -2.159071926e+01 -2.158839383e+01 5.8e-08 0.00
15 1.5e+01 2.7e-08 1.1e-07 1.86e-01 -2.075668412e+01 -2.075308897e+01 2.1e-08 0.00
16 4.6e+00 8.5e-09 2.8e-08 4.03e-01 -1.992614045e+01 -1.992388574e+01 6.6e-09 0.00
17 2.2e+00 4.1e-09 1.5e-08 1.16e-01 -1.940756294e+01 -1.940447439e+01 3.2e-09 0.00
18 6.7e-01 1.2e-09 3.9e-09 2.76e-01 -1.854656848e+01 -1.854429905e+01 9.7e-10 0.00
19 2.8e-01 5.2e-10 2.1e-09 -2.44e-02 -1.789130704e+01 -1.788730672e+01 4.0e-10 0.00
20 7.7e-02 1.4e-10 4.4e-10 3.14e-01 -1.693120547e+01 -1.692892186e+01 1.1e-10 0.00
21 3.0e-02 5.6e-11 1.9e-10 1.28e-01 -1.623851338e+01 -1.623575280e+01 4.3e-11 0.00
22 8.4e-03 1.6e-11 4.5e-11 2.40e-01 -1.537239463e+01 -1.537038227e+01 1.2e-11 0.00
23 2.9e-03 5.3e-12 2.2e-11 -6.49e-02 -1.459387004e+01 -1.458978761e+01 4.1e-12 0.00
24 8.0e-04 1.5e-12 4.7e-12 2.85e-01 -1.360753245e+01 -1.360506634e+01 1.2e-12 0.00
25 3.6e-04 6.7e-13 2.3e-12 1.38e-01 -1.299012232e+01 -1.298725046e+01 5.2e-13 0.00
26 9.7e-05 1.8e-13 4.9e-13 2.82e-01 -1.212806033e+01 -1.212617328e+01 1.4e-13 0.00
27 2.8e-05 5.2e-14 2.0e-13 -1.66e-02 -1.121183265e+01 -1.120810590e+01 4.0e-14 0.00
28 7.5e-06 1.4e-14 4.2e-14 2.73e-01 -1.022871704e+01 -1.022640899e+01 1.1e-14 0.00
29 3.4e-06 7.1e-15 2.0e-14 1.51e-01 -9.537486436e+00 -9.535008085e+00 4.6e-15 0.00
30 9.0e-07 3.6e-15 5.1e-15 1.25e-01 -8.742428284e+00 -8.740082805e+00 1.3e-15 0.00
31 2.0e-07 1.8e-15 1.2e-15 4.72e-02 -7.768673970e+00 -7.765981714e+00 3.1e-16 0.00
32 1.2e-07 1.8e-15 7.0e-16 8.41e-02 -7.328541663e+00 -7.325923250e+00 1.7e-16 0.00
33 3.4e-08 1.8e-15 2.2e-16 3.58e-02 -6.440462093e+00 -6.437573249e+00 5.1e-17 0.00
34 1.3e-08 1.8e-15 8.3e-17 2.38e-02 -5.787670347e+00 -5.784770994e+00 2.0e-17 0.00
35 3.5e-09 1.8e-15 2.0e-17 1.09e-01 -4.827953714e+00 -4.825605814e+00 5.2e-18 0.00
36 1.5e-09 2.8e-18 8.6e-18 4.58e-02 -4.263238530e+00 -4.260764855e+00 2.2e-18 0.01
37 1.1e-09 2.1e-18 6.2e-18 4.15e-01 -4.083018328e+00 -4.080908615e+00 1.7e-18 0.01
38 6.1e-10 1.1e-18 2.9e-18 3.89e-01 -3.735172419e+00 -3.733591765e+00 9.0e-19 0.01
39 5.4e-10 1.0e-18 2.4e-18 5.50e-01 -3.663823027e+00 -3.662399740e+00 7.9e-19 0.01
40 2.0e-10 3.7e-19 6.6e-19 5.23e-01 -3.296910154e+00 -3.296092311e+00 2.9e-19 0.01
41 1.8e-10 3.3e-19 5.7e-19 6.93e-01 -3.263286342e+00 -3.262556628e+00 2.6e-19 0.01
42 6.5e-11 1.2e-19 1.6e-19 6.63e-01 -3.068307716e+00 -3.067902299e+00 9.6e-20 0.01
43 2.5e-11 4.6e-20 3.8e-20 7.81e-01 -2.963719662e+00 -2.963544417e+00 3.6e-20 0.01
44 1.3e-11 2.5e-20 1.5e-20 9.05e-01 -2.928431393e+00 -2.928335206e+00 1.9e-20 0.01
45 6.0e-12 1.1e-20 4.7e-21 9.71e-01 -2.906305511e+00 -2.906260409e+00 8.7e-21 0.01
46 3.9e-13 7.2e-22 8.5e-23 9.75e-01 -2.888478974e+00 -2.888475427e+00 5.6e-22 0.01
47 8.7e-15 1.9e-23 3.1e-25 9.96e-01 -2.887150655e+00 -2.887150573e+00 1.3e-23 0.01
48 8.7e-15 1.9e-23 3.1e-25 9.96e-01 -2.887150655e+00 -2.887150573e+00 1.3e-23 0.01
49 5.1e-14 2.9e-22 6.3e-27 9.99e-01 -2.887121479e+00 -2.887121476e+00 4.4e-25 0.01
Optimizer terminated. Time: 0.01

Interior-point solution summary
Problem status : PRIMAL_AND_DUAL_FEASIBLE
Solution status : OPTIMAL
Primal. obj: -2.8871214790e+00 nrm: 1e+03 Viol. con: 2e-08 var: 0e+00 cones: 3e-08
Dual. obj: -2.8871214762e+00 nrm: 7e+08 Viol. con: 0e+00 var: 7e-13 cones: 0e+00
Optimizer summary
Optimizer - time: 0.01
Interior-point - iterations : 49 time: 0.01
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: Solved
Optimal value (cvx_optval): +5.88712

SeDuMi’s Log：

## Cones | Errors | Mov/Act | Centering Exp cone Poly cone | Status --------±--------------------------------±-------- 100/100 | 8.000e+00 1.077e+01 0.000e+00 | Solved 71/ 71 | 5.367e+00 5.621e+00 0.000e+00 | Solved 50/ 50 | 3.902e+00 2.054e+00 0.000e+00 | Solved 50/ 50 | 1.912e+00 2.716e-01 0.000e+00 | Solved 0/ 0 | 0.000e+00 0.000e+00 0.000e+00 | Solved

Status: Solved
Optimal value (cvx_optval): +14.2538

Other parameters are listed below:
rho0_dbm = -30; % Channel power gain at reference distance (dBm)
rho0 = 10 ^ (rho0_dbm / 10) * 10^(-3);
wE_hat = [15; -15]; % Estimated location of the eavesdropper
wDk = [-55, -10; 0, -65; 50, -5]‘; % Horizontal locations of CUs
wUr = [30, 25; -30, 25]’; % Horizontal locations of PUs
Pmax_S = 0.3; % Peak transmit power of UAV S (W)
Pmax_J = 0.2; % Peak transmit power of UAV J (W)
Gamma_r = 10 ^ (-70 / 10) * 10^(-3); % Interference power threshold (W)
Rmin = 1; % Minimum average secrecy rate (bit/s/Hz)
T = 50; % Total flight time (s)
delta_t = 1; % Time slot length (s)
Vmax_S = 7; % Maximum velocity of UAV S (m/s)
Vmax_J = 7; % Maximum velocity of UAV J (m/s)
rE = 10; % Maximum estimation error of the distance
q0_S = [53; -25]; % Initial location of UAV S
q0_J = [-26.5; -23.5]; % Initial location of UAV J
qF_S = [53; -25]; % Final location of UAV S
qF_J = [-26.5; -23.5]; % Final location of UAV J
N = T / delta_t; % Number of time slots `
H1 = 10; % Altitude of UAV S
H2 = 10; % Altitude of UAV J
sigma2_dBm = -90;
sigma2 = 10 ^ (sigma2_dBm / 10) * 10^(-3);
C = mean(wDk, 2);
R_S = min(Vmax_S * T / (2 * pi), mean(norm(C-wDk)));
R_J = R_S / 2;
theta1 = linspace(0, 2 * pi, N);
qS = C + R_S * [cos(theta1); sin(theta1)];
qJ = C + R_J * [-cos(theta1); sin(theta1)];
pS_ave=0.075;
pJ_ave=0.05;
PS = pS_ave * ones(1, N);
PJ = pJ_ave * ones(1, N);
PS_old = PS;
PJ_old = PJ;

This

demonstrates to me that Mosek solves the problem to a fairly high accuracy.