Status: Inaccurate/Unbounded Optimal value (cvx_optval): +Inf

Status: Inaccurate/Unbounded
Optimal value (cvx_optval): +Inf

Dear Mark,the follow is my code,I don’t know the reasons about the error.
thanks.

clc; clear all;
%cvx_solver sdpt3
cvx_solver sedumi
H=50; %% height
V=10; %% speed
noise_pw = 10^(-14); %% -170dBm/hz 1 MHz, noise power: -110dBm
reference = 10^(-6); %% channel power at reference distance
gamma=10^8;
ur0=[155;250]; %无人机R初始位置
urN=[155;-250];
uj0=[145;250]; %无人机J初始位置
ujN=[145;-250];

xs=[0;0]; %就是 S 的坐标
xe=[125;-50]; %窃听者 E 的坐标
xd=[300;0]; %就是 D 的坐标
inl=0;
N=61; % T=60s, dt=1s;
i=1:N;
Qr_r=zeros(2,N);
Qr_r=[ur0(1).ones(1,N);ur0(2)+(urN(2)-ur0(2))/(N-1).(i-1)]; %%无人机s初始轨迹

Qj_r=zeros(2,N);
Qj_r=[uj0(1).ones(1,N);uj0(2)+(ujN(2)-uj0(2))/(N-1).(i-1)]; %%无人机j初始轨迹

Ps=1;
avg_Pr=10^(1)/1000;
avg_Pj=10^(1)/1000; %%%%%平均功率

Pr_r=avg_Prones(1,N);
Pj_r=avg_Pj
ones(1,N);

Pr_max=4avg_Pr; %%%最大功率
Pj_max=4
avg_Pj;

dt=1; %每个时隙

BisecConvergenceThreshold = 10^(-4); %收敛阈值

figure
plot(ur0(1),ur0(2),‘k±’, ‘LineWidth’,2,‘MarkerSize’,10);
hold on;
plot(urN(1),urN(2),‘kx-’, ‘LineWidth’,2,‘MarkerSize’,10);
hold on;
plot(uj0(1),uj0(2),‘k±’, ‘LineWidth’,2,‘MarkerSize’,10);
hold on;
plot(ujN(1),ujN(2),‘kx-’, ‘LineWidth’,2,‘MarkerSize’,10);
hold on;
plot(xs(1),xs(2),‘ko-’, ‘LineWidth’,2,‘MarkerSize’,15);
hold on;
plot(xe(1),xe(2),‘ks-’, ‘LineWidth’,2,‘MarkerSize’,15);
hold on;
plot(xd(1),xd(2),‘kp-’, ‘LineWidth’,2,‘MarkerSize’,15);
hold on;
xlim([-50,350]);%对X轴设定显示范围
ylim([-300,300]);%对Y轴设定显示范围
hold on;
plot(Qr_r(1,1:2:N),Qr_r(2,1:2:N),’>-’,‘LineWidth’,1.5,‘MarkerSize’,5);
hold on;
plot(Qj_r(1,1:2:N),Qj_r(2,1:2:N),’>-’,‘LineWidth’,1.5,‘MarkerSize’,5);
hold on;
%Q_r=Qr_r;
%Qj_r=zeros(2,N);
for i=1:N
en(i) = gamma.*Pr_r(i)./(H^2+norm(Qr_r(:,i)-xe).^2);
cn(i) = gamma.*Pr_r(i)./(H^2+norm(Qr_r(:,i)-xd).^2);
S_r(i)=H^2+norm(Qj_r(:,i)-xd).^2;
V_r(i)=H^2+norm(Qj_r(:,i)-Qr_r(:,i)).^2;
%V_r(i)=H^2+pow_pos(norm(Qj_r(:,i)-Qr_r(:,i)),2);
b2(i)=gamma.*Pj_r(i);
% RD_r(i)=log(1+cn(i)-cn(i).*b2(i).*inv_pos(S_r(:,i)+b2(i)));
%RD_r(i)=log(1+cn(i)-cn(i).*b2(i)./(H^2+norm(Qj_r(:,i)-xd).^2+b2(i)));
RD_r(i)=log(1+cn(i)-cn(i).b2(i).inv_pos(H^2+norm(Qj_r(:,i)-xd).^2+b2(i)));
u_r(i)=H^2+norm(Qj_r(:,i)-xe).^2;
%L(i)=Ps
gamma./power(H^2+norm(Qr_r(:,i)-xs(:,1),2));
L(i)=Ps
gamma./(H^2+norm(Qr_r(:,i)-xs).^2);
end

for i=1:3

cvx_begin
variable Qj(2,N)
variable S(1,N)
variable V(1,N)
variable u(1,N)
variable RD(1,N)

