Root relaxation: unbounded when I use cvx with gurobi

hello, the control screen shows " root relaxation" when I use cvx with gurobi to solve the MIP. The related code is as follows. It works well at iteration k=1. But the " root relaxation: unbounded" will occur, and the code will keep busy and stop running down when it runs to “cvx_end” of the agent4 at iteration k=2. I’m confused because I checked no variables without bound. I feel strange that what results in the situation. In addition, I want to know how to use “log” function, because I meet “Gurobi can not support the exponential cone” . If it cannot use “log” actually, how I should solve the problem.
Thanks for your generous help and answer.
for k = 1:MAX_ITER
%Agent 1
% x-update
cvx_begin
variable x_1(nm)
% minimize((x_1+3
Pess_max*(1-soc)G)'A(x_1+3Pess_max*(1-soc)G)+B4’(x_1+3Pess_max(1-soc)G) -1/t(log(-lower1(1)16+H1x_1)+ log(upper1(1)16-H1x_1))+ (lambda(:,1)-lambda(:,14))‘x_1…
% +(lambda(:,2)-lambda(:,3))'x_1+rho sum_square_abs(X(:,7)- x_1)+rho
sum_square_abs(X(:,2)- x_1))
obj1=x_1’A1x_1+B1’*x_1;
for i=1:24
cs1=log(-lower1(1)+H1(i,:)*x_1)+ log(Upper1(1)-H1(i,:slight_smile:x_1);
obj1=obj1+cs1
(-1/t);
end

      obj2=0;
      for j=1:23
       rate1=M1*x_1;
       cs2=log(-r1L(1)+rate1(j,:))+ log(r1U(1)-rate1(j,:));
       obj2=obj2+cs2*(-1/t);
      end
          
      minimize(obj1+obj2+ (lambda(:,1)-lambda(:,10))'*x_1+(lambda(:,2)-lambda(:,3))'*x_1+...
      rho* sum_square_abs(X(:,5)- x_1)+rho* sum_square_abs(X(:,2)- x_1))
   
    cvx_end 
    disp(x_1);
    
 %lambda-update
  X_new(:,1) = x_1;
  
  lambda(:,1) = lambda(:,1) -rho*(X(:,5)-X_new(:,1));
  lambda(:,2) = lambda(:,2) -rho*(X(:,2)-X_new(:,1));

  lambda_result1(n*m*(k-1)+1:n*m*k,1)=lambda(:,1);
  lambda_result1(n*m*(k-1)+1:n*m*k,2)=lambda(:,2);
 
  
%Agent 2
% x-update
    cvx_begin
       variable x_2(n*m)

% minimize((x_2+3Pess_max(1-soc)G)'A(x_2+3Pess_max*(1-soc)G)+B4’(x_2+3Pess_max(1-soc)G)-1/t(log(-lower2(2)16+H2x_2) + log(upper2(2)16-H2x_2)) +(lambda(:,3)-lambda(:,2))‘x_2…
% +(lambda(:,4)-lambda(:,5))'x_2+rho sum_square_abs(X(:,1)- x_2)+rho
sum_square_abs(X(:,3)- x_2))
obj1=x_2’A2x_2+B2’*x_2;
for i=25:48
cs1=log(-lower2(1)+H2(i,:)*x_2)+ log(Upper2(1)-H2(i,:slight_smile:x_2);
obj1=obj1+cs1
(-1/t);
end

      obj2=0;
      for j=1:23
       rate2=M2*x_2;
       cs2=log(-r2L(1)+rate2(j,:))+ log(r2U(1)-rate2(j,:));
       obj2=obj2+cs2*(-1/t);
      end
      
    minimize(obj1+obj2 +(lambda(:,3)-lambda(:,2))'*x_2+(lambda(:,4)-lambda(:,5))'*x_2+...
    rho* sum_square_abs(X(:,1)- x_2)+rho* sum_square_abs(X(:,3)- x_2))
    cvx_end

disp(x_2);

 %lambda-update
  X_new(:,2) = x_2;
  lambda(:,3) = lambda(:,3) -rho*(X(:,1)-X_new(:,2));
  lambda(:,4) = lambda(:,4) -rho*(X(:,3)-X_new(:,2));

  lambda_result1(n*m*(k-1)+1:n*m*k,3)=lambda(:,3);
  lambda_result1(n*m*(k-1)+1:n*m*k,4)=lambda(:,4);
 
%Agent 3
% x-update
    cvx_begin
       variable x_3(n*m)
      obj1=x_3'*A3*x_3+B3'*x_3;
      for i=49:72
       cs1=log(-lower3(1)+H3(i,:)*x_3)+ log(Upper3(1)-H3(i,:)*x_3);
       obj1=obj1+cs1*(-1/t);
      end
      
      obj2=0;
      for j=1:23
       rate3=M3*x_3;
       cs2=log(-r3L(1)+rate3(j,:))+ log(r3U(1)-rate3(j,:));
       obj2=obj2+cs2*(-1/t);
      end
      
    minimize(obj1+obj2 +(lambda(:,5)-lambda(:,4))'*x_3+(lambda(:,6)-lambda(:,7))'*x_3+...
    rho* sum_square_abs(X(:,2)- x_3)+rho* sum_square_abs(X(:,4)- x_3))
    cvx_end

disp(x_3);

 %lambda-update
  X_new(:,3) = x_3;
  lambda(:,5) = lambda(:,5) -rho*(X(:,2)-X_new(:,3));
  lambda(:,6) = lambda(:,6) -rho*(X(:,4)-X_new(:,3));

  lambda_result1(n*m*(k-1)+1:n*m*k,5)=lambda(:,5);
  lambda_result1(n*m*(k-1)+1:n*m*k,6)=lambda(:,6);
  
**%Agent 4**

** % x-update**
** cvx_begin**
** cvx_solver Gurobi_2**
** variable xx(1,m) binary**
** variable yy(1,m) binary**
** variables x_41(nm) x_42(nm) x_4(n*m)**
** variables z1(1,m) z2(1,m)**

** obj3=z1ones(m,1)+z2ones(m,1);**
** minimize(obj3+(lambda(:,7)-lambda(:,6))'x_4…*
** +(lambda(:,8)-lambda(:,9))'x_4+rho sum_square_abs(X(:,3)- x_4)+rho* sum_square_abs(X(:,5)- x_4))**


** subject to **
** for i=1:24**
** z1(i)<=xx(i)Upper4(1);*
** z1(i)<=x_41(72+i);**
** z1(i)>=x_41(72+i)-(1-xx(i))Upper4(1)*
** 0<=z1(i)<=Upper4(1);**
** lower4(1)<=x_41(72+i)<=Upper4(1);**


** z2(i)<=yy(i)Upper4(1);*
** z2(i)<=x_42(72+i);**
** z2(i)>=x_42(72+i)-(1-yy(i))Upper4(1)*
** 0<=z2(i)<=Upper4(1);**
** lower4(1)<=x_42(72+i)<=Upper4(1); **
-M(1-xx(i))<=x_4(72+i)-x_41(72+i)<=M(1-xx(i));**
-M(1-yy(i))<=x_4(72+i)+x_42(72+i)<=M(1-yy(i));**
** xx(i)+yy(i)==1;**
** end**
** cvx_end**
disp(x_4);

 %lambda-update
  X_new(:,4) = x_4;
  lambda(:,7) = lambda(:,7) -rho*(X(:,3)-X_new(:,4));
  lambda(:,8) = lambda(:,8) -rho*(X(:,5)-X_new(:,4));

  lambda_result1(n*m*(k-1)+1:n*m*k,7)=lambda(:,7);
  lambda_result1(n*m*(k-1)+1:n*m*k,8)=lambda(:,8);
                    
%Agent 5
% x-update
    cvx_begin
       variable x_5(n*m)

F1=x_5(1,:)+x_5(24+1,:)+x_5(224+1,:)+x_5(324+1,:);F6=x_5(6,:)+x_5(24+6,:)+x_5(224+6,:)+x_5(324+6,:);
F2=x_5(2,:)+x_5(24+2,:)+x_5(224+2,:)+x_5(324+2,:);F7=x_5(7,:)+x_5(24+7,:)+x_5(224+7,:)+x_5(324+7,:);
F3=x_5(3,:)+x_5(24+3,:)+x_5(224+3,:)+x_5(324+3,:);F8=x_5(8,:)+x_5(24+8,:)+x_5(224+8,:)+x_5(324+8,:);
F4=x_5(4,:)+x_5(24+4,:)+x_5(224+4,:)+x_5(324+4,:);F9=x_5(9,:)+x_5(24+9,:)+x_5(224+9,:)+x_5(324+9,:);
F5=x_5(5,:)+x_5(24+5,:)+x_5(224+5,:)+x_5(324+5,:);F10=x_5(10,:)+x_5(24+10,:)+x_5(224+10,:)+x_5(324+10,:);
F11=x_5(11,:)+x_5(24+11,:)+x_5(224+11,:)+x_5(324+11,:);F16=x_5(16,:)+x_5(24+16,:)+x_5(224+16,:)+x_5(324+16,:);
F12=x_5(12,:)+x_5(24+12,:)+x_5(224+12,:)+x_5(324+12,:);F17=x_5(17,:)+x_5(24+17,:)+x_5(224+17,:)+x_5(324+17,:);
F13=x_5(13,:)+x_5(24+13,:)+x_5(224+13,:)+x_5(324+13,:);F18=x_5(18,:)+x_5(24+18,:)+x_5(224+18,:)+x_5(324+18,:);
F14=x_5(14,:)+x_5(24+14,:)+x_5(224+14,:)+x_5(324+14,:);F19=x_5(19,:)+x_5(24+19,:)+x_5(224+19,:)+x_5(324+19,:);
F15=x_5(15,:)+x_5(24+15,:)+x_5(224+15,:)+x_5(324+15,:);F20=x_5(20,:)+x_5(24+20,:)+x_5(224+20,:)+x_5(324+20,:);
F21=x_5(21,:)+x_5(24+21,:)+x_5(224+21,:)+x_5(324+21,:);F23=x_5(23,:)+x_5(24+23,:)+x_5(224+23,:)+x_5(324+23,:);
F22=x_5(22,:)+x_5(24+22,:)+x_5(224+22,:)+x_5(324+22,:);F24=x_5(24,:)+x_5(24+24,:)+x_5(224+24,:)+x_5(324+24,:);
FF=[F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,F13,F14,F15,F16,F17,F18,F19,F20,F21,F22,F23,F24];
minimize(v*sum_square_abs(FF-Dd)+(lambda(:,9)-lambda(:,8))'x_5…
+(lambda(:,10)-lambda(:,1))'x_5+rho sum_square_abs(X(:,4)- x_5)+rho
sum_square_abs(X(:,1)- x_5))
cvx_end
disp(x_5);

 %lambda-update 
  X_new(:,5) = x_5;
  lambda(:,9) = lambda(:,9) -rho*(X(:,4)-X_new(:,5));
  lambda(:,10) = lambda(:,10) -rho*(X(:,1)-X_new(:,5));

  lambda_result1(n*m*(k-1)+1:n*m*k,9)=lambda(:,9);
  lambda_result1(n*m*(k-1)+1:n*m*k,10)=lambda(:,10);
  

 
 X = X_new;

for i = 1:n+1
X_result1(nm(k-1)+1:nmk,i) = X(:,i);
end
end

Try using Mosek, if available to you. And please post clean, readable code, which can be copied and pasted into forum reader’s own MATLAB session, without deleting ** and other things. Also show solver and CVX output, with clear correspondence to what CVX code it is the output of.

Hello, I recopy my code clearly. Please help me.

clear all;
close all;
clc;
n=4;m=24;
e_abs = 1e-4;e_rel = 1e-4; MAX_ITER = 500;%迭代次数
t =0.01;nu = 2; v=100;rho = 0.01;%change
MM=60;M=70;
%存储量
X = zeros(nm,n+1);
X_new = zeros(n
m,n+1);X_ess= zeros(MAX_ITER,n+1);lambda = zeros(nm,2(n+1));
h=ones(m,1);h1=zeros(m,1);
PV=[0, 0, 0, 0, 0, 0, 0, 37.46, 51.45, 56.01,58.06,85, 93, 82.98,51.59,29.70, 20.92, 0, 0, 0, 0, 0, 0, 0];
WT=[46.54,41.27,60.5,35,45, 54, 50, 45, 45.5, 40, 35, 0, 5, 4, 3, 6, 44.5, 48.04,40.5, 36.02,45.5,42.42, 44, 45.5];
d=[120.5,120, 150, 110, 130,131,130, 150.2, 280, 320.5,340,350.4,366.6,341.5, 240.2,220.6, 320.6,302.4,320.7, 208,180, 146.2, 119.6,105.3];
PW=PV+WT;Dd=d-PW;
a1=0.02h;a2=0.0175h;a3=0.0625h;a4=0.01h;
a=[a1;a2;a3];A=diag(a);
A1=diag([a1;h1;h1;h1]); A2=diag([h1;a2;h1;h1]);A3=diag([h1;h1;a3;h1]);A4=diag([h1;h1;h1;a4]);
a5=2h;a6=1.75h;a7=1h;
B1=[a5;h1;h1;h1];B2=[h1;a6;h1;h1];B3=[h1;h1;a7;h1];
B0=[a5;a6;a7];
SOC_0=0.5;SOC_min=0.15;SOC_max=0.85;n_d=0.95;n_c=0.95;
delta_t=1;E_r=300;M=tril(ones(24));
lower1=50
h;lower2=20h;lower3=15h;lower4=0h; Upper1=120h;Upper2=80h;Upper3=50h;Upper4=60h;
lower=[lower1;lower2;lower3;lower4;]; Upper=[Upper1;Upper2;Upper3;Upper4;];
r1L=-20
ones(m-1,1);r2L=-20ones(m-1,1);r3L=-20ones(m-1,1); r1U=20ones(m-1,1);r2U=20ones(m-1,1);r3U=20*ones(m-1,1);
R1L=[r1L;0];R2L=[r2L;0];R3L=[r3L;0]; R1U=[r1U;0];R2U=[r2U;0];R3U=[r3U;0];
m1=[-1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 -1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 -1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 -1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 -1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 -1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 -1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 -1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 -1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 -1 1 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 -1 1 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 -1 1 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 -1 1 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 -1 1 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 1 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 1 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 1 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 1 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 1 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 1 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 1 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
m2=zeros(m,m);
M1=[m1,m2,m2,m2];M2=[m2,m1,m2,m2];M3=[m2,m2,m1,m2,];
H1=diag([h;h1;h1;h1]);H2=diag([h1;h;h1;h1]);H3=diag([h1;h1;h;h1]);H4=diag([h1;h1;h1;h]);

for k = 1:MAX_ITER     
%Agent 1
    cvx_begin
       variable x_1(n*m)
       obj1=x_1'*A1*x_1+B1'*x_1;
      for i=1:24
       cs1=log(-lower1(1)+H1(i,:)*x_1)+ log(Upper1(1)-H1(i,:)*x_1);
       obj1=obj1+cs1*(-1/t);
      end
      
      obj2=0;
      for j=1:23
       rate1=M1*x_1;
       cs2=log(-r1L(1)+rate1(j,:))+ log(r1U(1)-rate1(j,:));
       obj2=obj2+cs2*(-1/t);
      end
          
      minimize(obj1+obj2+ (lambda(:,1)-lambda(:,10))'*x_1+(lambda(:,2)-lambda(:,3))'*x_1+...
      rho* sum_square_abs(X(:,5)- x_1)+rho* sum_square_abs(X(:,2)- x_1))
   
    cvx_end 
    disp(x_1);
    
 %lambda-update
  X_new(:,1) = x_1;
  
  lambda(:,1) = lambda(:,1) -rho*(X(:,5)-X_new(:,1));
  lambda(:,2) = lambda(:,2) -rho*(X(:,2)-X_new(:,1));

  lambda_result1(n*m*(k-1)+1:n*m*k,1)=lambda(:,1);
  lambda_result1(n*m*(k-1)+1:n*m*k,2)=lambda(:,2);
 
  
%Agent 2
    cvx_begin
       variable x_2(n*m)
      obj1=x_2'*A2*x_2+B2'*x_2;
      for i=25:48
       cs1=log(-lower2(1)+H2(i,:)*x_2)+ log(Upper2(1)-H2(i,:)*x_2);
       obj1=obj1+cs1*(-1/t);
      end
      
      obj2=0;
      for j=1:23
       rate2=M2*x_2;
       cs2=log(-r2L(1)+rate2(j,:))+ log(r2U(1)-rate2(j,:));
       obj2=obj2+cs2*(-1/t);
      end
      
    minimize(obj1+obj2 +(lambda(:,3)-lambda(:,2))'*x_2+(lambda(:,4)-lambda(:,5))'*x_2+...
    rho* sum_square_abs(X(:,1)- x_2)+rho* sum_square_abs(X(:,3)- x_2))
    cvx_end
   disp(x_2);
    
 %lambda-update
  X_new(:,2) = x_2;
  lambda(:,3) = lambda(:,3) -rho*(X(:,1)-X_new(:,2));
  lambda(:,4) = lambda(:,4) -rho*(X(:,3)-X_new(:,2));

  lambda_result1(n*m*(k-1)+1:n*m*k,3)=lambda(:,3);
  lambda_result1(n*m*(k-1)+1:n*m*k,4)=lambda(:,4);
 
%Agent 3
    cvx_begin
       variable x_3(n*m)
      obj1=x_3'*A3*x_3+B3'*x_3;
      for i=49:72
       cs1=log(-lower3(1)+H3(i,:)*x_3)+ log(Upper3(1)-H3(i,:)*x_3);
       obj1=obj1+cs1*(-1/t);
      end
      
      obj2=0;
      for j=1:23
       rate3=M3*x_3;
       cs2=log(-r3L(1)+rate3(j,:))+ log(r3U(1)-rate3(j,:));
       obj2=obj2+cs2*(-1/t);
      end
      
    minimize(obj1+obj2 +(lambda(:,5)-lambda(:,4))'*x_3+(lambda(:,6)-lambda(:,7))'*x_3+...
    rho* sum_square_abs(X(:,2)- x_3)+rho* sum_square_abs(X(:,4)- x_3))
    cvx_end
   disp(x_3);
    
 %lambda-update
  X_new(:,3) = x_3;
  lambda(:,5) = lambda(:,5) -rho*(X(:,2)-X_new(:,3));
  lambda(:,6) = lambda(:,6) -rho*(X(:,4)-X_new(:,3));

  lambda_result1(n*m*(k-1)+1:n*m*k,5)=lambda(:,5);
  lambda_result1(n*m*(k-1)+1:n*m*k,6)=lambda(:,6);
  
%Agent 4
    cvx_begin
    cvx_solver Gurobi_2
       variable xx(1,m) binary
       variable yy(1,m) binary
       variables x_41(n*m) x_42(n*m) x_4(n*m)
       variables z1(1,m) z2(1,m)
      obj3=z1*ones(m,1)+z2*ones(m,1);
      minimize(obj3+(lambda(:,7)-lambda(:,6))'*x_4...
       +(lambda(:,8)-lambda(:,9))'*x_4+rho* sum_square_abs(X(:,3)- x_4)+rho* sum_square_abs(X(:,5)- x_4))
   
 subject to 
 for i=1:24
z1(i)<=xx(i)*Upper4(1);
z1(i)<=x_41(72+i);
z1(i)>=x_41(72+i)-(1-xx(i))*Upper4(1)
0<=z1(i)<=Upper4(1);
lower4(1)<=x_41(72+i)<=Upper4(1);

z2(i)<=yy(i)*Upper4(1);
z2(i)<=x_42(72+i);
z2(i)>=x_42(72+i)-(1-yy(i))*Upper4(1)
0<=z2(i)<=Upper4(1);
lower4(1)<=x_42(72+i)<=Upper4(1); 
-M*(1-xx(i))<=x_4(72+i)-x_41(72+i)<=M*(1-xx(i));
-M*(1-yy(i))<=x_4(72+i)+x_42(72+i)<=M*(1-yy(i));
xx(i)+yy(i)==1;
end
cvx_end
disp(x_4);
    
 %lambda-update
  X_new(:,4) = x_4;
  lambda(:,7) = lambda(:,7) -rho*(X(:,3)-X_new(:,4));
  lambda(:,8) = lambda(:,8) -rho*(X(:,5)-X_new(:,4));

  lambda_result1(n*m*(k-1)+1:n*m*k,7)=lambda(:,7);
  lambda_result1(n*m*(k-1)+1:n*m*k,8)=lambda(:,8);
                    
%Agent 5
    cvx_begin
       variable x_5(n*m)
F1=x_5(1,:)+x_5(24+1,:)+x_5(2*24+1,:)+x_5(3*24+1,:);
F2=x_5(2,:)+x_5(24+2,:)+x_5(2*24+2,:)+x_5(3*24+2,:);
F3=x_5(3,:)+x_5(24+3,:)+x_5(2*24+3,:)+x_5(3*24+3,:);
F4=x_5(4,:)+x_5(24+4,:)+x_5(2*24+4,:)+x_5(3*24+4,:);
F5=x_5(5,:)+x_5(24+5,:)+x_5(2*24+5,:)+x_5(3*24+5,:);
F6=x_5(6,:)+x_5(24+6,:)+x_5(2*24+6,:)+x_5(3*24+6,:);
F7=x_5(7,:)+x_5(24+7,:)+x_5(2*24+7,:)+x_5(3*24+7,:);
F8=x_5(8,:)+x_5(24+8,:)+x_5(2*24+8,:)+x_5(3*24+8,:);
F9=x_5(9,:)+x_5(24+9,:)+x_5(2*24+9,:)+x_5(3*24+9,:);
F10=x_5(10,:)+x_5(24+10,:)+x_5(2*24+10,:)+x_5(3*24+10,:);
F11=x_5(11,:)+x_5(24+11,:)+x_5(2*24+11,:)+x_5(3*24+11,:);
F12=x_5(12,:)+x_5(24+12,:)+x_5(2*24+12,:)+x_5(3*24+12,:);
F13=x_5(13,:)+x_5(24+13,:)+x_5(2*24+13,:)+x_5(3*24+13,:);
F14=x_5(14,:)+x_5(24+14,:)+x_5(2*24+14,:)+x_5(3*24+14,:);
F15=x_5(15,:)+x_5(24+15,:)+x_5(2*24+15,:)+x_5(3*24+15,:);
F16=x_5(16,:)+x_5(24+16,:)+x_5(2*24+16,:)+x_5(3*24+16,:);
F17=x_5(17,:)+x_5(24+17,:)+x_5(2*24+17,:)+x_5(3*24+17,:);
F18=x_5(18,:)+x_5(24+18,:)+x_5(2*24+18,:)+x_5(3*24+18,:);
F19=x_5(19,:)+x_5(24+19,:)+x_5(2*24+19,:)+x_5(3*24+19,:);
F20=x_5(20,:)+x_5(24+20,:)+x_5(2*24+20,:)+x_5(3*24+20,:);
F21=x_5(21,:)+x_5(24+21,:)+x_5(2*24+21,:)+x_5(3*24+21,:);
F22=x_5(22,:)+x_5(24+22,:)+x_5(2*24+22,:)+x_5(3*24+22,:);
F23=x_5(23,:)+x_5(24+23,:)+x_5(2*24+23,:)+x_5(3*24+23,:);
F24=x_5(24,:)+x_5(24+24,:)+x_5(2*24+24,:)+x_5(3*24+24,:);
FF=[F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,F13,F14,F15,F16,F17,F18,F19,F20,F21,F22,F23,F24];
       minimize(v*sum_square_abs(FF-Dd)+(lambda(:,9)-lambda(:,8))'*x_5...
       +(lambda(:,10)-lambda(:,1))'*x_5+rho* sum_square_abs(X(:,4)- x_5)+rho* sum_square_abs(X(:,1)- x_5))
    cvx_end
disp(x_5);
    
 %lambda-update 
  X_new(:,5) = x_5;
  lambda(:,9) = lambda(:,9) -rho*(X(:,4)-X_new(:,5));
  lambda(:,10) = lambda(:,10) -rho*(X(:,1)-X_new(:,5));

  lambda_result1(n*m*(k-1)+1:n*m*k,9)=lambda(:,9);
  lambda_result1(n*m*(k-1)+1:n*m*k,10)=lambda(:,10);
  

 
 X = X_new;
  for i = 1:n+1
   X_result1(n*m*(k-1)+1:n*m*k,i) = X(:,i);
 end
  result(k)=x_1'*A1*x_1+B1'*x_1+x_2'*A2*x_2+B2'*x_2+x_3'*A3*x_3+B3'*x_3+x_4'*A4*x_4;
    disp(result(k));  
% Stop Criteria  
 if( k > 1)
       for j = 1 : 5
        if( j == 1 )
             e_p(j) = norm( X(:,5) - X(:,1) ) + norm( X(:,2) - X(:,1) );
             e_pri(j) = e_abs + ( max( norm( X(:,5) ) , max(norm( X(:,1) ) , norm(X(:,2)) ) ) ) * e_rel ;
        end
        if( j == 5)     
            e_p(j) = norm( X(:,4) - X(:,5) ) + norm( X(:,1) - X(:,5) );
            e_pri(j) = e_abs + ( max( norm( X(:,4) ) , max( norm( X(:,5) ) , norm(X(:,1)) ) ) ) * e_rel ;
        end
        if(j~=1 && j~=5)
            e_p(j) = norm( X(:,j-1) - X(:,j) ) + norm( X(:,j+1) - X(:,j) );
            e_pri(j) = e_abs + ( max( norm( X(:,j-1) ) , max( norm( X(:,j) ) , norm(X(:,j+1)) ) ) ) * e_rel ;
        end
        e_d(j) = rho * norm( X_result1(n*m*(k-2)+1:n*m*(k-1),j) - X(:,j) ); 
        e_dual(j) = e_abs + ( max( norm(lambda(:,2*j-1)) , norm(lambda(:,2*j)) ) ) * e_rel ;
    end
    if( (sum(e_p <= e_pri) ==5) &&  ( sum(e_d <= e_dual) == 5 ) )
        break
    end
   end  
t = nu*t;
end

toc;

When it runs to the cvx_end of agent 4 in iteraion k=2. It prints as follows and then the code keeps busy and stop running down. I want to what cause the problem more possiblily. And I want to ask the log function should how to write in the cvx with gurobi again. Thanks for your help again.

Gurobi Optimizer, licensed to CVX for CVX
Academic license - for non-commercial use only - expires 2022-03-10
Gurobi Optimizer version 9.1.2 build v9.1.2rc0 (win64)
Thread count: 2 physical cores, 4 logical processors, using up to 4 threads
Optimize a model with 554 rows, 916 columns and 1588 nonzeros
Model fingerprint: 0xceeb03b6
Model has 2 quadratic constraints
Variable types: 868 continuous, 48 integer (48 binary)
Coefficient statistics:
Matrix range [1e+00, 6e+01]
QMatrix range [1e+00, 1e+00]
Objective range [1e-02, 1e+00]
Bounds range [1e+00, 1e+00]
RHS range [1e+00, 8e+01]
Presolve removed 480 rows and 768 columns
Presolve time: 0.02s
Presolved: 225 rows, 444 columns, 594 nonzeros
Presolved model has 147 quadratic constraint(s)
Variable types: 444 continuous, 0 integer (0 binary)
Presolve removed 149 rows and 149 columns
Presolve time: 0.12s
Presolved: 371 rows, 590 columns, 1180 nonzeros
Presolved model has 147 second-order cone constraints
Root barrier log…

Ordering time: 0.00s

Barrier statistics:
Dense cols : 2
AA’ NZ : 1.033e+03
Factor NZ : 2.656e+03
Factor Ops : 2.021e+04 (less than 1 second per iteration)
Threads : 1

              Objective                Residual

Iter Primal Dual Primal Dual Compl Time
0 -7.91692534e+02 -8.56435294e+02 2.29e+04 4.14e-01 2.50e+02 0s
1 -3.61719229e+03 -6.18427455e+02 1.25e+04 1.43e-01 1.37e+02 0s
2 -8.88666682e+03 -5.36209937e+02 2.88e+03 8.24e-02 3.13e+01 0s
3 -6.17943140e+03 -4.07502571e+02 1.15e+03 3.26e-02 1.20e+01 0s
4 -6.27203586e+03 -4.05086062e+02 7.88e+02 2.18e-02 8.90e+00 0s
5 -6.66226951e+03 -4.20299363e+02 4.97e+02 1.30e-02 5.26e+00 0s
6 -3.66634881e+03 -3.93747412e+02 1.95e+02 7.85e-03 3.50e+00 0s
7 -4.31065451e+03 -4.39078247e+02 1.40e+02 4.93e-03 2.26e+00 0s
8 -3.80672268e+03 -4.00299254e+02 9.61e+01 3.28e-03 2.12e+00 0s
9 -3.88548799e+03 -4.94990032e+02 6.70e+01 1.99e-03 1.66e+00 0s
10 -3.10567602e+03 -4.77631583e+02 3.71e+01 1.18e-03 2.14e+00 0s
11 -2.53013495e+03 -5.74754740e+02 1.93e+01 6.18e-04 1.89e+00 0s
12 -1.92466472e+03 -5.99916983e+02 9.28e+00 2.77e-04 9.23e-01 0s
13 -1.47235282e+03 -5.86670812e+02 5.41e+00 2.14e-04 7.51e-01 0s
14 -1.29662176e+03 -5.24568121e+02 3.95e+00 1.16e-04 4.81e-01 0s
15 -1.03648417e+03 -4.63791760e+02 2.39e+00 7.50e-05 3.29e-01 0s
16 -7.35560323e+02 -4.31913188e+02 1.13e+00 4.20e-05 2.39e-01 0s
17 -5.79056736e+02 -4.19919080e+02 5.13e-01 2.25e-05 1.29e-01 0s
18 -4.26039696e+02 -4.24708252e+02 3.28e-02 1.72e-05 3.76e-02 0s
19 -4.22261681e+02 -4.22520531e+02 2.39e-03 1.54e-06 1.13e-03 0s
20 -4.22466200e+02 -4.22469046e+02 8.21e-05 7.72e-06 1.21e-05 0s
21 -4.22466350e+02 -4.22469042e+02 6.42e-05 3.40e-06 1.21e-05 0s
22 -4.22466351e+02 -4.22469042e+02 8.66e-05 1.08e-05 1.21e-05 0s
23 -4.22465435e+02 -4.22469040e+02 2.69e-04 9.76e-06 1.21e-05 0s
24 -4.22465295e+02 -4.22469036e+02 1.20e-04 6.17e-06 1.21e-05 0s
25 -4.22465254e+02 -4.22469036e+02 2.36e-04 6.18e-06 1.21e-05 0s
26 -4.22465259e+02 -4.22469036e+02 2.58e-04 6.17e-06 1.21e-05 0s
27 -4.22465264e+02 -4.22469036e+02 7.69e-04 9.13e-06 1.21e-05 0s
28 -4.22465301e+02 -4.22469036e+02 1.65e-03 6.26e-06 1.21e-05 0s
29 -4.22464163e+02 -4.22469030e+02 2.12e-04 1.03e-05 1.21e-05 0s
30 -4.22464135e+02 -4.22469030e+02 3.57e-04 6.41e-06 1.21e-05 0s
31 -4.22464139e+02 -4.22469030e+02 2.79e-04 1.75e-05 1.21e-05 0s
32 -4.22464357e+02 -4.22469029e+02 2.79e-04 6.24e-06 1.21e-05 0s
33 -4.22464380e+02 -4.22469029e+02 6.23e-04 2.48e-05 1.21e-05 0s
34 -4.22463602e+02 -4.22469028e+02 7.01e-04 2.41e-05 1.21e-05 0s
35 -4.22463632e+02 -4.22469028e+02 6.99e-04 5.64e-05 1.21e-05 0s
36 -4.22463637e+02 -4.22469028e+02 6.99e-04 1.15e-05 1.21e-05 0s
37 -4.22463527e+02 -4.22469024e+02 7.03e-04 1.07e-05 1.21e-05 0s
38 -4.22463489e+02 -4.22469024e+02 7.21e-04 1.16e-05 1.21e-05 1s
39 -4.22463493e+02 -4.22469024e+02 1.53e-03 3.23e-05 1.21e-05 1s
40 -4.22463507e+02 -4.22469025e+02 2.88e-03 6.71e-05 1.21e-05 1s

Barrier performed 40 iterations in 0.51 seconds
Sub-optimal termination - objective -4.22466350e+02

Root relaxation: unbounded, 72 iterations, 0.66 seconds

If you have binary plus exponential cone (log), I think the only options in CVX are to use Mosek as solver (preferred) or CVXQUAD + Mosek or Gurobi (not preferred).

To use CVXQUAD, see 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 .

As for help with understanding Gurobi Sub-optimal termination, Root relaxation unbounded, perhaps you can get help at https://support.gurobi.com/hc/en-us/community/topics .