├── CCG_BoZeng.m ├── two-stage robust.pdf ├── README.md └── Benders_BoZeng.m /CCG_BoZeng.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ang-Xuan/CCG-and-Benders-Case-for-Two-stage-Robust-Optimization/HEAD/CCG_BoZeng.m -------------------------------------------------------------------------------- /two-stage robust.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ang-Xuan/CCG-and-Benders-Case-for-Two-stage-Robust-Optimization/HEAD/two-stage robust.pdf -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CCG-and-Benders-Case-for-Two-stage-Robust-Optimization 2 | 复现经典论文《Solving two-stage robust optimization problems using a column-and-constraint generation method》算例极简版 3 | 4 | MATLAB + Yalmip + Cplex 5 | -------------------------------------------------------------------------------- /Benders_BoZeng.m: -------------------------------------------------------------------------------- 1 | clear all 2 | %% Parameter 3 | G=[-1,-1,-1,0,0,0,0,0,0; 4 | 0,0,0,-1,-1,-1,0,0,0; 5 | 0,0,0,0,0,0,-1,-1,-1; 6 | 1,0,0,1,0,0,1,0,0; 7 | 0,1,0,0,1,0,0,1,0; 8 | 0,0,1,0,0,1,0,0,1]; 9 | h=[0;0;0;206;274;220]; 10 | E=[0,0,0,1,0,0; 11 | 0,0,0,0,1,0; 12 | 0,0,0,0,0,1; 13 | 0,0,0,0,0,0; 14 | 0,0,0,0,0,0; 15 | 0,0,0,0,0,0]; 16 | M=[0,0,0; 17 | 0,0,0; 18 | 0,0,0; 19 | -40,0,0; 20 | 0,-40,0; 21 | 0,0,-40]; 22 | coe1 = [400,414,326]; 23 | coe2 = [18,25,20]; 24 | b = [22,33,24,33,23,30,20,25,27]' ; 25 | %% Variable 26 | y=binvar(3,1); 27 | z=sdpvar(3,1); 28 | x=sdpvar(9,1); 29 | eta=sdpvar(1); 30 | g=sdpvar(3,1); 31 | pi = sdpvar(size(G,1),1); 32 | v=binvar(size(G,1),1); 33 | w=binvar(size(G,2),1); 34 | %% Benders 35 | LB=-inf; UB=inf; iter=1; BigM=1e5; 36 | 37 | MP_Obj = coe1*y +coe2*z+eta ; 38 | MP_Cons=[ z<=800*y, z>=0, x>=0, eta>=b'*x, sum(z)>=772 ]; 39 | ops=sdpsettings('solver','cplex','verbose',0); 40 | 41 | Uncertain_Cons=[ 0<=g<=1, sum(g)<=1.8, g(1)+g(2)<=1.2 ]; 42 | 43 | while UB-LB>=1e-5 44 | disp(['迭代第',num2str(iter),'次']) 45 | optimize(MP_Cons,MP_Obj,ops); 46 | LB = max(LB, value(MP_Obj)); % LB 47 | 48 | SP_Obj = b'*x; 49 | SP_Cons = [Uncertain_Cons, 0<=x, G*x >= h-E*[value(y); value(z)]-M*g]; 50 | SP_Cons = [SP_Cons, 0<=pi, G'*pi<=b ]; 51 | SP_Cons = [SP_Cons, G*x-h+E*[value(y); value(z)]+M*g <= BigM*(1-v), pi<=BigM*v]; 52 | SP_Cons = [SP_Cons, b-G'*pi <= BigM*(1-w), x<=BigM*w]; 53 | sol_SP = optimize(SP_Cons,-SP_Obj,ops); 54 | 55 | if sol_SP.problem==0 % SP is solved 56 | UB=min(UB, coe1*value(y)+coe2*value(z)+value(SP_Obj)); % UB 57 | disp([' g = ',num2str(value(g)')]); 58 | MP_Cons = [MP_Cons, eta>=( h-E*[y;z]-M*value(g) )'*value(pi)]; 59 | else % SP is unbounded 60 | MP_Cons = [MP_Cons]; 61 | end 62 | 63 | iter=iter+1; 64 | display([' LB: ',num2str(LB), ' UB: ',num2str(UB),]); 65 | end --------------------------------------------------------------------------------