# Hello,how to deal with it?Status: Infeasible Optimal value (cvx_optval): -Inf

clc;
clear all;
close all;
cvx_solver mosek
%轨迹初始化
T = 120; %mission period
delta = T/120; %elemental length
N = T/delta; %number of time slot
K=6;
% 用户在移动
% 用户一的初始轨迹
% xw1 = 700;%圆心
% yw1 = 100;
% rw1 = 200;%radius
% theta = 0:2pi/(N-1):2pi;
% qw11 = xw1 + rw1cos(theta);
% qw21 = yw1 + rw1
sin(theta);
% qw11 = qw11’;
% qw21 = qw21’;
% w1 = [qw11,qw21];
%用户二的初始估计
% xw2 = 200;%圆心
% yw2 = 450;
% rw2 = 100;%radius
% theta = 0:2pi/(N-1):2pi;
% qw12 = xw2 + rw2cos(theta);
% qw22 = yw2 + rw2
sin(theta);
% qw12 = qw12’;
% qw22 = qw22’;
% w2 = [qw12,qw22];
w1 = [700ones(N,1),100ones(N,1)];
w2 = [200ones(N,1),450ones(N,1)];
w3 = [-300ones(N,1),450ones(N,1)];
w4 = [-600ones(N,1),200ones(N,1)];
w5 = [-450ones(N,1),-450ones(N,1)];
w6 = [400ones(N,1),-500ones(N,1)];

% 恶意干扰在移动
% 干扰点的初始轨迹
Jx1 =0 ;%圆心
Jy1 = 0;
Jw1 = 200;%radius
theta = 0:2pi/(N-1):2pi;
J11 = Jx1 + Jw1cos(theta);
J21 = Jy1 + Jw1
sin(theta);
J11 = J11’;
J21 = J21’;
J = [J11,J21];
% J = [0ones(N,1),0ones(N,1)];%恶意干扰信号位置

pm=0.001;%干扰功率
pmax=0.01;
B=10;
vmax = 30; %maximum speed
beta_db =-60; %单位距离下信道增益 dB
sigma_db = -148; %噪声强度dB
beta = 10^(beta_db/10);
sigma = 10^(sigma_db/10);
H = 100; %无人机高度
%初始轨迹
x11 = 0;%圆心
y11 = 0;
r1 = 400;%radius
theta = 0:2pi/(N-1):2pi;
% 无人机轨迹
q11 = x11 + r1cos(theta);
q21 = y11 + r1
sin(theta);
q11 = q11’;
q21 =q21’;
q1 = [q11,q21];
% q1=[38ones(N,1),5ones(N,1)];
eachIterNum = 1;
for iterNum =1:1:1
%无人机与用户位置d_r,u
d11 = H^2+(q1(:,1)-w1(:,1)).^2+(q1(:,2)-w1(:,2)).^2;
d12 = H^2+(q1(:,1)-w2(:,1)).^2+(q1(:,2)-w2(:,2)).^2;
d13 = H^2+(q1(:,1)-w3(:,1)).^2+(q1(:,2)-w3(:,2)).^2;
d14 = H^2+(q1(:,1)-w4(:,1)).^2+(q1(:,2)-w4(:,2)).^2;
d15 = H^2+(q1(:,1)-w5(:,1)).^2+(q1(:,2)-w5(:,2)).^2;
d16 = H^2+(q1(:,1)-w6(:,1)).^2+(q1(:,2)-w6(:,2)).^2;
d= H^2+(q1(:,1)-J(:,1)).^2+(q1(:,2)-J(:,2)).^2;

g1=beta./d11;
g2=beta./d12;
g3=beta./d13;
g4=beta./d14;
g5=beta./d15;
g6=beta./d16;
gm=beta./d;

cvx_begin
% cvx_precision best
variable eta

variable p1(N)
variable p2(N)
variable p3(N)
variable p4(N)
variable p5(N)
variable p6(N)
maximize eta
subject to

sum(B*log(1+p1.*g1./(pm.gm(:)+sigma)))/T>=eta;
sum(B
log(1+p2.*g2./(pm.gm(:)+sigma)))/T>=eta;
sum(B
log(1+p3.*g3./(pm.gm(:)+sigma)))/T>=eta;
sum(B
log(1+p4.*g4./(pm.gm(:)+sigma)))/T>=eta;
sum(B
log(1+p5.*g5./(pm.gm(:)+sigma)))/T>=eta;
sum(B
log(1+p6.*g6./(pm.*gm(:)+sigma)))/T>=eta;

