hello,I consider my code doesn’t have problems,but it tells me the error untill all the code are entirely carried out.The strange thing is that the cvx staus is “solved”,which makes me puzzled.Also,the result that I am expected to get is not a number.

the following is my code.

clear all; %#ok

close all;

clc;

%Quaratic Function Parameter

d = 1;

%agent number

n=6;

% e_abs = 1e-4;

% e_rel = 1e-4;

rho = 10;%change

MAX_ITER = 100;

X = zeros(n,n+1);

X_new = zeros(n,n+1);

lambda = zeros(n,n+1);

lambda_result1 = zeros(n*MAX_ITER,n+1);
% lambda_result2 = zeros(n*MAX_ITER,n+1);

X_result = zeros(n*MAX_ITER,n+1);

% A=[0.00375,0.0175,0.0625,0.00834,0.025,0.025];

D1=[0.00375,0,0,0,0,0];

D2=[0,0.0175,0,0,0,0];

D3=[0,0,0.0625,0,0,0];

D4=[0,0,0,0.00834,0,0];

D5=[0,0,0,0,0.025,0];

D6=[0,0,0,0,0,0.025];

A1=diag(D1);

A2=diag(D2);

A3=diag(D3);

A4=diag(D4);

A5=diag(D5);

A6=diag(D6);

B1=[2,1.75,1.0,3.25,3.0,3.0;];

B2=zeros(5,6);

B=[B1;B2];

lower=[50,20,15,10,10,12];

upper=[200,80,50,35,40,40];

t = 0.5;

nu = 50;

v=100;

%senquential ADMM

for k = 1:MAX_ITER

%Agent 1

% x-update

cvx_begin

variable x_1(n)

