Hi, Mark!
main func:
clear all
close all
para.Vmax = 25;
para.place_IOS = [0,0,40];
para.sigma2_dBm = -80;
para.M = 10000;
para.kappa = 3;
para.P = 0.1;
sigma2 = 10^(para.sigma2_dBm/10)/1000;
para.delta_z = 0.02;
para.delta_y = 0.02;
para.alpha = -2;
para.place_user = [-300, 100, 0];
para.UAV_start = [-400, 0, 80];
para.UAV_end = [400, 0, 80];
para.lambda = 0.05;
para.gamma_m = 1;
gamma0 = para.P/sigma2;
para.T=50;
G_m = 1;
G_tx = 1;
G_rx = 1;
gamma_m = 1;
B = (para.lambdasqrt(G_txG_mG_rxpara.delta_zpara.delta_y))/((4pi).^(3/2));
Cm = abs(para.place_IOS(1)-para.place_user(1)).^3/norm(para.place_IOS-para.place_user).^4;
D = sqrt((G_tx)*(G_rx));
z = ones(1,para.T)*80;
Y_half = linspace(para.place_IOS(2),para.place_user(2),para.T/2);
traj = zeros(para.T,2);
traj(:,1) = linspace(para.UAV_start(1),para.UAV_end(1),para.T);
traj(:,2) = [Y_half fliplr(Y_half)];
traj(:,3) = 80;
u0 = zeros(1, para.T);
v0 = zeros(1, para.T);
omega0=zeros(1,para.T);
s0=zeros(1,para.T);
A0=zeros(1,para.T);
Y0=zeros(1,para.T);
for i=1:para.T
v0(i) = 1/(norm(traj(i, - para.place_user)^(para.alpha/2));
s0(i)=abs(traj(i,1)^3);
end
for i = 1:para.T
u0(i) = norm(traj(i, - para.place_IOS)^4;
end
for i = 1:para.T
omega0(i)=s0(i)./u0(i);
end
for i = 1:para.T
A0(i)=para.MBCmomega0(i)+Dv0(i);
end
for i = 1:para.T
Y0(i)=A0(i).^2;
end
last = 0.1;
now = 1;
count = 0;
while (abs((now-last))/now>0.0001)
[traj, u0, v0, s0, omega0, A0,rate,Y]=opt_traj(para, u0, v0, s0, A0, omega0,traj);
mid = rate;
last = now;
now = mid;
if count>39
break
end
count = count+1;
end
function:function [ traj, u, v, s, A, omega, rate,Y] = opt_traj( para, u0, v0, s0, omega0, A0,traj0)
G_m=1;
G_tx=1;
G_rx=1;
sigma2 = 10^(para.sigma2_dBm/10)/1000;
gamma0 = para.P/sigma2;
B = para.lambdasqrt(G_txG_mG_rxpara.delta_zpara.delta_y)/((4pi)^(3/2));
Cm = abs(para.place_IOS(1)-para.place_user(1))^3/norm(para.place_IOS-para.place_user)^4;
D = sqrt((G_tx)*(G_rx));
cvx_solver Mosek
cvx_begin
variable traj(para.T+1, 2)
variable u(1, para.T) nonnegative
variable v(1, para.T) nonnegative
variable s(1, para.T) nonnegative
variable A(1, para.T) nonnegative
variable Y(1, para.T) nonnegative
variable omega(1, para.T) nonnegative
expression avg_rate(1,para.T)
for ii=1:para.T
avg_rate(ii)=log(1+gamma0*Y(ii))/log(2);
end
maximize(sum(avg_rate)/para.T);
subject to
2560000 <= u;
v<=(1/(80^(para.alpha/2)));
for ii=1:para.T
s(ii)<=abs(traj0(ii,1)^3)+(3*(traj0(ii,1)^5)./abs(traj0(ii,1)^3))*(traj(ii,1)-traj0(ii,1));
end
for ii=1:para.T
A0(ii)<= para.M*B*Cm*omega(ii)+D*v(ii);
end
for ii=1:para.T
Y(ii)<=A0(ii).^2+2*A0*(A(ii)-A0(ii));
end
for ii=1:para.T
pow_pos(norm(traj(ii,:)-para.place_IOS(1:2)),2)+1600<=u(ii)^(1/2);
end
for ii=1:para.T
log(omega0(ii))+(1/omega0(ii))*(omega(ii)-omega0(ii))...
<= log(s(ii))-log(u0(ii))-1/u0(ii)*(u(ii)-u0(ii));
end
for ii=1:para.T
pow_pos(norm(traj(ii, :)-para.place_user(1:2)),2)...
+6400-(1+4/para.alpha)*v0(ii)^(-4/para.alpha)+...
(4/para.alpha)*(v0(ii)^(-4/para.alpha-1))*v(ii)<=0;
end
for ii=1:para.T
pow_pos(norm(traj(ii+1,:)-traj(ii, :)),2)<=para.Vmax^2;
end
traj(1, :)==para.UAV_start(1:2);
traj(para.T+1, :)==para.UAV_end(1:2);
cvx_end
addition = ones(para.T+1,1)*80;
traj = [traj,addition];
rate=sum(avg_rate)/para.T;
end
problem: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: 3551 variables, 1099 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 ‘’ (251) of matrix ‘A’.
MOSEK warning 710: #1 (nearly) zero elements are specified in sparse col ‘’ (252) of matrix ‘A’.
MOSEK warning 710: #1 (nearly) zero elements are specified in sparse col ‘’ (253) of matrix ‘A’.
MOSEK warning 710: #1 (nearly) zero elements are specified in sparse col ‘’ (254) of matrix ‘A’.
MOSEK warning 710: #1 (nearly) zero elements are specified in sparse col ‘’ (255) of matrix ‘A’.
MOSEK warning 710: #1 (nearly) zero elements are specified in sparse col ‘’ (256) of matrix ‘A’.
MOSEK warning 710: #1 (nearly) zero elements are specified in sparse col ‘’ (288) of matrix ‘A’.
MOSEK warning 710: #1 (nearly) zero elements are specified in sparse col ‘’ (289) of matrix ‘A’.
MOSEK warning 710: #1 (nearly) zero elements are specified in sparse col ‘’ (290) of matrix ‘A’.
MOSEK warning 710: #1 (nearly) zero elements are specified in sparse col ‘’ (291) of matrix ‘A’.
Warning number 710 is disabled.
MOSEK warning 57: A large value of -1.3e+08 has been specified in c for variable ‘’ (101).
MOSEK warning 57: A large value of -1.1e+08 has been specified in c for variable ‘’ (102).
MOSEK warning 57: A large value of -1.1e+08 has been specified in c for variable ‘’ (149).
MOSEK warning 57: A large value of -1.3e+08 has been specified in c for variable ‘’ (150).
Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 1099
Cones : 450
Scalar variables : 3551
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.02
Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 1099
Cones : 450
Scalar variables : 3551
Matrix variables : 0
Integer variables : 0
Optimizer - threads : 6
Optimizer - solved problem : the primal
Optimizer - Constraints : 479
Optimizer - Cones : 450
Optimizer - Scalar variables : 1679 conic : 1348
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 : 1472 after factor : 1614
Factor - dense dim. : 0 flops : 1.53e+04
ITE PFEAS DFEAS GFEAS PRSTATUS POBJ DOBJ MU TIME
0 2.3e+00 1.3e+08 5.6e+08 0.00e+00 -5.645702070e+08 -1.161516665e+00 1.0e+00 0.02
Optimizer terminated. Time: 0.03
Interior-point solution summary
Problem status : DUAL_INFEASIBLE
Solution status : DUAL_INFEASIBLE_CER
Primal. obj: -5.6457020698e+08 nrm: 5e+09 Viol. con: 7e+08 var: 5e+09 cones: 0e+00
Optimizer summary
Optimizer - time: 0.03
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
Dear Mark
My problem is still unsolvable. My teacher told me that the original problem can be solved as convex functions and convex constraints. My teacher said that my code was wrong, but after many times of checking my code was correct, but I just couldn’t solve it. I used Matlab’s global optimization function to work out the answer. You asked me to check my errors with Yalmip earlier. But I still have some doubts. I can’t solve this problem is the data problem or the problem itself can’t be solved? Because I have used global optimization to solve the answer, but the pattern search function is actually to find the upper bound.But I want to use CVX to solve for the lower bound. What shall I do next?