p1+p2+p3+p4+p5+p6<=pmax;

0.001<=p1;
0.001<=p2;
0.001<=p3;
0.001<=p4;
0.001<=p5;
0.001<=p6;

cvx_end
optvalue1(iterNum) = cvx_optval;
eachOptValue(eachIterNum) = cvx_optval;
eachIterNum = eachIterNum + 1;

q1s=q1;
for cntTra=1:1:1
d11 = H^2+(q1s(:,1)-w1(:,1)).^2+(q1s(:,2)-w1(:,2)).^2;
d12 = H^2+(q1s(:,1)-w2(:,1)).^2+(q1s(:,2)-w2(:,2)).^2;
d13 = H^2+(q1s(:,1)-w3(:,1)).^2+(q1s(:,2)-w3(:,2)).^2;
d14 = H^2+(q1s(:,1)-w4(:,1)).^2+(q1s(:,2)-w4(:,2)).^2;
d15 = H^2+(q1s(:,1)-w5(:,1)).^2+(q1s(:,2)-w5(:,2)).^2;
d16 = H^2+(q1s(:,1)-w6(:,1)).^2+(q1s(:,2)-w6(:,2)).^2;
d= H^2+(q1s(:,1)-J(:,1)).^2+(q1s(:,2)-J(:,2)).^2;

Is=sigma+(beta.*pm)./d;%初始可行解
Ls1=d11./(beta.*p1);
Ls2=d12./(beta.*p2);
Ls3=d13./(beta.*p3);
Ls4=d14./(beta.*p4);
Ls5=d15./(beta.*p5);
Ls6=d16./(beta.*p6);

A1=-1./(Ls1+B*Ls1.^2.Is);%泰勒展开系数
A2=-1./(Ls2+B
Ls2.^2.Is);
A3=-1./(Ls3+B
Ls3.^2.Is);
A4=-1./(Ls4+B
Ls4.^2.Is);
A5=-1./(Ls5+B
Ls5.^2.Is);
A6=-1./(Ls6+B
Ls6.^2.*Is);

C1=-1./(Is+B*Is.^2.Ls1);%泰勒展开系数
C2=-1./(Is+B
Is.^2.Ls2);
C3=-1./(Is+B
Is.^2.Ls3);
C4=-1./(Is+B
Is.^2.Ls4);
C5=-1./(Is+B
Is.^2.Ls5);
C6=-1./(Is+B
Is.^2.*Ls6);

cvx_begin

variable q1(N,2)
variable L1(N)
variable L2(N)
variable L3(N)
variable L4(N)
variable L5(N)
variable L6(N)
variable I(N)

variable eta
variable m(N)
expression qu1(N,1)

maximize eta

subject to
sum(Blog(1+1./(Ls1(:).Is(:)))-abs(A1).(L1(:)-Ls1(:))-abs(C1).(I(:)-Is(:)))/T>=eta;%（1-1）
sum(Blog(1+1./(Ls2(:).Is(:)))-abs(A2).(L2(:)-Ls2(:))-abs(C2).(I(:)-Is(:)))/T>=eta;
sum(Blog(1+1./(Ls3(:).Is(:)))-abs(A3).(L3(:)-Ls3(:))-abs(C3).(I(:)-Is(:)))/T>=eta;
sum(Blog(1+1./(Ls4(:).Is(:)))-abs(A4).(L4(:)-Ls4(:))-abs(C4).(I(:)-Is(:)))/T>=eta;
sum(Blog(1+1./(Ls5(:).Is(:)))-abs(A5).(L5(:)-Ls5(:))-abs(C5).(I(:)-Is(:)))/T>=eta;
sum(Blog(1+1./(Ls6(:).Is(:)))-abs(A6).(L6(:)-Ls6(:))-abs(C6).(I(:)-Is(:)))/T>=eta;

for i=1:1:N

