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+3Pess_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,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,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