expression W_r(1,N)     %%不用这些表达式,直接写出来

expression Z_r(1,N)
%expression u_r(1,N)
%expression u(1,N)

% expression L(1,N)
% expression k(1,N)
expression rate1(1,N)

% for i=1:N
      
  %u_r=H^2+norm(Qj(:,i)-xe);
  %L(i)=Ps.*inv_pos(H^2+norm(Qr_r(:,i)-xs,2));
  %u(i)=H^2+norm((Qj(:,i)-xe),2);
 % u(i)=H^2+norm(Qj_r(:,i)-xe).^2;
 %b2(i)=gamma.*Pj_r(i);
 %end

 for i=1:N
   %W_r(i)=en(i).*gamma.*Pj_r(:,i).*inv_pos((u_r(i)+gamma.*Pj_r(:,i)).*((en(i)+1).*u_r(i)+gamma.*Pj_r(:,i)));
   %W_r(i)=en(i).*gamma.*Pj_r(:,i)./((u_r(i)+gamma.*Pj_r(:,i))*((en(i)+1).*u_r(i)+gamma.*Pj_r(:,i)));
  % W_r(i)=en(i).*b2(i).*inv_pos(b2(i) + u(:,i)).*inv_pos(b2(i)+(en(i)+1).*u(:,i));
  W_r(i)=en(i).*b2(i)./(b2(i)+u_r(i))./(b2(i)+(en(i)+1).*u_r(i));
   % RD(i)=log(1+cn(i)-cn(i).*b2(i).*inv_pos(S(i)+b2(i)));
 
 end
 

 %for i=1:N  
   %Z_r(i)=power(norm(Qj_r(:,i)),2)-2*(Qj_r(:,i)-Q_r(:,i))'*Qj(:,i)-power(norm(Q_r(:,i)),2); 
 %end

% for i=1:N
% W_r(i)=-en(i).*b2(i).*inv_pos(b2(i)+u_r(:,i)).*inv_pos(b2(i)+(en(i)+1).*u_r(:,i));
% end
% for i=1:N
% rate1(i)=W_r(i).*u(:,i) + log(1+cn(i)-cn(i).*b2(i).*inv_pos(S(:,i)+b2(i)));
%
% end

 for i=1:N
     %rate1(i)=RD(i)-W_r(i).*(H^2+pow_pos(norm(Qj(:,i)-xe),2));   %%这里的u直接用表达式替代
     rate1(i)=RD(i)-W_r(i).*u(i);
 end
 maximize sum(rate1(:,1:N))
 subject to
 
 for i=1:N
 pow_pos(norm(Qj(:,i)-xd(:,1)),2)+power(norm(Qj_r(:,i)),2)-2*(Qj_r(:,i)-xd(:,1))'*Qj(:,i)-power(norm(xd(:,1)),2)-H^2<=0;   %%17b
 end
 
 for i=1:N
 H^2+pow_pos(norm(Qj(:,i)-Qr_r(:,i)),2)+power(norm(Qj_r(:,i)),2)-2*(Qj_r(:,i)-Qr_r(:,i))'*Qj(:,i)-power(norm(Qr_r(:,i)),2)-H^2<=0;   %17c有错   把 V换掉 H^2+pow_pos(norm(Qj_r(:,i)-Qr_r(:,i)),2);
 end                                                      %Z_r也换掉
   
for i=1:N
     H^2+pow_pos(norm(Qj(:,i)-xe),2)-u(i)<=0;  %%15c有错

% H^2+pow_pos(norm(Qj(:,i)-xe),2)-(H^2+pow_pos(norm(Qj(:,i)-xe(:,1)),2))<=0;%15c有错 已修改,但是u(i)带进去一样
end

   for n=2:N
   %sum(RD(:,2:n))-sum(log(1+L(:,1:n)-L(:,1:n).*b2(:,1:n).*inv_pos(b2(:,1:n)+(H^2+pow_pos(norm(Qj(:,1:n)-Qr_r(:,1:n)),2)))))<=0;   %%15e有错   
   %sum(RD(:,2:n))-sum(log(1+L(:,1:n)-L(:,1:n).*b2(:,1:n).*inv_pos(b2(:,1:n)+(H^2+norm(Qj(:,i)-Qr_r(:,i)).^2))))<=0; 
    sum(RD(:,2:n))-sum(log(1+L(:,1:n)-L(:,1:n).*b2(:,i).*inv_pos(b2(:,i)+V(:,1:n))))<=0; 
   end                                    %(H^2+pow_pos(norm(Qj(:,i)-Qr_r(:,1)),2))换掉v
   
   for i=2:N
   %RD(:,i)-log(1+L(:,i)-L(:,i).*b2(i).*inv_pos(b2(i)+(H^2+pow_pos(norm(Qj(:,i)-xd(:,1)),2))))<=0;   %%%15f有错
   RD(:,i)-log(1+L(:,i)-L(:,i).*b2(i).*inv_pos(b2(i)+S(i)))<=0; 
   end                                          %(H^2+pow_pos(norm(Qj(:,i)-xd(:,1)),2))换掉s
   
   for i=1:N-1  %%(4-1=3  四个位置,三段距离)
   norm(Qj(:,i+1)-Qj(:,i)) <= V*60/N;
   end
   0<=S;
   0<=V;
   0<=RD;
   0<=u;
    Qj(:,1) == uj0;
    Qj(:,N) == ujN;
   cvx_end  
   
   A1(i)=cvx_optval;
   
   Qj_r=Qj;  
   S_r=S;
   V_r=V;
   RD_r=RD;
   u_r=u;