minimize(x_1’*A1*x_1+B(1,*x_1-1/t*(log(-lower(1)+x_1(1)) + log(upper(1)-x_1(1)))+ (rho/2)* sum_square_abs(X(:,7)- x_1 -1/rho*lambda(:,1))…
+ (rho/2)* sum_square_abs(-X(:,2)+ x_1 -1/rho*lambda(:,2)) )

cvx_end

```
%lambda-update
X_new(:,1) = x_1;
lambda(:,1) = lambda(:,1) -rho*(X(:,7)-X_new(:,1));
lambda_result1(n*(k-1)+1:n*k,1)=lambda(:,1);
X_result(n*(k-1)+1:n*k,1)= x_1;
%Agent 2
% x-update
cvx_begin
variable x_2(n)
minimize(x_2'*A2*x_2+B(2,:)*x_2-1/t*(log(-lower(2)+x_2(2)) + log(upper(2)-x_2(2))) +(rho/2)* sum_square_abs(X(:,1)- x_2 -1/rho*lambda(:,2))...
+ (rho/2)* sum_square_abs(-X(:,3)+ x_2 -1/rho*lambda(:,3)) )
cvx_end
%lambda-update
X_new(:,2) = x_2;
lambda(:,2) = lambda(:,2) -rho*(X(:,1)-X_new(:,2));
lambda_result1(n*(k-1)+1:n*k,2)=lambda(:,2);
X_result(n*(k-1)+1:n*k,2)= x_2;
%Agent 3
% x-update
cvx_begin
variable x_3(n)
minimize(x_3'*A3*x_3+B(3,:)*x_3-1/t*(log(-lower(3)+x_3(3))+log(upper(3)-x_3(3)))+(rho/2)* sum_square_abs(X(:,2)- x_3 -1/rho*lambda(:,3))...
+ (rho/2)* sum_square_abs(-X(:,4)+ x_3 -1/rho*lambda(:,4)) )
cvx_end
%lambda-update
X_new(:,3) = x_3;
lambda(:,3) = lambda(:,3) -rho*(X(:,2)-X_new(:,3));
lambda_result1(n*(k-1)+1:n*k,3)=lambda(:,3);
X_result(n*(k-1)+1:n*k,3)= x_3;
%Agent 4
% x-update
cvx_begin
variable x_4(n)
minimize(x_4'*A4*x_4+B(4,:)*x_4-1/t*(log(-lower(4)+x_4(4)) + log(upper(4)-x_4(4)))+(rho/2)* sum_square_abs(X(:,3)- x_4 -1/rho*lambda(:,4))...
+ (rho/2)* sum_square_abs(-X(:,5)+ x_4 -1/rho*lambda(:,5)) )
cvx_end
%lambda-update
X_new(:,4) = x_4;
lambda(:,4) = lambda(:,4) -rho*(X(:,3)-X_new(:,4));
lambda_result1(n*(k-1)+1:n*k,4)=lambda(:,4);
X_result(n*(k-1)+1:n*k,4)= x_4;
%Agent 5
% x-update
cvx_begin
variable x_5(n)
minimize(x_5'*A5*x_5+B(5,:)*x_5-1/t*(log(-lower(5)+x_5(5)) + log(upper(5)-x_5(5)))+(rho/2)* sum_square_abs(X(:,4)- x_5 -1/rho*lambda(:,5))...
+ (rho/2)* sum_square_abs(-X(:,6)+ x_5 -1/rho*lambda(:,6)) )
cvx_end
%lambda-update
X_new(:,5) = x_5;
lambda(:,5) = lambda(:,5) -rho*(X(:,4)-X_new(:,5));
lambda_result1(n*(k-1)+1:n*k,5)=lambda(:,5);
X_result(n*(k-1)+1:n*k,5)= x_5;
%Agent 6
% x-update
cvx_begin
variable x_6(n)
minimize(x_6'*A6*x_6+B(6,:)*x_6-1/t*(log(-lower(6)+x_6(6)) + log(upper(6)-x_6(6)))+(rho/2)* sum_square_abs(X(:,5)- x_6 -1/rho*lambda(:,6))...
+ (rho/2)* sum_square_abs(-X(:,7)+ x_6 -1/rho*lambda(:,7)) )
cvx_end
%lambda-update
X_new(:,6) = x_6;
lambda(:,6) = lambda(:,6) -rho*(X(:,5)-X_new(:,6));
lambda_result1(n*(k-1)+1:n*k,6)=lambda(:,6);
X_result(n*(k-1)+1:n*k,6)= x_6;
%Agent 7
% x-update
cvx_begin
variable x_7(n)
minimize(v*norm(x_7'*ones(n,1)-283.4)+(rho/2)* sum_square_abs(X(:,6)- x_7 -1/rho*lambda(:,7))...
+ (rho/2)* sum_square_abs(-X(:,1)+ x_7 -1/rho*lambda(:,1)) )
cvx_end
%lambda-update
X_new(:,7) = x_7;
lambda(:,7) = lambda(:,7) -rho*(X(:,6)-X_new(:,7));
lambda_result1(n*(k-1)+1:n*k,7)=lambda(:,7);
X_result(n*(k-1)+1:n*k,7)= x_7;
result(k) =x_1'*A1*x_1+B(1,:)*x_1-1/t*(log(-lower(1)+x_1(1))+log(upper(1)-x_1(1)))...
+x_2'*A2*x_2+B(2,:)*x_2-1/t*(log(-lower(2)+x_2(2))+log(upper(2)-x_2(2)))...
+x_3'*A3*x_3+B(3,:)*x_3-1/t*(log(-lower(3)+x_3(3))+log(upper(3)-x_3(3)))...
+x_4'*A4*x_4+B(4,:)*x_4-1/t*(log(-lower(4)+x_4(4))+log(upper(4)-x_4(4)))...
+x_5'*A5*x_5+B(5,:)*x_5-1/t*(log(-lower(5)+x_5(5))+log(upper(5)-x_5(5)))...
+x_6'*A6*x_6+B(6,:)*x_6-1/t*(log(-lower(6)+x_6(6))+log(upper(6)-x_6(6)))...
+v*norm(x_7'*ones(n,1)-283.4);
```

% error(k) = f - result(k);

t = nu*t;

end