H^2+sum_square_abs(q1(i,:)-w1(i,:))<=beta.*p1.*L1(i)%（1-2）
H^2+sum_square_abs(q1(i,:)-w2(i,:))<=beta.*p2.*L2(i);
H^2+sum_square_abs(q1(i,:)-w3(i,:))<=beta.*p3.*L3(i);
H^2+sum_square_abs(q1(i,:)-w4(i,:))<=beta.*p4.*L4(i);
H^2+sum_square_abs(q1(i,:)-w5(i,:))<=beta.*p5.*L5(i);
H^2+sum_square_abs(q1(i,:)-w6(i,:))<=beta.*p6.*L6(i);

pm*beta.*inv_pos(m(i))+sigma<=I(i)%(1-3)

end

for i=1:1:N
qu1(i)=2*q1s(i,1)q1(i,1)-q1s(i,1)^2+J(i,1)^2-2J(i,1)q1(i,1)+2q1s(i,2)q1(i,2)-q1s(i,2)^2+J(i,2)^2-2J(i,2)*q1(i,2)+H^2;%一阶泰勒
end

m<=qu1;%1-4
m>=0;%(1-5)
q1(1, == [38,5];
q1(N, == [38,5];
for i = 1:1:N-1
norm(q1(i+1,:)-q1(i,:))<=vmax*delta;
end

cvx_end
q1s=q1;

optValueTrajectory(cntTra) = cvx_optval;
end
optvalue2(iterNum) = cvx_optval;
eachOptValue(eachIterNum) = cvx_optval;
eachIterNum = eachIterNum + 1;

end
CVX Warning:
Models involving “log” 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: 3000 variables, 1435 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

Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 1435
Cones : 720
Scalar variables : 3000
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.02
Lin. dep. - number : 0
Presolve terminated. Time: 0.03
Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 1435
Cones : 720
Scalar variables : 3000
Matrix variables : 0
Integer variables : 0

Optimizer - threads : 8
Optimizer - solved problem : the primal
Optimizer - Constraints : 1435
Optimizer - Cones : 720
Optimizer - Scalar variables : 3000 conic : 2160
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 : 4675 after factor : 7309
Factor - dense dim. : 18 flops : 6.69e+04
ITE PFEAS DFEAS GFEAS PRSTATUS POBJ DOBJ MU TIME
0 3.6e+00 3.5e+00 6.0e+02 0.00e+00 5.960436473e+02 0.000000000e+00 1.0e+00 0.06
1 1.1e+00 1.1e+00 1.1e+02 5.43e-01 2.043426300e+02 -1.082815965e+01 3.2e-01 0.14
2 2.7e-01 2.6e-01 5.0e+00 1.33e+00 2.643180252e+01 -1.124141109e+01 7.5e-02 0.14
3 7.0e-02 6.9e-02 6.7e-01 2.43e+00 3.902638075e+00 -9.988838799e-01 2.0e-02 0.14
4 2.6e-02 2.6e-02 1.6e-01 1.28e+00 3.217895718e+00 1.489610385e+00 7.4e-03 0.14
5 8.9e-03 8.7e-03 3.2e-02 1.01e+00 3.145271874e+00 2.548523874e+00 2.5e-03 0.16
6 3.5e-03 3.4e-03 7.9e-03 9.78e-01 3.110894235e+00 2.874120452e+00 9.8e-04 0.16
7 1.3e-03 1.3e-03 1.8e-03 9.93e-01 3.104266244e+00 3.015912248e+00 3.6e-04 0.16
8 2.8e-04 2.7e-04 1.7e-04 9.96e-01 3.108672010e+00 3.089828367e+00 7.8e-05 0.16
9 3.2e-05 3.1e-05 6.6e-06 9.97e-01 3.111754722e+00 3.109585480e+00 8.9e-06 0.17
10 4.4e-06 4.3e-06 3.4e-07 9.99e-01 3.112130422e+00 3.111831895e+00 1.2e-06 0.19
11 1.4e-06 1.3e-06 5.8e-08 1.00e+00 3.112173497e+00 3.112081119e+00 3.8e-07 0.19
12 1.5e-07 1.5e-07 2.1e-09 9.98e-01 3.112191291e+00 3.112181061e+00 4.2e-08 0.19
13 1.2e-07 9.4e-08 1.1e-09 1.00e+00 3.112192464e+00 3.112185883e+00 2.7e-08 0.19
14 1.0e-08 7.2e-09 2.3e-11 1.00e+00 3.112194325e+00 3.112193824e+00 2.0e-09 0.19
15 2.7e-08 3.2e-09 6.8e-12 1.00e+00 3.112194410e+00 3.112194187e+00 9.1e-10 0.20
16 3.8e-08 3.2e-09 6.7e-12 1.00e+00 3.112194411e+00 3.112194189e+00 9.1e-10 0.20
17 6.6e-08 1.9e-09 3.1e-12 1.00e+00 3.112194437e+00 3.112194304e+00 5.5e-10 0.22
18 6.8e-08 7.5e-10 7.7e-13 1.00e+00 3.112194463e+00 3.112194411e+00 2.1e-10 0.22
Optimizer terminated. Time: 0.25

Interior-point solution summary
Problem status : PRIMAL_AND_DUAL_FEASIBLE
Solution status : OPTIMAL
Primal. obj: 3.1121944633e+00 nrm: 4e+00 Viol. con: 3e-08 var: 2e-07 cones: 0e+00
Dual. obj: 3.1121944110e+00 nrm: 6e+00 Viol. con: 0e+00 var: 7e-12 cones: 0e+00
Optimizer summary
Optimizer - time: 0.25
Interior-point - iterations : 18 time: 0.22
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): +3.11219

## Calling Mosek 9.1.9: 90484 variables, 2158 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 62: The A matrix contains a large value of -6.7e+10 in constraint ‘’ (720) at variable ‘’ (2).
MOSEK warning 62: The A matrix contains a large value of -6.9e+10 in constraint ‘’ (721) at variable ‘’ (2).
MOSEK warning 62: The A matrix contains a large value of -7.0e+10 in constraint ‘’ (722) at variable ‘’ (2).
MOSEK warning 62: The A matrix contains a large value of -7.0e+10 in constraint ‘’ (723) at variable ‘’ (2).
MOSEK warning 62: The A matrix contains a large value of -6.9e+10 in constraint ‘’ (724) at variable ‘’ (2).
MOSEK warning 62: The A matrix contains a large value of -6.8e+10 in constraint ‘’ (725) at variable ‘’ (2).
MOSEK warning 62: The A matrix contains a large value of -6.6e+10 in constraint ‘’ (726) at variable ‘’ (2).
MOSEK warning 62: The A matrix contains a large value of -6.3e+10 in constraint ‘’ (727) at variable ‘’ (2).
MOSEK warning 62: The A matrix contains a large value of -6.0e+10 in constraint ‘’ (728) at variable ‘’ (2).
MOSEK warning 62: The A matrix contains a large value of -5.6e+10 in constraint ‘’ (729) at variable ‘’ (2).
Warning number 62 is disabled.
MOSEK warning 710: #120 (nearly) zero elements are specified in sparse col ‘’ (2) of matrix ‘A’.
MOSEK warning 710: #120 (nearly) zero elements are specified in sparse col ‘’ (3) of matrix ‘A’.
MOSEK warning 710: #120 (nearly) zero elements are specified in sparse col ‘’ (4) of matrix ‘A’.
MOSEK warning 710: #120 (nearly) zero elements are specified in sparse col ‘’ (5) of matrix ‘A’.
MOSEK warning 710: #120 (nearly) zero elements are specified in sparse col ‘’ (6) of matrix ‘A’.
MOSEK warning 710: #120 (nearly) zero elements are specified in sparse col ‘’ (7) of matrix ‘A’.
Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 2158
Cones : 959
Scalar variables : 90484
Matrix variables : 0
Integer variables : 0

Optimizer started.
Presolve started.
Eliminator - tries : 0 time : 0.00
Lin. dep. - tries : 0 time : 0.00
Lin. dep. - number : 0
Presolve terminated. Time: 0.00
Optimizer terminated. Time: 0.06

Interior-point solution summary
Problem status : DUAL_INFEASIBLE
Solution status : DUAL_INFEASIBLE_CER
Primal. obj: -9.4800000000e+04 nrm: 4e+02 Viol. con: 0e+00 var: 0e+00 cones: 0e+00
Optimizer summary
Optimizer - time: 0.06
Interior-point - iterations : 0 time: 0.03
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

Per my answer in the other thread:

On each iteration , the problems gets wilder, and at some iteration, the solver will fail to find an optimal solution, for one reason or another. Search this forum for my posts about the perils of “Successive Convex Approximation”.