% Es=sum(rate1);
% gap=Es-inl;
% if abs(gap)<=BisecConvergenceThreshold
% disp(’%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%’)
% disp(’%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%’)
% break
% end
%
% inl=Es;
% plot(Qj_r(1,:),Qj_r(2,:));
% hold on;
end
for jj=1:N
Rd(jj)=log2(1+gamma.*Ps(jj)./(H^2+norm(Qr_r(:,jj)-xs).^2)./(gamma.*Pj_r(jj)./(H^2+norm(Qj_r(:,jj)-xs).^2)+1))-log2(1+gamma.*Ps(jj)./(H^2+norm(Qr_r(:,jj)-xe).^2)./(gamma.*Pj_r(jj)./(H^2+norm(Qj_r(:,jj)-xe).^2)+1));
end

for jj=1:N
Rd(jj) = max (Rd(jj),0);
end

Re=sum(Rd)/N
save Qj V S RD u
figure
plot(ur0(1),ur0(2),‘k±’, ‘LineWidth’,2,‘MarkerSize’,10);
hold on;
plot(urN(1),urN(2),‘kx-’, ‘LineWidth’,2,‘MarkerSize’,10);
hold on;
plot(uj0(1),uj0(2),‘k±’, ‘LineWidth’,2,‘MarkerSize’,10);
hold on;
plot(ujN(1),ujN(2),‘kx-’, ‘LineWidth’,2,‘MarkerSize’,10);
hold on;
plot(xs(1),xs(2),‘ko-’, ‘LineWidth’,2,‘MarkerSize’,15);
hold on;
plot(xe(1),xe(2),‘ks-’, ‘LineWidth’,2,‘MarkerSize’,15);
hold on;
plot(xd(1),xd(2),‘kp-’, ‘LineWidth’,2,‘MarkerSize’,15);
hold on;
xlim([-50,350]);%对X轴设定显示范围
ylim([-300,300]);%对Y轴设定显示范围
hold on;
plot(Qr_r(1,1:2:N),Qr_r(2,1:2:N),’>-’,‘LineWidth’,1.5,‘MarkerSize’,5);
hold on;
plot(Qj_r(1,1:2:N),Qj_r(2,1:2:N),’>-’,‘LineWidth’,1.5,‘MarkerSize’,5);
hold on;

First, follow the advice at CVXQUAD: How to use CVXQUAD's Pade Approximant instead of CVX's unreliable Successive Approximation for GP mode, log, exp, entr, rel_entr, kl_div, log_det, det_rootn, exponential cone. CVXQUAD's Quantum (Matrix) Entropy & Matrix Log related functions .

Second, followthe advice at https://yalmip.github.io/debuggingunbounded/

1 Like

hello everyone , I have the same problem. Status: Unbounded
Optimal value (cvx_optval): +Inf. I don’t know the reasons about the error.

I have looked at the relevant processing methods of the forum, and it seems that there is no solution. Can you help me? Thank you very much

Did you follow the advice at https://yalmip.github.io/debuggingunbounded/ ?

Without seeing your problem, there is no additional help forum readers can provide.

Dear mark, this is my problem , thank you !

Mosek warned you about numerically large values in the input data.Did you try to improve the scaling (unit selection for variables) of the problem? Do that first.Then, if the problem is still reported as unbounded, follow the advice at https://yalmip.github.io/debuggingunbounded/ , as I suggested in my previous post.

Thank you very much ,your advice is very helpful to me

How did you solve this problem please?

Hi,Mark. Do you have a new link? The previous link https://yalmip.github.io/debuggingunbounded/ has expired.

It doesn’t seem to like
/
at the end if the URL anymore. So remove it.