The status failed but still got the result


(seven) #1

When I run my code,a cvx showed the status is failed (other cvx is solved),but i can got the result when the whole code ended.
And after running in the cvx, it shows:
the UAV1 trajectory 1

Successive approximation method to be employed.
** For imoved efficiency, SDPT3 is solving the dual problem.
** SDPT3 will be called several times to refine the solution.**
** Original size: 15749 variables, 1331 equality constraints**
** 124 exponentials add 992 variables, 620 equality constraints**
-----------------------------------------------------------------
** Cones | Errors |**
Mov/Act | Centering Exp cone Poly cone | Status
--------±--------------------------------±--------strong text
** 97/ 97 | 8.000e+00 6.123e+00 0.000e+00 | Unbounded

** 0/ 0 | 0.000e+00 0.000e+00 0.000e+00 | Failed

** 0/ 0 | 0.000e+00 0.000e+00 0.000e+00 | Failed**
** 0/ 0 | 0.000e+00 0.000e+00 0.000e+00 | Failed**
-----------------------------------------------------------------
Status: Failed
Optimal value (cvx_optval): NaN

And i change the value of N, it will be wrong in the whole cvx.

Thanks a lot!


Using SDPT3 is not feasible, the result can be obtained using the sedumi parser, but the optimization result does not correspond to the value of the optimization variable
(Mark L. Stone) #2

You should install CVXQUAD, including its exponential.m. replacement, as described in my answer at Failed status and optimal value NAN in convex problem .

Depending on your program, you may need to make modifications in order for CVXQUAD’s Pade approximation to be used instead of CVX’s successive approximation method. If there are instances of log(X) in CVX expressions, replace them with the equivalent-rel_entr(1,X) . If the successive approximation method is still used, show us your code so that we can suggest further modifications in order for CVXQUAD’s Pade approximation to be used instead.


(seven) #3

The code is as following :

%%%%%%%%%轨迹优化%%%%%%%%%%%%%%%%%%%%%%
disp(['the UAV1 trajectory ',num2str(ll)]);

Zk=zeros(K,N);

cvx_begin
variable Zk(K,N)
variable Q(2,N)
variable t_traj
variable Cj3(K,N)
expression rate3(K,N)
expression temp3_i(K,N)
expression temp3_j(K,N)

for n=1:N
a3(n)=gamma.*Ps_r(n).*alpha1_r(n);
b3(n)=gamma.Ps_r(n).(1-alpha1_r(n));

 for k=1:K
   Zk_r(k,n)=H^2+norm(Q_r(:,n)-W_locat(:,k)).^2;
 
 end

end

for i=1:K     
    q1(i,:)=log(1+a3./Zk_r(i,:));
    q2(i,:)=-a3./Zk_r(i,:)./(Zk_r(i,:)+a3);
    temp3_i(i,:)=q1(i,:)+q2(i,:).*(Zk(i,:))-q2(i,:).*(Zk_r(i,:));
 % temp3_i(i,:)=log(1+a3.*inv_pos(Zk_r(i,:)))-a3.*Zk(i,:)./Zk_r(i,:)./(Zk_r(i,:)+a3)+a3./(Zk_r(i,:)+a3);
end

  for j=1:K
 
  temp3_j(j,:)=-1*log(1-a3.*inv_pos(Zk(j,:)+b3+a3));%%%%转换得到
  end


 rate3=temp3_i-Cj3;
     

    
   maximize ( t_traj )
   %%%%%%%%%轨迹约束%%%%%%%%%%%%%%
   subject to
   
   for n = 1: N-1  %%(4-1=3  四个位置,三段距离)
       norm( Q(:,n+1) - Q(:,n) ) <= V*dt;  %% 任何两个前后时隙之间的距离差小于速度的值。 N-1个约束。
   end
   
  Q(:,1) == Q(:,N);   %%  初始点等于终点

%%% max-min data rate constraints max-min 最小速率约束   

   sum(assignment1.*rate3,2)>=t_traj;

   
    for n=1:N
   for i=1:K
for j=1:K
    if j~=i

temp3_j(j,n)<=Cj3(i,n);
end
end
end
end

    0<=t_traj;

    for n=1:N  
       for i=1:K
           for j=1:K
               if j~=i

Q(1,n)^2-2*W_locat(1,i)Q(1,n)+W_locat(1,i)^2+Q(2,n)^2-2W_locat(2,i)Q(2,n)+W_locat(2,i)^2+H^2-Zk(i,n)<=0;
Zk(j,n)+Q_r(1,n)^2-2
Q_r(1,n)Q(1,n)+2W_locat(1,j)Q(1,n)-W_locat(1,j)^2+Q_r(2,n)^2-2Q_r(2,n)Q(2,n)+2W_locat(2,j)*Q(2,n)-W_locat(2,j)^2-H^2<=0;

     0<=Zk(j,:);
           end
      end
       end
    end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
cvx_end

Q_r=Q;

This is one of the cvx .The status is failed in the cvx.


(Mark L. Stone) #4

Do as I suggested, and install CVXQUAD, its exponential.m replacement, and change occurrences of log(X) to-rel_entr(1,X) . Then show the output of running that.


(ly) #5

Hello, did you solve it now ,I trapped in the same problem now