├── EE7400_2_3_Deterministic_TEP_Six_node_system.m ├── EE7400_3_10_Generalized_Network_Constrained_GEP.m ├── EE7400_3_10_Stochastic_GEP_problem_using_dynamic_approach.m ├── EE7400_3_10_Stochastic_GEP_problem_using_dynamic_approach_NC.m ├── EE7400_3_4_Deterministic_single_node_static_GEP_problem.m ├── EE7400_3_6_Deterministic_single_node_dynamic_GEP_problem.m ├── EE7400_4_1_Deterministic_static_GTEP_problem.m ├── EE7400_4_4_Deterministic_dynamic_GTEP_problem.m ├── EE7400_4_5_Stochastic_static_GTEP.m ├── EE7400_4_6_Stochastic_dynamic_GTEP.m ├── EE7400_D_1_Risk_neutral_GEP_problem.m ├── EE7400_D_2_Risk_constrained_GEP_problem.m └── README.md /EE7400_2_3_Deterministic_TEP_Six_node_system.m: -------------------------------------------------------------------------------- 1 | clc 2 | clear classes 3 | 4 | %% Read system input 5 | GenData=[ 6 | 1 300 18 7 | 2 250 25 8 | 3 400 16 9 | 4 300 32 10 | 6 150 35 11 | ]; 12 | 13 | BranchData=[ 14 | 1 2 500 150 0 15 | 1 3 500 150 0 16 | 4 5 500 150 0 17 | 2 3 500 150 700000 18 | 2 4 500 200 1400000 19 | 3 4 500 200 1800000 20 | 3 6 500 200 1600000 21 | 4 6 500 150 800000 22 | 5 6 500 150 700000 23 | ]; 24 | 25 | Demand=[ 26 | 1 200 40 27 | 4 150 52 28 | 5 100 55 29 | 6 200 65 30 | ]; 31 | 32 | Nbus = 6; 33 | Nbranch=9; 34 | Nunits = 5; 35 | Nloads = 4; 36 | n_prospective_branch = 6; 37 | M = 5000; 38 | ReferenceBus = 1; 39 | 40 | Total_budget=3*1000000; 41 | sigma = 8760;%total hours 42 | 43 | Pmax = GenData(:,2); 44 | Gencost = GenData(:,3); 45 | branch_investment_cost=BranchData(4:end,5); 46 | Load_shedding_cost=Demand(:,3); 47 | 48 | %% Define problem variables 49 | P_gen = sdpvar(Nunits,1,'full'); % Generation 50 | x_BS = binvar(n_prospective_branch,1,'full'); %Prospective_branch_status 51 | P_LS = sdpvar(Nloads,1,'full');%Load shedding amount 52 | Del = sdpvar(Nbus,1,'full'); % Bus voltage angle 53 | P_line = sdpvar(Nbranch,1,'full');% Line flows 54 | 55 | % Other temporary variable 56 | P_gen_node=sdpvar(Nbus,1,'full'); 57 | P_gen_node(GenData(:,1),1)=P_gen; 58 | P_gen_node(5,1)=0;% forcing non-gen buses to be zero. 59 | P_LS_node=sdpvar(Nbus,1,'full'); 60 | P_LS_node(Demand(:,1),1)=P_LS; 61 | P_LS_node(2:3,1)=0;% forcing non-load buses to be zero. 62 | 63 | P_dem_node=zeros(Nbus,1); 64 | P_dem_node(Demand(:,1),1)=Demand(:,2); 65 | %% Bus to Line incidence matrix 66 | Kl = zeros(Nbus,Nbranch); 67 | for j = 1:Nbranch 68 | Kl(BranchData(j,1),j) = 1; 69 | Kl(BranchData(j,2),j) = -1; 70 | end 71 | 72 | %% Objective and constraints 73 | Objective= sum(x_BS.*branch_investment_cost)+sigma*(sum(P_gen.*Gencost) + sum(P_LS.*Load_shedding_cost)); 74 | 75 | Constraints = []; 76 | Constraints=[Constraints, sum(x_BS.*branch_investment_cost) <= Total_budget]; 77 | Constraints = [Constraints, P_gen_node-P_dem_node+P_LS_node == Kl*P_line]; 78 | P_line(1:3,1)=(Del(BranchData(1:3,1))-Del(BranchData(1:3,2))).*BranchData(1:3,3); 79 | Constraints = [Constraints, -BranchData(1:3,4) <= P_line(1:3,1) <= BranchData(1:3,4)]; 80 | Constraints = [Constraints, -x_BS.*BranchData(4:end,4) <= P_line(4:end,1) <= x_BS.*BranchData(4:end,4)]; 81 | Constraints = [Constraints, -(1-x_BS)*M <= P_line(4:end,1) - (Del(BranchData(4:end,1))-Del(BranchData(4:end,2))).*BranchData(4:end,3)<=(1-x_BS)*M]; 82 | Constraints = [Constraints, 0 <= P_gen <= Pmax]; 83 | Constraints = [Constraints, 0 <= P_LS <= Demand(:,2)]; 84 | Constraints = [Constraints, -pi <= Del(2:end,1) <= pi]; 85 | Constraints = [Constraints, Del(ReferenceBus,1)== 0]; 86 | 87 | %% Building objective function and finding optimal solution 88 | ops = sdpsettings('verbose',0,'debug',1); 89 | Solution = optimize(Constraints,Objective,ops) 90 | 91 | Branch_to_be_built= find(value(x_BS))+3 92 | % disp('True Optimal Solution: Building lines 5 and 7, i.e., lines connecting nodes 2-4 and 3-6') 93 | Total_cost=value(Objective) 94 | % P_gen=value(P_gen) 95 | % P_LS=value(P_LS) 96 | % Del=value(Del) 97 | % P_gen_node=value(P_gen_node) 98 | % P_LS_node=value(P_LS_node) -------------------------------------------------------------------------------- /EE7400_3_10_Generalized_Network_Constrained_GEP.m: -------------------------------------------------------------------------------- 1 | clc 2 | clear classes 3 | 4 | %% Read system input 5 | p_cq=[0;100;200;300;400;500]; 6 | M = 5000; 7 | investment_per_MW=70000; 8 | 9 | Demand=zeros(2,2,4); 10 | Demand(:,:,1)=[212,402;214,407]; 11 | Demand(:,:,2)=[212,402;284,539]; 12 | Demand(:,:,3)=[281,533;284,539]; 13 | Demand(:,:,4)=[281,533;377,715]; 14 | %% Define problem variables % time period in row, op con in column 15 | %Primal variable 16 | P_existing_gen = sdpvar(2,2,4,'full'); % Generation 17 | P_can_gen = sdpvar(2,2,4,'full'); % Candidate Generation 18 | P_can_max = sdpvar(2,1,4,'full'); % Candidate Generation maximum 19 | Pline = sdpvar(2,2,4,'full'); 20 | Del1 = sdpvar(2,2,4,'full'); 21 | Del2 = sdpvar(2,2,4,'full'); 22 | %Dual variable 23 | lamda1=sdpvar(2,2,4,'full'); 24 | lamda2=sdpvar(2,2,4,'full'); 25 | mu_ex_gen=sdpvar(2,2,4,'full'); 26 | mu_can_gen=sdpvar(2,2,4,'full'); 27 | mu_line=sdpvar(2,2,4,'full'); 28 | mu_line_max=sdpvar(2,2,4,'full'); 29 | mu_line_min=sdpvar(2,2,4,'full'); 30 | mu_del1_max=sdpvar(2,2,4,'full'); 31 | mu_del1_min=sdpvar(2,2,4,'full'); 32 | mu_del2_max=sdpvar(2,2,4,'full'); 33 | mu_del2_min=sdpvar(2,2,4,'full'); 34 | mu_del_ref=sdpvar(2,2,4,'full'); 35 | %Binary variable 36 | u_cq = binvar(6,2,4,'full'); 37 | z_cqo= binvar(6,4,4,'full'); 38 | z_cqo_cap= binvar(6,4,4,'full'); 39 | 40 | sigma=[6000,2760]; 41 | inv_cost=[140000,70000]; 42 | %% Building objective function 43 | Objective=0; 44 | for w=1:4 45 | for t=1:2 46 | Objective = Objective + 0.25*P_can_max(t,1,w)*inv_cost(t); % investment cost 47 | for op=1:2 48 | Objective=Objective+sigma(op)*0.25*(35*P_existing_gen(t,op,w) + 25*P_can_gen(t,op,w)); % operating cost 49 | end 50 | end 51 | end 52 | 53 | %% constraints 54 | Constraints = []; 55 | Constraints=[Constraints,P_can_max(1,1,1)==P_can_max(1,1,2)]; 56 | Constraints=[Constraints,P_can_max(1,1,2)==P_can_max(1,1,3)]; 57 | Constraints=[Constraints,P_can_max(1,1,3)==P_can_max(1,1,4)]; 58 | 59 | Constraints=[Constraints,P_can_max(2,1,1)==P_can_max(2,1,2)]; 60 | Constraints=[Constraints,P_can_max(2,1,3)==P_can_max(2,1,4)]; 61 | 62 | for w=1:4 63 | for t=1:2 64 | Constraints=[Constraints, sum(u_cq(:,t,w).*p_cq) == P_can_max(t,1,w)]; 65 | Constraints=[Constraints, sum(u_cq(:,t,w)) == 1]; 66 | for op=1:2 67 | %% Scenario w, Time period t, Operating condition op 68 | Constraints=[Constraints, P_existing_gen(t,op,w) - Pline(t,op,w) == 0]; 69 | Constraints=[Constraints, P_can_gen(t,op,w) + Pline(t,op,w) == Demand(t,op,w)]; 70 | Constraints=[Constraints, Pline(t,op,w) == 500*(Del1(t,op,w)-Del2(t,op,w))]; 71 | Constraints=[Constraints, -500 <= Pline(t,op,w) <= 500]; 72 | Constraints=[Constraints, P_existing_gen(t,op,w) + P_can_gen(t,op,w) == Demand(t,op,w)]; 73 | Constraints=[Constraints, 0 <= P_existing_gen(t,op,w) <= 400]; 74 | Constraints=[Constraints, 0 <= P_can_gen(t,op,w) <= sum(P_can_max(1:t,1,w))];%% 75 | Constraints=[Constraints, -pi <= Del2(t,op,w) <= pi]; 76 | Constraints=[Constraints, Del1(t,op,w) == 0]; 77 | 78 | Constraints=[Constraints, 35-lamda1(t,op,w)+mu_ex_gen(t,op,w)>=0]; 79 | Constraints=[Constraints, 25-lamda2(t,op,w)+mu_can_gen(t,op,w)>=0]; 80 | Constraints=[Constraints, lamda1(t,op,w)-lamda2(t,op,w)-mu_line(t,op,w)+mu_line_max(t,op,w)-mu_line_min(t,op,w)==0]; 81 | Constraints=[Constraints, -500*mu_line(t,op,w)+mu_del2_max(t,op,w)-mu_del2_min(t,op,w)==0]; 82 | Constraints=[Constraints, 500*mu_line(t,op,w)+ mu_del_ref(t,op,w)==0]; 83 | 84 | Constraints=[Constraints, mu_ex_gen(t,op,w)>=0]; 85 | Constraints=[Constraints, mu_can_gen(t,op,w)>=0]; 86 | Constraints=[Constraints, mu_line_max(t,op,w)>=0]; 87 | Constraints=[Constraints, mu_line_min(t,op,w)>=0]; 88 | Constraints=[Constraints, mu_del1_max(t,op,w)>=0]; 89 | Constraints=[Constraints, mu_del1_min(t,op,w)>=0]; 90 | 91 | Constraints=[Constraints, 35*P_existing_gen(t,op,w) + 25*P_can_gen(t,op,w)==Demand(t,op,w)*lamda2(t,op,w)-400*mu_ex_gen(t,op,w)-sum(z_cqo(:,2*t-2+op,w))-... 92 | 500*(mu_line_max(t,op,w)+mu_line_min(t,op,w)) - pi*(mu_del2_max(t,op,w)+mu_del2_min(t,op,w))]; 93 | 94 | Constraints=[Constraints, z_cqo(:,2*t-2+op,w)== p_cq*mu_can_gen(t,op,w)-z_cqo_cap(:,2*t-2+op,w)]; 95 | Constraints=[Constraints, 0<=z_cqo(:,2*t-2+op,w)<=u_cq(:,t,w)*M]; 96 | Constraints=[Constraints, 0<=z_cqo_cap(:,2*t-2+op,w)<=(1-u_cq(:,t,w))*M]; 97 | end 98 | end 99 | end 100 | 101 | %% finding optimal solution 102 | ops = sdpsettings('verbose',0,'debug',1); 103 | Solution = optimize(Constraints,Objective,ops) 104 | 105 | P_can_max=value(P_can_max) 106 | u_cq=value(u_cq) 107 | P_existing_gen=value(P_existing_gen) 108 | P_can_gen=value(P_can_gen) 109 | value(Objective) -------------------------------------------------------------------------------- /EE7400_3_10_Stochastic_GEP_problem_using_dynamic_approach.m: -------------------------------------------------------------------------------- 1 | clc 2 | clear classes 3 | 4 | %% Read system input 5 | p_cq=[0;100;200;300;400;500]; 6 | M = 5000; 7 | investment_per_MW=70000; 8 | 9 | Demand=zeros(2,2,4); 10 | Demand(:,:,1)=[212,402;214,407]; 11 | Demand(:,:,2)=[212,402;284,539]; 12 | Demand(:,:,3)=[281,533;284,539]; 13 | Demand(:,:,4)=[281,533;377,715]; 14 | %% Define problem variables % time period in row, op con in column 15 | %Primal variable 16 | P_existing_gen = sdpvar(2,2,4,'full'); % Generation 17 | P_can_gen = sdpvar(2,2,4,'full'); % Candidate Generation 18 | P_can_max = sdpvar(2,1,4,'full'); % Candidate Generation maximum 19 | %Dual variable 20 | lamda1=sdpvar(2,2,4,'full'); 21 | lamda2=sdpvar(2,2,4,'full'); 22 | mu_ex_gen=sdpvar(2,2,4,'full'); 23 | mu_can_gen=sdpvar(2,2,4,'full'); 24 | %Binary variable 25 | u_cq = binvar(6,2,4,'full'); 26 | z_cqo= binvar(6,4,4,'full'); 27 | z_cqo_cap= binvar(6,4,4,'full'); 28 | 29 | %% Building objective function 30 | Objective=0; 31 | for w=1:4 32 | Objective = Objective + 0.25*[P_can_max(1,1,w)*140000+P_can_max(2,1,w)*70000+... 33 | 6000*(35*P_existing_gen(1,1,w) + 25*P_can_gen(1,1,w)) + 2760*(35*P_existing_gen(1,2,w) + 25*P_can_gen(1,2,w))+... %time period 1 34 | 6000*(35*P_existing_gen(2,1,w) + 25*P_can_gen(2,1,w)) + 2760*(35*P_existing_gen(2,2,w) + 25*P_can_gen(2,2,w))] ; %time period 2 35 | end 36 | %% constraints 37 | Constraints = []; 38 | for w=1:4 39 | Constraints=[Constraints, sum(u_cq(:,1,w).*p_cq) == P_can_max(1,1,w)]; 40 | Constraints=[Constraints, sum(u_cq(:,2,w).*p_cq) == P_can_max(2,1,w)]; 41 | Constraints=[Constraints, sum(u_cq(:,1,w)) == 1]; 42 | Constraints=[Constraints, sum(u_cq(:,2,w)) == 1]; 43 | end 44 | Constraints=[Constraints,P_can_max(1,1,1)==P_can_max(1,1,2)]; 45 | Constraints=[Constraints,P_can_max(1,1,2)==P_can_max(1,1,3)]; 46 | Constraints=[Constraints,P_can_max(1,1,3)==P_can_max(1,1,4)]; 47 | 48 | Constraints=[Constraints,P_can_max(2,1,1)==P_can_max(2,1,2)]; 49 | Constraints=[Constraints,P_can_max(2,1,3)==P_can_max(2,1,4)]; 50 | 51 | for w=1:4 52 | %% Time period 1, Operating condition 1 53 | Constraints=[Constraints, P_existing_gen(1,1,w) + P_can_gen(1,1,w) == Demand(1,1,w)]; 54 | Constraints=[Constraints, 0 <= P_existing_gen(1,1,w) <= 400]; 55 | Constraints=[Constraints, 0 <= P_can_gen(1,1,w) <= P_can_max(1,1,w)]; 56 | Constraints=[Constraints, 35-lamda1(1,1,w)+mu_ex_gen(1,1,w)>=0]; 57 | Constraints=[Constraints, 25-lamda2(1,1,w)+mu_can_gen(1,1,w)>=0]; 58 | Constraints=[Constraints, mu_ex_gen(1,1,w)>=0]; 59 | Constraints=[Constraints, mu_can_gen(1,1,w)>=0]; 60 | 61 | Constraints=[Constraints, 35*P_existing_gen(1,1,w) + 25*P_can_gen(1,1,w)==Demand(1,1,w)*lamda2(1,1,w)-400*mu_ex_gen(1,1,w)-sum(z_cqo(:,1,w))]; 62 | Constraints=[Constraints, z_cqo(:,1,w)== p_cq*mu_can_gen(1,1,w)-z_cqo_cap(:,1,w)]; 63 | Constraints=[Constraints, 0<=z_cqo(:,1,w)<=u_cq(:,1,w)*M]; 64 | Constraints=[Constraints, 0<=z_cqo_cap(:,1,w)<=(1-u_cq(:,1,w))*M]; 65 | 66 | %% Time period 1,Operating condition 2 67 | Constraints=[Constraints, P_existing_gen(1,2,w) + P_can_gen(1,2,w) == Demand(1,2,w)]; 68 | Constraints=[Constraints, 0 <= P_existing_gen(1,2,w) <= 400]; 69 | Constraints=[Constraints, 0 <= P_can_gen(1,2,w) <= P_can_max(1,1,w)]; 70 | Constraints=[Constraints, 35-lamda1(1,2,w)+mu_ex_gen(1,2,w)>=0]; 71 | Constraints=[Constraints, 25-lamda2(1,2,w)+mu_can_gen(1,2,w)>=0]; 72 | Constraints=[Constraints, mu_ex_gen(1,2,w)>=0]; 73 | Constraints=[Constraints, mu_can_gen(1,2,w)>=0]; 74 | 75 | Constraints=[Constraints, 35*P_existing_gen(1,2,w)+25*P_can_gen(1,2,w)==Demand(1,2,w)*lamda2(1,2,w)-400*mu_ex_gen(1,2,w)-sum(z_cqo(:,2,w))]; 76 | % Constraints=[Constraints, z_cqo(:,2)== p_cq*mu_can_gen(1,2)-z_cqo_cap(:,2)]; 77 | % Constraints=[Constraints, 0<=z_cqo(:,2)<=u_cq(:,1)*M]; 78 | % Constraints=[Constraints, 0<=z_cqo_cap(:,2)<=(1-u_cq(:,1))*M]; 79 | 80 | 81 | %% Time period 2, Operating condition 1 82 | Constraints=[Constraints, P_existing_gen(2,1,w) + P_can_gen(2,1,w) == Demand(2,1,w)]; 83 | Constraints=[Constraints, 0 <= P_existing_gen(2,1,w) <= 400]; 84 | Constraints=[Constraints, 0 <= P_can_gen(2,1,w) <= P_can_max(1,1,w) + P_can_max(2,1,w)];% sum of 'P_can_max' in two time period 85 | Constraints=[Constraints, 35-lamda1(2,1,w)+mu_ex_gen(2,1,w)>=0]; 86 | Constraints=[Constraints, 25-lamda2(2,1,w)+mu_can_gen(2,1,w)>=0]; 87 | Constraints=[Constraints, mu_ex_gen(2,1,w)>=0]; 88 | Constraints=[Constraints, mu_can_gen(2,1,w)>=0]; 89 | 90 | 91 | Constraints=[Constraints, 35*P_existing_gen(2,1,w) + 25*P_can_gen(2,1,w)==Demand(2,1,w)*lamda2(2,1,w)-400*mu_ex_gen(2,1,w)-sum(z_cqo(:,3,w))]; 92 | Constraints=[Constraints, z_cqo(:,3,w)== p_cq*mu_can_gen(2,1,w)-z_cqo_cap(:,3,w)]; 93 | Constraints=[Constraints, 0<=z_cqo(:,3,w)<=u_cq(:,2,w)*M]; 94 | Constraints=[Constraints, 0<=z_cqo_cap(:,3,w)<=(1-u_cq(:,2,w))*M]; 95 | 96 | %% Time period 2,Operating condition 2 97 | Constraints=[Constraints, P_existing_gen(2,2,w) + P_can_gen(2,2,w) == Demand(2,2,w)]; 98 | Constraints=[Constraints, 0 <= P_existing_gen(2,2,w) <= 400]; 99 | Constraints=[Constraints, 0 <= P_can_gen(2,2,w) <= P_can_max(1,1,w) + P_can_max(2,1,w)];% sum of 'P_can_max' in two time period 100 | Constraints=[Constraints, 35-lamda1(2,2,w)+mu_ex_gen(2,2,w)>=0]; 101 | Constraints=[Constraints, 25-lamda2(2,2,w)+mu_can_gen(2,2,w)>=0]; 102 | Constraints=[Constraints, mu_ex_gen(2,2,w)>=0]; 103 | Constraints=[Constraints, mu_can_gen(2,2,w)>=0]; 104 | 105 | Constraints=[Constraints, 35*P_existing_gen(2,2,w)+25*P_can_gen(2,2,w)==Demand(2,2,w)*lamda2(2,2,w)-400*mu_ex_gen(2,2,w)-sum(z_cqo(:,4,w))]; 106 | % Constraints=[Constraints, z_cqo(:,4,w)== p_cq*mu_can_gen(2,2,w)-z_cqo_cap(:,4,w)]; 107 | % Constraints=[Constraints, 0<=z_cqo(:,4,w)<=u_cq(:,2,w)*M]; 108 | % Constraints=[Constraints, 0<=z_cqo_cap(:,4,w)<=(1-u_cq(:,2,w))*M]; 109 | end 110 | %% finding optimal solution 111 | ops = sdpsettings('verbose',0,'debug',1); 112 | Solution = optimize(Constraints,Objective,ops) 113 | 114 | P_can_max=value(P_can_max) 115 | u_cq=value(u_cq) 116 | P_existing_gen=value(P_existing_gen) 117 | P_can_gen=value(P_can_gen) 118 | value(Objective) -------------------------------------------------------------------------------- /EE7400_3_10_Stochastic_GEP_problem_using_dynamic_approach_NC.m: -------------------------------------------------------------------------------- 1 | clc 2 | clear classes 3 | 4 | %% Read system input 5 | p_cq=[0;100;200;300;400;500]; 6 | M = 5000; 7 | investment_per_MW=70000; 8 | 9 | Demand=zeros(2,2,4); 10 | Demand(:,:,1)=[212,402;214,407]; 11 | Demand(:,:,2)=[212,402;284,539]; 12 | Demand(:,:,3)=[281,533;284,539]; 13 | Demand(:,:,4)=[281,533;377,715]; 14 | %% Define problem variables % time period in row, op con in column 15 | %Primal variable 16 | P_existing_gen = sdpvar(2,2,4,'full'); % Generation 17 | P_can_gen = sdpvar(2,2,4,'full'); % Candidate Generation 18 | P_can_max = sdpvar(2,1,4,'full'); % Candidate Generation maximum 19 | Pline = sdpvar(2,2,4,'full'); 20 | Del1 = sdpvar(2,2,4,'full'); 21 | Del2 = sdpvar(2,2,4,'full'); 22 | %Dual variable 23 | lamda1=sdpvar(2,2,4,'full'); 24 | lamda2=sdpvar(2,2,4,'full'); 25 | mu_ex_gen=sdpvar(2,2,4,'full'); 26 | mu_can_gen=sdpvar(2,2,4,'full'); 27 | mu_line=sdpvar(2,2,4,'full'); 28 | mu_line_max=sdpvar(2,2,4,'full'); 29 | mu_line_min=sdpvar(2,2,4,'full'); 30 | mu_del1_max=sdpvar(2,2,4,'full'); 31 | mu_del1_min=sdpvar(2,2,4,'full'); 32 | mu_del2_max=sdpvar(2,2,4,'full'); 33 | mu_del2_min=sdpvar(2,2,4,'full'); 34 | mu_del_ref=sdpvar(2,2,4,'full'); 35 | %Binary variable 36 | u_cq = binvar(6,2,4,'full'); 37 | z_cqo= binvar(6,4,4,'full'); 38 | z_cqo_cap= binvar(6,4,4,'full'); 39 | 40 | %% Building objective function 41 | Objective=0; 42 | for w=1:4 43 | Objective = Objective + 0.25*[P_can_max(1,1,w)*140000+P_can_max(2,1,w)*70000 +... 44 | 6000*(35*P_existing_gen(1,1,w) + 25*P_can_gen(1,1,w)) + 2760*(35*P_existing_gen(1,2,w) + 25*P_can_gen(1,2,w))+... %time period 1 45 | 6000*(35*P_existing_gen(2,1,w) + 25*P_can_gen(2,1,w)) + 2760*(35*P_existing_gen(2,2,w) + 25*P_can_gen(2,2,w))] ; %time period 2 46 | end 47 | 48 | %% constraints 49 | Constraints = []; 50 | for w=1:4 51 | Constraints=[Constraints, sum(u_cq(:,1,w).*p_cq) == P_can_max(1,1,w)]; 52 | Constraints=[Constraints, sum(u_cq(:,2,w).*p_cq) == P_can_max(2,1,w)]; 53 | Constraints=[Constraints, sum(u_cq(:,1,w)) == 1]; 54 | Constraints=[Constraints, sum(u_cq(:,2,w)) == 1]; 55 | end 56 | Constraints=[Constraints,P_can_max(1,1,1)==P_can_max(1,1,2)]; 57 | Constraints=[Constraints,P_can_max(1,1,2)==P_can_max(1,1,3)]; 58 | Constraints=[Constraints,P_can_max(1,1,3)==P_can_max(1,1,4)]; 59 | 60 | Constraints=[Constraints,P_can_max(2,1,1)==P_can_max(2,1,2)]; 61 | Constraints=[Constraints,P_can_max(2,1,3)==P_can_max(2,1,4)]; 62 | 63 | for w=1:4 64 | %% Time period 1, Operating condition 1 65 | Constraints=[Constraints, P_existing_gen(1,1,w) - Pline(1,1,w) == 0]; 66 | Constraints=[Constraints, P_can_gen(1,1,w) + Pline(1,1,w) == Demand(1,1,w)]; 67 | Constraints=[Constraints, Pline(1,1,w) == 500*(Del1(1,1,w)-Del2(1,1,w))]; 68 | Constraints=[Constraints, -500 <= Pline(1,1,w) <= 500]; 69 | 70 | Constraints=[Constraints, P_existing_gen(1,1,w) + P_can_gen(1,1,w) == Demand(1,1,w)]; 71 | Constraints=[Constraints, 0 <= P_existing_gen(1,1,w) <= 400]; 72 | Constraints=[Constraints, 0 <= P_can_gen(1,1,w) <= P_can_max(1,1,w)]; 73 | Constraints=[Constraints, -pi <= Del2(1,1,w) <= pi]; 74 | Constraints=[Constraints, Del1(1,1,w) == 0]; 75 | 76 | Constraints=[Constraints, 35-lamda1(1,1,w)+mu_ex_gen(1,1,w)>=0]; 77 | Constraints=[Constraints, 25-lamda2(1,1,w)+mu_can_gen(1,1,w)>=0]; 78 | 79 | Constraints=[Constraints, lamda1(1,1,w)-lamda2(1,1,w)-mu_line(1,1,w)+mu_line_max(1,1,w)-mu_line_min(1,1,w)==0]; 80 | Constraints=[Constraints, -500*mu_line(1,1,w)+mu_del2_max(1,1,w)-mu_del2_min(1,1,w)==0]; 81 | Constraints=[Constraints, 500*mu_line(1,1,w)+ mu_del_ref(1,1,w)==0]; 82 | 83 | Constraints=[Constraints, mu_ex_gen(1,1,w)>=0]; 84 | Constraints=[Constraints, mu_can_gen(1,1,w)>=0]; 85 | 86 | Constraints=[Constraints, mu_line_max(1,1,w)>=0]; 87 | Constraints=[Constraints, mu_line_min(1,1,w)>=0]; 88 | Constraints=[Constraints, mu_del1_max(1,1,w)>=0]; 89 | Constraints=[Constraints, mu_del1_min(1,1,w)>=0]; 90 | 91 | Constraints=[Constraints, 35*P_existing_gen(1,1,w) + 25*P_can_gen(1,1,w)==Demand(1,1,w)*lamda2(1,1,w)-400*mu_ex_gen(1,1,w)-sum(z_cqo(:,1,w))-... 92 | 500*(mu_line_max(1,1,w)+mu_line_min(1,1,w)) - pi*(mu_del2_max(1,1,w)+mu_del2_min(1,1,w))]; 93 | Constraints=[Constraints, z_cqo(:,1,w)== p_cq*mu_can_gen(1,1,w)-z_cqo_cap(:,1,w)]; 94 | Constraints=[Constraints, 0<=z_cqo(:,1,w)<=u_cq(:,1,w)*M]; 95 | Constraints=[Constraints, 0<=z_cqo_cap(:,1,w)<=(1-u_cq(:,1,w))*M]; 96 | 97 | %% Time period 1,Operating condition 2 98 | Constraints=[Constraints, P_existing_gen(1,2,w) - Pline(1,2,w) == 0]; 99 | Constraints=[Constraints, P_can_gen(1,2,w) + Pline(1,2,w) == Demand(1,2,w)]; 100 | Constraints=[Constraints, Pline(1,2,w) == 500*(Del1(1,2,w)-Del2(1,2,w))]; 101 | Constraints=[Constraints, -500 <= Pline(1,2,w) <= 500]; 102 | 103 | Constraints=[Constraints, P_existing_gen(1,2,w) + P_can_gen(1,2,w) == Demand(1,2,w)]; 104 | Constraints=[Constraints, 0 <= P_existing_gen(1,2,w) <= 400]; 105 | Constraints=[Constraints, 0 <= P_can_gen(1,2,w) <= P_can_max(1,1,w)]; 106 | Constraints=[Constraints, -pi <= Del2(1,2,w) <= pi]; 107 | Constraints=[Constraints, Del1(1,2,w) == 0]; 108 | 109 | Constraints=[Constraints, 35-lamda1(1,2,w)+mu_ex_gen(1,2,w)>=0]; 110 | Constraints=[Constraints, 25-lamda2(1,2,w)+mu_can_gen(1,2,w)>=0]; 111 | 112 | Constraints=[Constraints, lamda1(1,2,w)-lamda2(1,2,w)-mu_line(1,2,w)+mu_line_max(1,2,w)-mu_line_min(1,2,w)==0]; 113 | Constraints=[Constraints, -500*mu_line(1,2,w)+mu_del2_max(1,2,w)-mu_del2_min(1,2,w)==0]; 114 | Constraints=[Constraints, 500*mu_line(1,2,w)+ mu_del_ref(1,2,w)==0]; 115 | 116 | Constraints=[Constraints, mu_ex_gen(1,2,w)>=0]; 117 | Constraints=[Constraints, mu_can_gen(1,2,w)>=0]; 118 | 119 | Constraints=[Constraints, mu_line_max(1,2,w)>=0]; 120 | Constraints=[Constraints, mu_line_min(1,2,w)>=0]; 121 | Constraints=[Constraints, mu_del1_max(1,2,w)>=0]; 122 | Constraints=[Constraints, mu_del1_min(1,2,w)>=0]; 123 | 124 | Constraints=[Constraints, 35*P_existing_gen(1,2,w)+25*P_can_gen(1,2,w)==Demand(1,2,w)*lamda2(1,2,w)-400*mu_ex_gen(1,2,w)-sum(z_cqo(:,2,w))-... 125 | 500*(mu_line_max(1,2,w)+mu_line_min(1,2,w)) - pi*(mu_del2_max(1,2,w)+mu_del2_min(1,2,w))]; 126 | 127 | Constraints=[Constraints, z_cqo(:,2,w)== p_cq*mu_can_gen(1,2,w)-z_cqo_cap(:,2,w)]; 128 | Constraints=[Constraints, 0<=z_cqo(:,2,w)<=u_cq(:,1,w)*M]; 129 | Constraints=[Constraints, 0<=z_cqo_cap(:,2,w)<=(1-u_cq(:,1,w))*M]; 130 | 131 | 132 | %% Time period 2, Operating condition 1 133 | Constraints=[Constraints, P_existing_gen(2,1,w) - Pline(2,1,w) == 0]; 134 | Constraints=[Constraints, P_can_gen(2,1,w) + Pline(2,1,w) == Demand(2,1,w)]; 135 | Constraints=[Constraints, Pline(2,1,w) == 500*(Del1(2,1,w)-Del2(2,1,w))]; 136 | Constraints=[Constraints, -500 <= Pline(2,1,w) <= 500]; 137 | 138 | Constraints=[Constraints, P_existing_gen(2,1,w) + P_can_gen(2,1,w) == Demand(2,1,w)]; 139 | Constraints=[Constraints, 0 <= P_existing_gen(2,1,w) <= 400]; 140 | Constraints=[Constraints, 0 <= P_can_gen(2,1,w) <= P_can_max(1,1,w) + P_can_max(2,1,w)];% sum of 'P_can_max' in two time period 141 | Constraints=[Constraints, -pi <= Del2(2,1,w) <= pi]; 142 | Constraints=[Constraints, Del1(2,1,w) == 0]; 143 | 144 | Constraints=[Constraints, 35-lamda1(2,1,w)+mu_ex_gen(2,1,w)>=0]; 145 | Constraints=[Constraints, 25-lamda2(2,1,w)+mu_can_gen(2,1,w)>=0]; 146 | 147 | Constraints=[Constraints, lamda1(2,1,w)-lamda2(2,1,w)-mu_line(2,1,w)+mu_line_max(2,1,w)-mu_line_min(2,1,w)==0]; 148 | Constraints=[Constraints, -500*mu_line(2,1,w)+mu_del2_max(2,1,w)-mu_del2_min(2,1,w)==0]; 149 | Constraints=[Constraints, 500*mu_line(2,1,w)+ mu_del_ref(2,1,w)==0]; 150 | 151 | Constraints=[Constraints, mu_ex_gen(2,1,w)>=0]; 152 | Constraints=[Constraints, mu_can_gen(2,1,w)>=0]; 153 | 154 | Constraints=[Constraints, mu_line_max(2,1,w)>=0]; 155 | Constraints=[Constraints, mu_line_min(2,1,w)>=0]; 156 | Constraints=[Constraints, mu_del1_max(2,1,w)>=0]; 157 | Constraints=[Constraints, mu_del1_min(2,1,w)>=0]; 158 | 159 | Constraints=[Constraints, 35*P_existing_gen(2,1,w) + 25*P_can_gen(2,1,w)==Demand(2,1,w)*lamda2(2,1,w)-400*mu_ex_gen(2,1,w)-sum(z_cqo(:,3,w))-... 160 | 500*(mu_line_max(2,1,w)+mu_line_min(2,1,w)) - pi*(mu_del2_max(2,1,w)+mu_del2_min(2,1,w))]; 161 | 162 | Constraints=[Constraints, z_cqo(:,3,w)== p_cq*mu_can_gen(2,1,w)-z_cqo_cap(:,3,w)]; 163 | Constraints=[Constraints, 0<=z_cqo(:,3,w)<=u_cq(:,2,w)*M]; 164 | Constraints=[Constraints, 0<=z_cqo_cap(:,3,w)<=(1-u_cq(:,2,w))*M]; 165 | 166 | %% Time period 2,Operating condition 2 167 | Constraints=[Constraints, P_existing_gen(2,2,w) - Pline(2,2,w) == 0]; 168 | Constraints=[Constraints, P_can_gen(2,2,w) + Pline(2,2,w) == Demand(2,2,w)]; 169 | Constraints=[Constraints, Pline(2,1,w) == 500*(Del1(2,1,w)-Del2(2,2,w))]; 170 | Constraints=[Constraints, -500 <= Pline(2,2,w) <= 500]; 171 | 172 | Constraints=[Constraints, P_existing_gen(2,2,w) + P_can_gen(2,2,w) == Demand(2,2,w)]; 173 | Constraints=[Constraints, 0 <= P_existing_gen(2,2,w) <= 400]; 174 | Constraints=[Constraints, 0 <= P_can_gen(2,2,w) <= P_can_max(1,1,w) + P_can_max(2,1,w)];% sum of 'P_can_max' in two time period 175 | Constraints=[Constraints, -pi <= Del2(2,2,w) <= pi]; 176 | Constraints=[Constraints, Del1(2,2,w) == 0]; 177 | 178 | Constraints=[Constraints, 35-lamda1(2,2,w)+mu_ex_gen(2,2,w)>=0]; 179 | Constraints=[Constraints, 25-lamda2(2,2,w)+mu_can_gen(2,2,w)>=0]; 180 | 181 | Constraints=[Constraints, lamda1(2,2,w)-lamda2(2,2,w)-mu_line(2,2,w)+mu_line_max(2,2,w)-mu_line_min(2,2,w)==0]; 182 | Constraints=[Constraints, -500*mu_line(2,2,w)+mu_del2_max(2,2,w)-mu_del2_min(2,2,w)==0]; 183 | Constraints=[Constraints, 500*mu_line(2,2,w)+ mu_del_ref(2,2,w)==0]; 184 | 185 | Constraints=[Constraints, mu_ex_gen(2,2,w)>=0]; 186 | Constraints=[Constraints, mu_can_gen(2,2,w)>=0]; 187 | 188 | Constraints=[Constraints, mu_line_max(2,2,w)>=0]; 189 | Constraints=[Constraints, mu_line_min(2,2,w)>=0]; 190 | Constraints=[Constraints, mu_del1_max(2,2,w)>=0]; 191 | Constraints=[Constraints, mu_del1_min(2,2,w)>=0]; 192 | 193 | Constraints=[Constraints, 35*P_existing_gen(2,2,w)+25*P_can_gen(2,2,w)==Demand(2,2,w)*lamda2(2,2,w)-400*mu_ex_gen(2,2,w)-sum(z_cqo(:,4,w))-... 194 | 500*(mu_line_max(2,2,w)+mu_line_min(2,2,w)) - pi*(mu_del2_max(2,2,w)+mu_del2_min(2,2,w))]; 195 | 196 | Constraints=[Constraints, z_cqo(:,4,w)== p_cq*mu_can_gen(2,2,w)-z_cqo_cap(:,4,w)]; 197 | Constraints=[Constraints, 0<=z_cqo(:,4,w)<=u_cq(:,2,w)*M]; 198 | Constraints=[Constraints, 0<=z_cqo_cap(:,4,w)<=(1-u_cq(:,2,w))*M]; 199 | end 200 | %% finding optimal solution 201 | ops = sdpsettings('verbose',0,'debug',1); 202 | Solution = optimize(Constraints,Objective,ops) 203 | 204 | P_can_max=value(P_can_max) 205 | u_cq=value(u_cq) 206 | P_existing_gen=value(P_existing_gen) 207 | P_can_gen=value(P_can_gen) 208 | value(Objective) -------------------------------------------------------------------------------- /EE7400_3_4_Deterministic_single_node_static_GEP_problem.m: -------------------------------------------------------------------------------- 1 | clc 2 | clear classes 3 | 4 | %% Read system input 5 | p_cq=[0;100;200;300;400;500]; 6 | M = 5000; 7 | investment_per_MW=70000; 8 | 9 | %% Define problem variables 10 | %Primal variable 11 | P_existing_gen = sdpvar(1,2,'full'); % Generation 12 | P_can_gen = sdpvar(1,2,'full'); % Candidate Generation 13 | P_can_max = sdpvar(1,1,'full'); % Candidate Generation maximum 14 | %Dual variable 15 | lamda=sdpvar(1,2,'full'); 16 | mu_ex_gen=sdpvar(1,2,'full'); 17 | mu_can_gen=sdpvar(1,2,'full'); 18 | %Binary variable 19 | u_cq = binvar(6,1,'full'); 20 | z_cqo= binvar(6,2,'full'); 21 | z_cqo_cap= binvar(6,2,'full'); 22 | 23 | 24 | %% Building objective function 25 | Objective= P_can_max*70000 + 6000*(35*P_existing_gen(1,1) + 25*P_can_gen(1,1)) + 2760*(35*P_existing_gen(1,2) + 25*P_can_gen(1,2)); 26 | 27 | %% constraints 28 | Constraints = []; 29 | Constraints=[Constraints, sum(u_cq.*p_cq) == P_can_max]; 30 | Constraints=[Constraints, sum(u_cq) == 1]; 31 | 32 | %% Operating condition 1 33 | Constraints=[Constraints, P_existing_gen(1,1) + P_can_gen(1,1) == 290]; 34 | Constraints=[Constraints, 0 <= P_existing_gen(1,1) <= 400]; 35 | Constraints=[Constraints, 0 <= P_can_gen(1,1) <= P_can_max]; 36 | Constraints=[Constraints, 35-lamda(1,1)+mu_ex_gen(1,1)>=0]; 37 | Constraints=[Constraints, 25-lamda(1,1)+mu_can_gen(1,1)>=0]; 38 | Constraints=[Constraints, mu_ex_gen(1,1)>=0]; 39 | Constraints=[Constraints, mu_can_gen(1,1)>=0]; 40 | 41 | Constraints=[Constraints, 35*P_existing_gen(1,1) + 25*P_can_gen(1,1)==290*lamda(1,1)-400*mu_ex_gen(1,1)-sum(z_cqo(:,1))]; 42 | Constraints=[Constraints, z_cqo(:,1)== p_cq*mu_can_gen(1,1)-z_cqo_cap(:,1)]; 43 | Constraints=[Constraints, 0<=z_cqo(:,1)<=u_cq(:,1)*M]; 44 | Constraints=[Constraints, 0<=z_cqo_cap(:,1)<=(1-u_cq(:,1))*M]; 45 | 46 | %% Operating condition 2 47 | Constraints=[Constraints, P_existing_gen(1,2) + P_can_gen(1,2) == 550]; 48 | Constraints=[Constraints, 0 <= P_existing_gen(1,2) <= 400]; 49 | Constraints=[Constraints, 0 <= P_can_gen(1,2) <= P_can_max]; 50 | Constraints=[Constraints, 35-lamda(1,2)+mu_ex_gen(1,2)>=0]; 51 | Constraints=[Constraints, 25-lamda(1,2)+mu_can_gen(1,2)>=0]; 52 | Constraints=[Constraints, mu_ex_gen(1,2)>=0]; 53 | Constraints=[Constraints, mu_can_gen(1,2)>=0]; 54 | 55 | Constraints=[Constraints, 35*P_existing_gen(1,2)+25*P_can_gen(1,2)==550*lamda(1,2)-400*mu_ex_gen(1,2)-sum(z_cqo(:,2))]; 56 | % Constraints=[Constraints, z_cqo(:,2)== p_cq*mu_can_gen(1,2)-z_cqo_cap(:,2)]; 57 | % Constraints=[Constraints, 0<=z_cqo(:,2)<=u_cq(:,1)*M]; 58 | % Constraints=[Constraints, 0<=z_cqo_cap(:,2)<=(1-u_cq(:,1))*M]; 59 | 60 | %% finding optimal solution 61 | ops = sdpsettings('verbose',0,'debug',1); 62 | Solution = optimize(Constraints,Objective,ops) 63 | 64 | P_can_max=value(P_can_max) 65 | u_cq=value(u_cq) 66 | P_existing_gen=value(P_existing_gen) 67 | P_can_gen=value(P_can_gen) 68 | lamda=value(lamda) -------------------------------------------------------------------------------- /EE7400_3_6_Deterministic_single_node_dynamic_GEP_problem.m: -------------------------------------------------------------------------------- 1 | clc 2 | clear classes 3 | 4 | %% Read system input 5 | p_cq=[0;100;200;300;400;500]; 6 | M = 5000; 7 | investment_per_MW=70000; 8 | 9 | %% Define problem variables % time period in row, op con in column 10 | %Primal variable 11 | P_existing_gen = sdpvar(2,2,'full'); % Generation 12 | P_can_gen = sdpvar(2,2,'full'); % Candidate Generation 13 | P_can_max = sdpvar(2,1,'full'); % Candidate Generation maximum 14 | %Dual variable 15 | lamda=sdpvar(2,2,'full'); 16 | mu_ex_gen=sdpvar(2,2,'full'); 17 | mu_can_gen=sdpvar(2,2,'full'); 18 | %Binary variable 19 | u_cq = binvar(6,2,'full'); 20 | z_cqo= binvar(6,4,'full'); 21 | z_cqo_cap= binvar(6,4,'full'); 22 | 23 | %% Building objective function 24 | Objective = P_can_max(1,1)*140000+P_can_max(2,1)*70000 +... 25 | 6000*(35*P_existing_gen(1,1) + 25*P_can_gen(1,1)) + 2760*(35*P_existing_gen(1,2) + 25*P_can_gen(1,2))+... %time period 1 26 | 6000*(35*P_existing_gen(2,1) + 25*P_can_gen(2,1)) + 2760*(35*P_existing_gen(2,2) + 25*P_can_gen(2,2)) %time period 2 27 | 28 | %% constraints 29 | Constraints = []; 30 | Constraints=[Constraints, sum(u_cq(:,1).*p_cq) == P_can_max(1,1)]; 31 | Constraints=[Constraints, sum(u_cq(:,2).*p_cq) == P_can_max(2,1)]; 32 | Constraints=[Constraints, sum(u_cq(:,1)) == 1]; 33 | Constraints=[Constraints, sum(u_cq(:,2)) == 1]; 34 | 35 | %% Time period 1, Operating condition 1 36 | Constraints=[Constraints, P_existing_gen(1,1) + P_can_gen(1,1) == 246.5]; 37 | Constraints=[Constraints, 0 <= P_existing_gen(1,1) <= 400]; 38 | Constraints=[Constraints, 0 <= P_can_gen(1,1) <= P_can_max(1,1)]; 39 | Constraints=[Constraints, 35-lamda(1,1)+mu_ex_gen(1,1)>=0]; 40 | Constraints=[Constraints, 25-lamda(1,1)+mu_can_gen(1,1)>=0]; 41 | Constraints=[Constraints, mu_ex_gen(1,1)>=0]; 42 | Constraints=[Constraints, mu_can_gen(1,1)>=0]; 43 | 44 | Constraints=[Constraints, 35*P_existing_gen(1,1) + 25*P_can_gen(1,1)==290*lamda(1,1)-400*mu_ex_gen(1,1)-sum(z_cqo(:,1))]; 45 | Constraints=[Constraints, z_cqo(:,1)== p_cq*mu_can_gen(1,1)-z_cqo_cap(:,1)]; 46 | Constraints=[Constraints, 0<=z_cqo(:,1)<=u_cq(:,1)*M]; 47 | Constraints=[Constraints, 0<=z_cqo_cap(:,1)<=(1-u_cq(:,1))*M]; 48 | 49 | %% Time period 1,Operating condition 2 50 | Constraints=[Constraints, P_existing_gen(1,2) + P_can_gen(1,2) == 467.5]; 51 | Constraints=[Constraints, 0 <= P_existing_gen(1,2) <= 400]; 52 | Constraints=[Constraints, 0 <= P_can_gen(1,2) <= P_can_max(1,1)]; 53 | Constraints=[Constraints, 35-lamda(1,2)+mu_ex_gen(1,2)>=0]; 54 | Constraints=[Constraints, 25-lamda(1,2)+mu_can_gen(1,2)>=0]; 55 | Constraints=[Constraints, mu_ex_gen(1,2)>=0]; 56 | Constraints=[Constraints, mu_can_gen(1,2)>=0]; 57 | 58 | Constraints=[Constraints, 35*P_existing_gen(1,2)+25*P_can_gen(1,2)==550*lamda(1,2)-400*mu_ex_gen(1,2)-sum(z_cqo(:,2))]; 59 | % Constraints=[Constraints, z_cqo(:,2)== p_cq*mu_can_gen(1,2)-z_cqo_cap(:,2)]; 60 | % Constraints=[Constraints, 0<=z_cqo(:,2)<=u_cq(:,1)*M]; 61 | % Constraints=[Constraints, 0<=z_cqo_cap(:,2)<=(1-u_cq(:,1))*M]; 62 | 63 | 64 | %% Time period 2, Operating condition 1 65 | Constraints=[Constraints, P_existing_gen(2,1) + P_can_gen(2,1) == 290]; 66 | Constraints=[Constraints, 0 <= P_existing_gen(2,1) <= 400]; 67 | Constraints=[Constraints, 0 <= P_can_gen(2,1) <= P_can_max(1,1) + P_can_max(2,1)];% sum of 'P_can_max' in two time period 68 | Constraints=[Constraints, 35-lamda(2,1)+mu_ex_gen(2,1)>=0]; 69 | Constraints=[Constraints, 25-lamda(2,1)+mu_can_gen(2,1)>=0]; 70 | Constraints=[Constraints, mu_ex_gen(2,1)>=0]; 71 | Constraints=[Constraints, mu_can_gen(2,1)>=0]; 72 | 73 | 74 | Constraints=[Constraints, 35*P_existing_gen(2,1) + 25*P_can_gen(2,1)==290*lamda(2,1)-400*mu_ex_gen(2,1)-sum(z_cqo(:,3))]; 75 | Constraints=[Constraints, z_cqo(:,3)== p_cq*mu_can_gen(2,1)-z_cqo_cap(:,3)]; 76 | Constraints=[Constraints, 0<=z_cqo(:,3)<=u_cq(:,2)*M]; 77 | Constraints=[Constraints, 0<=z_cqo_cap(:,3)<=(1-u_cq(:,2))*M]; 78 | 79 | %% Time period 2,Operating condition 2 80 | Constraints=[Constraints, P_existing_gen(2,2) + P_can_gen(2,2) == 550]; 81 | Constraints=[Constraints, 0 <= P_existing_gen(2,2) <= 400]; 82 | Constraints=[Constraints, 0 <= P_can_gen(2,2) <= P_can_max(1,1) + P_can_max(2,1)];% sum of 'P_can_max' in two time period 83 | Constraints=[Constraints, 35-lamda(2,2)+mu_ex_gen(2,2)>=0]; 84 | Constraints=[Constraints, 25-lamda(2,2)+mu_can_gen(2,2)>=0]; 85 | Constraints=[Constraints, mu_ex_gen(2,2)>=0]; 86 | Constraints=[Constraints, mu_can_gen(2,2)>=0]; 87 | 88 | Constraints=[Constraints, 35*P_existing_gen(2,2)+25*P_can_gen(2,2)==550*lamda(2,2)-400*mu_ex_gen(2,2)-sum(z_cqo(:,4))]; 89 | % Constraints=[Constraints, z_cqo(:,4)== p_cq*mu_can_gen(2,2)-z_cqo_cap(:,4)]; 90 | % Constraints=[Constraints, 0<=z_cqo(:,4)<=u_cq(:,2)*M]; 91 | % Constraints=[Constraints, 0<=z_cqo_cap(:,4)<=(1-u_cq(:,2))*M]; 92 | 93 | %% finding optimal solution 94 | ops = sdpsettings('verbose',0,'debug',1); 95 | Solution = optimize(Constraints,Objective,ops) 96 | 97 | P_can_max=value(P_can_max) 98 | u_cq=value(u_cq) 99 | P_existing_gen=value(P_existing_gen) 100 | P_can_gen=value(P_can_gen) 101 | lamda=value(lamda) -------------------------------------------------------------------------------- /EE7400_4_1_Deterministic_static_GTEP_problem.m: -------------------------------------------------------------------------------- 1 | clc 2 | clear all 3 | %% Define problem variables 4 | % Primal variable 5 | P_existing_gen = sdpvar(1,2,'full'); % Generation 6 | P_can_gen = sdpvar(1,2,'full'); % Candidate Generation 7 | P_can_max = sdpvar(1,1,'full'); % Candidate Generation maximum 8 | Pline = sdpvar(2,2,'full'); % Lines in the row 9 | Del = sdpvar(2,2,'full'); % Nodes in the row 10 | x_BS = binvar(1,1,'full'); % Prospective_branch_status 11 | P_LS = sdpvar(1,2,'full'); % Load shedding amount 12 | M=5000; 13 | 14 | %% Building objective function 15 | Objective= P_can_max*70000+x_BS*100000+... 16 | 6000*(35*P_existing_gen(1,1) + 25*P_can_gen(1,1)+80*P_LS(1,1))+... 17 | 2760*(35*P_existing_gen(1,2) + 25*P_can_gen(1,2)+80*P_LS(1,2)); 18 | 19 | %% constraints 20 | Constraints=[]; 21 | Constraints=[Constraints, 0<=P_can_max(1,1)<=300]; 22 | Constraints=[Constraints, x_BS*1000000<=2000000]; 23 | Constraints=[Constraints, P_can_max*700000<=400*1000000]; 24 | %% OpCon 1 25 | Constraints=[Constraints, P_existing_gen(1,1)-Pline(1,1)-Pline(2,1)==0]; 26 | Constraints=[Constraints, P_can_gen(1,1)+Pline(1,1)+Pline(2,1)==290-P_LS(1,1)]; 27 | Constraints=[Constraints, Pline(1,1)==500*(Del(1,1)-Del(2,1))]; 28 | Constraints=[Constraints, -200*x_BS<=Pline(2,1)<=200*x_BS]; 29 | Constraints=[Constraints, -(1-x_BS)*M<=Pline(2,1)-500*(Del(1,1)-Del(2,1))<=(1-x_BS)*M]; 30 | Constraints=[Constraints, -200<=Pline(1,1)<=200]; 31 | % Constraints=[Constraints, -200<=Pline(2,1)<=200]; 32 | Constraints=[Constraints, 0<=P_existing_gen(1,1)<=400]; 33 | Constraints=[Constraints, 0<=P_can_gen(1,1)<=P_can_max]; 34 | Constraints=[Constraints, 0<=P_LS(1,1)<=290]; 35 | Constraints=[Constraints, -pi<=Del(2,1)<=pi]; 36 | Constraints=[Constraints, Del(1,1)==0]; 37 | 38 | %% OpCon 2 39 | Constraints=[Constraints, P_existing_gen(1,2)-Pline(1,2)-Pline(2,2)==0]; 40 | Constraints=[Constraints, P_can_gen(1,2)+Pline(1,2)+Pline(2,2)==550-P_LS(1,2)]; 41 | Constraints=[Constraints, Pline(1,2)==500*(Del(1,2)-Del(2,2))]; 42 | Constraints=[Constraints, -200*x_BS<=Pline(2,2)<=200*x_BS]; 43 | Constraints=[Constraints, -(1-x_BS)*M<=Pline(2,2)-500*(Del(1,2)-Del(2,2))<=(1-x_BS)*M]; 44 | Constraints=[Constraints, -200<=Pline(1,2)<=200]; 45 | % Constraints=[Constraints, -200<=Pline(2,2)<=200]; 46 | Constraints=[Constraints, 0<=P_existing_gen(1,2)<=400]; 47 | Constraints=[Constraints, 0<=P_can_gen(1,2)<=P_can_max]; 48 | Constraints=[Constraints, 0<=P_LS(1,2)<=550]; 49 | Constraints=[Constraints, -pi<=Del(2,2)<=pi]; 50 | Constraints=[Constraints, Del(1,2)==0]; 51 | 52 | %% finding optimal solution (optimal=building 290MW and line 2, cost 109.03M) 53 | ops = sdpsettings('verbose',0,'debug',1); 54 | Solution = optimize(Constraints,Objective,ops) 55 | 56 | Total_cost=value(Objective) 57 | x_BS=value(x_BS) 58 | P_can_max=value(P_can_max) 59 | P_existing_gen=value(P_existing_gen) 60 | P_can_gen=value(P_can_gen) 61 | P_LS=value(P_LS) 62 | 63 | 64 | -------------------------------------------------------------------------------- /EE7400_4_4_Deterministic_dynamic_GTEP_problem.m: -------------------------------------------------------------------------------- 1 | clc 2 | clear all 3 | %% Define problem variables 4 | % Primal variable 5 | P_existing_gen = sdpvar(2,2,'full'); % Generation 6 | P_can_gen = sdpvar(2,2,'full'); % Candidate Generation 7 | P_can_max = sdpvar(2,1,'full'); % Candidate Generation maximum 8 | Pline = sdpvar(2,2,2,'full'); % Lines in the 3rd index 9 | Del = sdpvar(2,2,2,'full'); % Nodes in the 3rd index 10 | x_BS = binvar(2,1,'full'); % Prospective_branch_status 11 | P_LS = sdpvar(2,2,'full'); % Load shedding amount 12 | M=5000; 13 | 14 | %% Building objective function 15 | Objective= P_can_max(1,1)*140000+x_BS(1,1)*200000+P_can_max(2,1)*70000+x_BS(2,1)*100000+... 16 | 6000*(35*P_existing_gen(1,1) + 25*P_can_gen(1,1)+80*P_LS(1,1))+... 17 | 2760*(35*P_existing_gen(1,2) + 25*P_can_gen(1,2)+80*P_LS(1,2))+... 18 | 6000*(35*P_existing_gen(2,1) + 25*P_can_gen(2,1)+80*P_LS(2,1))+... 19 | 2760*(35*P_existing_gen(2,2) + 25*P_can_gen(2,2)+80*P_LS(2,2)); 20 | 21 | %% constraints 22 | Constraints=[]; 23 | Constraints=[Constraints, 0<=sum(P_can_max(1:2,1))<=300]; 24 | Constraints=[Constraints, sum(x_BS(1:2,1))<=1]; 25 | Constraints=[Constraints, x_BS(1,1)*1000000<=2*1000000]; 26 | Constraints=[Constraints, P_can_max(1,1)*700000<=400*1000000]; 27 | Constraints=[Constraints, x_BS(2,1)*1000000<=2*1000000]; 28 | Constraints=[Constraints, P_can_max(2,1)*700000<=400*1000000]; 29 | 30 | %% time period 1,OpCon 1 31 | Constraints=[Constraints, P_existing_gen(1,1)-Pline(1,1,1)-Pline(1,1,2)==0]; 32 | Constraints=[Constraints, P_can_gen(1,1)+Pline(1,1,1)+Pline(1,1,2)==246.5-P_LS(1,1)]; 33 | Constraints=[Constraints, Pline(1,1,1)==500*(Del(1,1,1)-Del(1,1,2))]; 34 | Constraints=[Constraints, -200*x_BS(1,1)<=Pline(1,1,2)<=200*x_BS(1,1)]; 35 | Constraints=[Constraints, -(1-x_BS(1,1))*M<=Pline(1,1,2)-500*(Del(1,1,1)-Del(1,1,2))<=(1-x_BS(1,1))*M]; 36 | Constraints=[Constraints, -200<=Pline(1,1,1)<=200]; 37 | % Constraints=[Constraints, -200<=Pline(2,1)<=200]; 38 | Constraints=[Constraints, 0<=P_existing_gen(1,1)<=400]; 39 | Constraints=[Constraints, 0<=P_can_gen(1,1)<=P_can_max(1,1)]; 40 | Constraints=[Constraints, 0<=P_LS(1,1)<=246.5]; 41 | Constraints=[Constraints, -pi<=Del(1,1,2)<=pi]; 42 | Constraints=[Constraints, Del(1,1,1)==0]; 43 | 44 | %% time period 1,OpCon 2 45 | Constraints=[Constraints, P_existing_gen(1,2)-Pline(1,2,1)-Pline(1,2,2)==0]; 46 | Constraints=[Constraints, P_can_gen(1,2)+Pline(1,2,1)+Pline(1,2,2)==467.5-P_LS(1,2)]; 47 | Constraints=[Constraints, Pline(1,2,1)==500*(Del(1,2,1)-Del(1,2,2))]; 48 | Constraints=[Constraints, -200*x_BS(1,1)<=Pline(1,2,2)<=200*x_BS(1,1)]; 49 | Constraints=[Constraints, -(1-x_BS(1,1))*M<=Pline(1,2,2)-500*(Del(1,2,1)-Del(1,2,2))<=(1-x_BS(1,1))*M]; 50 | Constraints=[Constraints, -200<=Pline(1,2,1)<=200]; 51 | % Constraints=[Constraints, -200<=Pline(2,1)<=200]; 52 | Constraints=[Constraints, 0<=P_existing_gen(1,2)<=400]; 53 | Constraints=[Constraints, 0<=P_can_gen(1,2)<=P_can_max(1,1)]; 54 | Constraints=[Constraints, 0<=P_LS(1,2)<=467.5]; 55 | Constraints=[Constraints, -pi<=Del(1,2,2)<=pi]; 56 | Constraints=[Constraints, Del(1,2,1)==0]; 57 | 58 | %% time period 2, OpCon 1 59 | Constraints=[Constraints, P_existing_gen(2,1)-Pline(2,1,1)-Pline(2,1,2)==0]; 60 | Constraints=[Constraints, P_can_gen(2,1)+Pline(2,1,1)+Pline(2,1,2)==290-P_LS(2,1)]; 61 | Constraints=[Constraints, Pline(2,1,1)==500*(Del(2,1,1)-Del(2,1,2))]; 62 | Constraints=[Constraints, -200*sum(x_BS(1:2,1))<=Pline(2,1,2)<=200*sum(x_BS(1:2,1))]; 63 | Constraints=[Constraints, -(1-sum(x_BS(1:2,1)))*M<=Pline(2,1,2)-500*(Del(2,1,1)-Del(2,1,2))<=(1-sum(x_BS(1:2,1)))*M]; 64 | Constraints=[Constraints, -200<=Pline(2,1,1)<=200]; 65 | % Constraints=[Constraints, -200<=Pline(2,1)<=200]; 66 | Constraints=[Constraints, 0<=P_existing_gen(2,1)<=400]; 67 | Constraints=[Constraints, 0<=P_can_gen(2,1)<=sum(P_can_max(1:2,1))]; 68 | Constraints=[Constraints, 0<=P_LS(2,1)<=290]; 69 | Constraints=[Constraints, -pi<=Del(2,1,2)<=pi]; 70 | Constraints=[Constraints, Del(2,1,1)==0]; 71 | 72 | %% time period 2, OpCon 2 73 | Constraints=[Constraints, P_existing_gen(2,2)-Pline(2,2,1)-Pline(2,2,2)==0]; 74 | Constraints=[Constraints, P_can_gen(2,2)+Pline(2,2,1)+Pline(2,2,2)==550-P_LS(2,2)]; 75 | Constraints=[Constraints, Pline(2,2,1)==500*(Del(2,2,1)-Del(2,2,2))]; 76 | Constraints=[Constraints, -200*sum(x_BS(1:2,1))<=Pline(2,2,2)<=200*sum(x_BS(1:2,1))]; 77 | Constraints=[Constraints, -(1-sum(x_BS(1:2,1)))*M<=Pline(2,2,2)-500*(Del(2,2,1)-Del(2,2,2))<=(1-sum(x_BS(1:2,1)))*M]; 78 | Constraints=[Constraints, -200<=Pline(2,2,1)<=200]; 79 | % Constraints=[Constraints, -200<=Pline(2,1)<=200]; 80 | Constraints=[Constraints, 0<=P_existing_gen(2,2)<=400]; 81 | Constraints=[Constraints, 0<=P_can_gen(2,2)<=sum(P_can_max(1:2,1))]; 82 | Constraints=[Constraints, 0<=P_LS(2,2)<=550]; 83 | Constraints=[Constraints, -pi<=Del(2,2,2)<=pi]; 84 | Constraints=[Constraints, Del(2,2,1)==0]; 85 | %% finding optimal solution (optimal=building 290MW and line 2, cost 109.03M) 86 | ops = sdpsettings('verbose',0,'debug',1); 87 | Solution = optimize(Constraints,Objective,ops) 88 | 89 | Total_cost=value(Objective) 90 | x_BS=value(x_BS) 91 | P_can_max=value(P_can_max) 92 | P_existing_gen=value(P_existing_gen) 93 | P_can_gen=value(P_can_gen) 94 | P_LS=value(P_LS) 95 | 96 | 97 | -------------------------------------------------------------------------------- /EE7400_4_5_Stochastic_static_GTEP.m: -------------------------------------------------------------------------------- 1 | % problem 4.5 2 | 3 | addpath(genpath('C:\Users\loganlamonte\Desktop\YALMIP-master')) 4 | clear classes 5 | clear all 6 | clc 7 | 8 | %% Define problem variables 9 | % Primal variable 10 | P_existing_gen = sdpvar(2,2,'full'); % Generation 11 | P_can_gen = sdpvar(2,2,'full'); % Candidate Generation 12 | P_can_max = sdpvar(1,1,'full'); % Candidate Generation maximum 13 | Pline = sdpvar(2,2,2,2,'full'); % Lines in the 3rd index 14 | Del = sdpvar(2,2,2,2,'full'); % Nodes in the 3rd index 15 | x_BS = binvar(1,1,'full'); % Prospective_branch_status 16 | P_LS = sdpvar(2,2,'full'); % Load shedding amount 17 | M=5000; 18 | 19 | %% Building objective function 20 | Objective= P_can_max(1,1)*70000+x_BS(1,1)*100000+... 21 | 0.5*(6000*(35*P_existing_gen(1,1) + 25*P_can_gen(1,1)+80*P_LS(1,1))+... 22 | 2760*(35*P_existing_gen(1,2) + 25*P_can_gen(1,2)+80*P_LS(1,2)))+... 23 | 0.5*(6000*(35*P_existing_gen(2,1) + 25*P_can_gen(2,1)+80*P_LS(2,1))+... 24 | 2760*(35*P_existing_gen(2,2) + 25*P_can_gen(2,2)+80*P_LS(2,2))); 25 | 26 | %% constraints 27 | Constraints=[]; 28 | Constraints=[Constraints, 0<=sum(P_can_max(1:1,1))<=300]; 29 | Constraints=[Constraints, sum(x_BS(1:1,1))<=1]; 30 | Constraints=[Constraints, x_BS(1,1)*1000000<=2*1000000]; 31 | Constraints=[Constraints, P_can_max(1,1)*700000<=400*1000000]; 32 | 33 | 34 | %% scenerio 1,OpCon 1 35 | Constraints=[Constraints, P_existing_gen(1,1)-Pline(1,1,1,1)-Pline(1,1,1,2)==0]; 36 | Constraints=[Constraints, P_can_gen(1,1)+Pline(1,1,1,1)+Pline(1,1,1,2)==203-P_LS(1,1)]; 37 | Constraints=[Constraints, Pline(1,1,1,1)==500*(Del(1,1,1,1)-Del(1,1,1,2))]; 38 | Constraints=[Constraints, -200*x_BS(1,1)<=Pline(1,1,1,2)<=200*x_BS(1,1)]; 39 | Constraints=[Constraints, -(1-x_BS(1,1))*M<=Pline(1,1,1,2)-500*(Del(1,1,1,1)-Del(1,1,1,2))<=(1-x_BS(1,1))*M]; 40 | Constraints=[Constraints, -200<=Pline(1,1,1,1)<=200]; 41 | % Constraints=[Constraints, -200<=Pline(2,1)<=200]; 42 | Constraints=[Constraints, 0<=P_existing_gen(1,1)<=400]; 43 | Constraints=[Constraints, 0<=P_can_gen(1,1)<=P_can_max(1,1)]; 44 | Constraints=[Constraints, 0<=P_LS(1,1)<=203]; 45 | Constraints=[Constraints, -pi<=Del(1,1,1,2)<=pi]; 46 | Constraints=[Constraints, Del(1,1,1,1)==0]; 47 | 48 | 49 | %% scenerio 1,OpCon 2 50 | Constraints=[Constraints, P_existing_gen(2,1)-Pline(1,2,1,1)-Pline(1,2,1,2)==0]; 51 | Constraints=[Constraints, P_can_gen(2,1)+Pline(1,2,1,1)+Pline(1,2,1,2)==385-P_LS(2,1)]; 52 | Constraints=[Constraints, Pline(1,2,1,1)==500*(Del(1,2,1,1)-Del(1,2,1,2))]; 53 | Constraints=[Constraints, -200*x_BS(1,1)<=Pline(1,2,1,2)<=200*x_BS(1,1)]; 54 | Constraints=[Constraints, -(1-x_BS(1,1))*M<=Pline(1,2,1,2)-500*(Del(1,2,1,1)-Del(1,2,1,2))<=(1-x_BS(1,1))*M]; 55 | Constraints=[Constraints, -200<=Pline(1,2,1,1)<=200]; 56 | % Constraints=[Constraints, -200<=Pline(2,1)<=200]; 57 | Constraints=[Constraints, 0<=P_existing_gen(2,1)<=400]; 58 | Constraints=[Constraints, 0<=P_can_gen(2,1)<=P_can_max(1,1)]; 59 | Constraints=[Constraints, 0<=P_LS(2,1)<=385]; 60 | Constraints=[Constraints, -pi<=Del(1,2,1,2)<=pi]; 61 | Constraints=[Constraints, Del(1,2,1,1)==0]; 62 | 63 | 64 | %% scenerio 2,OpCon 1 65 | Constraints=[Constraints, P_existing_gen(1,2)-Pline(1,1,2,1)-Pline(1,1,2,2)==0]; 66 | Constraints=[Constraints, P_can_gen(1,2)+Pline(1,1,2,1)+Pline(1,1,2,2)==377-P_LS(1,2)]; 67 | Constraints=[Constraints, Pline(1,1,2,1)==500*(Del(1,1,2,1)-Del(1,1,2,2))]; 68 | Constraints=[Constraints, -200*x_BS(1,1)<=Pline(1,1,2,2)<=200*x_BS(1,1)]; 69 | Constraints=[Constraints, -(1-x_BS(1,1))*M<=Pline(1,1,2,2)-500*(Del(1,1,2,1)-Del(1,1,2,2))<=(1-x_BS(1,1))*M]; 70 | Constraints=[Constraints, -200<=Pline(1,1,2,1)<=200]; 71 | % Constraints=[Constraints, -200<=Pline(2,1)<=200]; 72 | Constraints=[Constraints, 0<=P_existing_gen(1,2)<=400]; 73 | Constraints=[Constraints, 0<=P_can_gen(1,2)<=P_can_max(1,1)]; 74 | Constraints=[Constraints, 0<=P_LS(1,2)<=377]; 75 | Constraints=[Constraints, -pi<=Del(1,1,2,2)<=pi]; 76 | Constraints=[Constraints, Del(1,1,2,1)==0]; 77 | 78 | 79 | %% scenerio 2,OpCon 2 80 | Constraints=[Constraints, P_existing_gen(2,2)-Pline(1,2,2,1)-Pline(1,2,2,2)==0]; 81 | Constraints=[Constraints, P_can_gen(2,2)+Pline(1,2,2,1)+Pline(1,2,2,2)==715-P_LS(2,2)]; 82 | Constraints=[Constraints, Pline(1,2,2,1)==500*(Del(1,2,2,1)-Del(1,2,2,2))]; 83 | Constraints=[Constraints, -200*x_BS(1,1)<=Pline(1,2,2,2)<=200*x_BS(1,1)]; 84 | Constraints=[Constraints, -(1-x_BS(1,1))*M<=Pline(1,2,2,2)-500*(Del(1,2,2,1)-Del(1,2,2,2))<=(1-x_BS(1,1))*M]; 85 | Constraints=[Constraints, -200<=Pline(1,2,2,1)<=200]; 86 | % Constraints=[Constraints, -200<=Pline(2,1)<=200]; 87 | Constraints=[Constraints, 0<=P_existing_gen(2,2)<=400]; 88 | Constraints=[Constraints, 0<=P_can_gen(2,2)<=P_can_max(1,1)]; 89 | Constraints=[Constraints, 0<=P_LS(2,2)<=715]; 90 | Constraints=[Constraints, -pi<=Del(1,2,2,2)<=pi]; 91 | Constraints=[Constraints, Del(1,2,2,1)==0]; 92 | 93 | 94 | %% finding optimal solution (optimal=building 290MW and line 2, cost 109.03M) 95 | ops = sdpsettings('verbose',0,'debug',1); 96 | Solution = optimize(Constraints,Objective,ops) 97 | 98 | Total_cost=value(Objective) 99 | x_BS=value(x_BS) 100 | P_can_max=value(P_can_max) 101 | P_existing_gen=value(P_existing_gen) 102 | P_can_gen=value(P_can_gen) 103 | P_LS=value(P_LS) 104 | -------------------------------------------------------------------------------- /EE7400_4_6_Stochastic_dynamic_GTEP.m: -------------------------------------------------------------------------------- 1 | clc 2 | clear all 3 | 4 | Demand=zeros(2,2,4); 5 | Demand(:,:,1)=[212,402;214,407]; 6 | Demand(:,:,2)=[212,402;284,539]; 7 | Demand(:,:,3)=[281,533;284,539]; 8 | Demand(:,:,4)=[281,533;377,715]; 9 | %% Define problem variables 10 | % Primal variable 11 | P_existing_gen = sdpvar(2,2,4,'full'); % Generation 12 | P_can_gen = sdpvar(2,2,4,'full'); % Candidate Generation 13 | P_can_max = sdpvar(2,1,4,'full'); % Candidate Generation maximum 14 | Pline = sdpvar(2,2,4,2,'full'); % Lines in the 3rd index 15 | Del = sdpvar(2,2,4,2,'full'); % Nodes in the 3rd index 16 | x_BS = binvar(2,1,4,'full'); % Prospective_branch_status 17 | P_LS = sdpvar(2,2,4,'full'); % Load shedding amount 18 | M=5000; 19 | 20 | %% Building objective function 21 | Objective=0; 22 | % for w=1:4 23 | % Objective= 0.25*(P_can_max(1,1,w)*140000+x_BS(1,1,w)*200000+... P_can_gen = sdpvar(1,2,2,'full'); 24 | % P_can_max(2,1,w)*70000+x_BS(2,1,w)*100000+... 25 | % 6000*(35*P_existing_gen(1,1,w)+25*P_can_gen(1,1,w)+80*P_LS(1,1,w))+... 26 | % 2760*(35*P_existing_gen(1,2,w)+25*P_can_gen(1,2,w)+80*P_LS(1,2,w))+... 27 | % 6000*(35*P_existing_gen(2,1,w)+25*P_can_gen(2,1,w)+80*P_LS(2,1,w))+... 28 | % 2760*(35*P_existing_gen(2,2,w)+25*P_can_gen(2,2,w)+80*P_LS(2,2,w))); 29 | % end 30 | 31 | sigma=[6000,2760]; 32 | gen_inv_cost=[140000,70000]; 33 | line_inv_cost=[200000,100000]; 34 | for w=1:4 35 | for t=1:2 36 | Objective = Objective + 0.25*P_can_max(t,1,w)*gen_inv_cost(t)+0.25*x_BS(t,1,w)*line_inv_cost(t); % investment cost 37 | for op=1:2 38 | Objective=Objective+sigma(op)*0.25*(35*P_existing_gen(t,op,w) + 25*P_can_gen(t,op,w)+80*P_LS(t,op,w)); % operating cost 39 | end 40 | end 41 | end 42 | 43 | Constraints=[]; 44 | Constraints=[Constraints,P_can_max(1,1,1)==P_can_max(1,1,2)]; 45 | Constraints=[Constraints,P_can_max(1,1,2)==P_can_max(1,1,3)]; 46 | Constraints=[Constraints,P_can_max(1,1,3)==P_can_max(1,1,4)]; 47 | Constraints=[Constraints,P_can_max(2,1,1)==P_can_max(2,1,2)]; 48 | Constraints=[Constraints,P_can_max(2,1,3)==P_can_max(2,1,4)]; 49 | 50 | Constraints=[Constraints,x_BS(1,1,1)==x_BS(1,1,2)]; 51 | Constraints=[Constraints,x_BS(1,1,2)==x_BS(1,1,3)]; 52 | Constraints=[Constraints,x_BS(1,1,3)==x_BS(1,1,4)]; 53 | Constraints=[Constraints,x_BS(2,1,1)==x_BS(2,1,2)]; 54 | Constraints=[Constraints,x_BS(2,1,3)==x_BS(2,1,4)]; 55 | 56 | 57 | for w=1:4 58 | Constraints=[Constraints, 0<=sum(P_can_max(1:2,1,w))<=300]; 59 | Constraints=[Constraints, sum(x_BS(1:2,1,w))<=1]; 60 | Constraints=[Constraints, x_BS(1,1,w)*1000000<=2*1000000]; 61 | Constraints=[Constraints, P_can_max(1,1,w)*700000<=400*1000000]; 62 | Constraints=[Constraints, x_BS(2,1,w)*1000000<=2*1000000]; 63 | Constraints=[Constraints, P_can_max(2,1,w)*700000<=400*1000000]; 64 | 65 | for t=1:2 66 | for op=1:2 67 | Constraints=[Constraints, P_existing_gen(t,op,w)-Pline(t,op,w,1)-Pline(t,op,w,2)==0]; 68 | Constraints=[Constraints, P_can_gen(t,op,w)+Pline(t,op,w,1)+Pline(t,op,w,2)==Demand(t,op,w)-P_LS(t,op,w)]; 69 | Constraints=[Constraints, Pline(t,op,w,1)==500*(Del(t,op,w,1)-Del(t,op,w,2))]; 70 | Constraints=[Constraints, -200<=Pline(t,op,w,1)<=200]; 71 | Constraints=[Constraints, -200*sum(x_BS(1:t,1,w))<=Pline(t,op,w,2)<=200*sum(x_BS(1:t,1,w))]; 72 | Constraints=[Constraints, -(1-sum(x_BS(1:t,1,w)))*M<=Pline(t,op,w,2)-500*(Del(t,op,w,1)-Del(t,op,w,2))<=(1-sum(x_BS(1:t,1,w)))*M]; 73 | % Constraints=[Constraints, -200<=Pline(2,1)<=200]; 74 | Constraints=[Constraints, 0<=P_existing_gen(t,op,w)<=400]; 75 | Constraints=[Constraints, 0<=P_can_gen(t,op,w)<=sum(P_can_max(1:t,1,w))]; 76 | Constraints=[Constraints, 0<=P_LS(t,op,w)<=Demand(t,op,w)]; 77 | Constraints=[Constraints, -pi<=Del(t,op,w,2)<=pi]; 78 | Constraints=[Constraints, Del(t,op,w,1)==0]; 79 | end 80 | end 81 | end 82 | 83 | %% finding optimal solution (optimal=building 290MW and line 2, cost 109.03M) 84 | ops = sdpsettings('verbose',0,'debug',1); 85 | Solution = optimize(Constraints,Objective,ops) 86 | % optimal cost=203554350 87 | Total_cost=value(Objective) 88 | x_BS=value(x_BS) 89 | P_can_max=value(P_can_max) 90 | P_existing_gen=value(P_existing_gen) 91 | P_can_gen=value(P_can_gen) 92 | P_LS=value(P_LS) 93 | value(Objective) 94 | 95 | -------------------------------------------------------------------------------- /EE7400_D_1_Risk_neutral_GEP_problem.m: -------------------------------------------------------------------------------- 1 | clc 2 | clear all 3 | P_can_max=sdpvar(2,1,15,'full'); 4 | P_esixting_gen=sdpvar(2,2,15,'full'); 5 | P_can_gen=sdpvar(2,1,15,'full'); 6 | 7 | 8 | cost=[240e3;270e3;300e3;360e3;450e3;240e3;270e3;300e3;360e3;450e3;240e3;270e3;300e3;360e3;450e3]; 9 | Demand=[2000,2400;2000,2400;2000,2400;2000,2400;2000,2400;2250,2700;2250,2700;2250,2700;2250,2700;2250,2700;... 10 | 2500,3000;2500,3000;2500,3000;2500,3000;2500,3000]; 11 | 12 | Objective=0; 13 | for w=1:15 14 | Objective=Objective+(1/15)*(8760*(14*(P_esixting_gen(1,1,w)+P_esixting_gen(2,1,w))+... 15 | 20*(P_esixting_gen(1,2,w)+P_esixting_gen(2,2,w))+... 16 | 15*(P_can_gen(1,1,w)+P_can_gen(2,1,w)))+... 17 | (0.3*300000)*P_can_max(1,1,w)+0.15*cost(w)*P_can_max(2,1,w)); 18 | end 19 | 20 | Constraints=[]; 21 | for w=1:14 22 | Constraints=[Constraints, P_can_max(1,1,w)==P_can_max(1,1,w+1)]; 23 | end 24 | for w=1:15 25 | Constraints=[Constraints, 0<=P_can_max(1,1,w)<=1500]; 26 | Constraints=[Constraints, 0<=P_can_max(2,1,w)<=1500]; 27 | 28 | Constraints=[Constraints,P_esixting_gen(1,1,w)+P_esixting_gen(1,2,w)+P_can_gen(1,1,w)==Demand(w,1)]; 29 | Constraints=[Constraints,P_esixting_gen(2,1,w)+P_esixting_gen(2,2,w)+P_can_gen(2,1,w)==Demand(w,2)]; 30 | 31 | Constraints=[Constraints, 0<=P_esixting_gen(1,1,w)<=1000]; 32 | Constraints=[Constraints, 0<=P_esixting_gen(2,1,w)<=1000]; 33 | Constraints=[Constraints, 0<=P_esixting_gen(1,2,w)<=800]; 34 | Constraints=[Constraints, 0<=P_esixting_gen(2,2,w)<=800]; 35 | Constraints=[Constraints, 0<=P_can_gen(1,1,w)<=P_can_max(1,1,w)]; 36 | Constraints=[Constraints, 0<=P_can_gen(2,1,w)<=P_can_max(1,1,w)+P_can_max(2,1,w)]; 37 | end 38 | Solution=optimize(Constraints,Objective) 39 | 40 | P_can_max=value(P_can_max) 41 | 42 | 43 | -------------------------------------------------------------------------------- /EE7400_D_2_Risk_constrained_GEP_problem.m: -------------------------------------------------------------------------------- 1 | clc 2 | clear all 3 | 4 | cost=[240e3;270e3;300e3;360e3;450e3;240e3;270e3;300e3;360e3;450e3;240e3;270e3;300e3;360e3;450e3]; 5 | Demand=[2000,2400;2000,2400;2000,2400;2000,2400;2000,2400;2250,2700;2250,2700;2250,2700;2250,2700;2250,2700;... 6 | 2500,3000;2500,3000;2500,3000;2500,3000;2500,3000]; 7 | beta=[0.1,1,1.5,5,10]; 8 | 9 | 10 | for i=1:length(beta) 11 | P_can_max=sdpvar(2,1,15,'full'); 12 | P_esixting_gen=sdpvar(2,2,15,'full'); 13 | P_can_gen=sdpvar(2,1,15,'full'); 14 | jita=sdpvar(1,1,'full'); 15 | ita=sdpvar(15,1,'full'); 16 | 17 | Objective1=0; 18 | Objective2=0; 19 | for w=1:15 20 | Objective1=Objective1+(1/15)*(8760*(14*(P_esixting_gen(1,1,w)+P_esixting_gen(2,1,w))+... 21 | 20*(P_esixting_gen(1,2,w)+P_esixting_gen(2,2,w))+... 22 | 15*(P_can_gen(1,1,w)+P_can_gen(2,1,w)))+... 23 | (0.3*300000)*P_can_max(1,1,w)+0.15*cost(w)*P_can_max(2,1,w)); 24 | 25 | Objective2=Objective2+(1/(1-0.8))*(1/15)*ita(w,1); 26 | end 27 | 28 | Objective2=-beta(i)*(jita-Objective2); 29 | Objective=Objective1+Objective2; 30 | 31 | 32 | Constraints=[]; 33 | for w=1:14 34 | Constraints=[Constraints, P_can_max(1,1,w)==P_can_max(1,1,w+1)]; 35 | end 36 | for w=1:15 37 | Constraints=[Constraints, 0<=P_can_max(1,1,w)<=1500]; 38 | Constraints=[Constraints, 0<=P_can_max(2,1,w)<=1500]; 39 | 40 | Constraints=[Constraints,P_esixting_gen(1,1,w)+P_esixting_gen(1,2,w)+P_can_gen(1,1,w)==Demand(w,1)]; 41 | Constraints=[Constraints,P_esixting_gen(2,1,w)+P_esixting_gen(2,2,w)+P_can_gen(2,1,w)==Demand(w,2)]; 42 | 43 | Constraints=[Constraints, 0<=P_esixting_gen(1,1,w)<=1000]; 44 | Constraints=[Constraints, 0<=P_esixting_gen(2,1,w)<=1000]; 45 | Constraints=[Constraints, 0<=P_esixting_gen(1,2,w)<=800]; 46 | Constraints=[Constraints, 0<=P_esixting_gen(2,2,w)<=800]; 47 | Constraints=[Constraints, 0<=P_can_gen(1,1,w)<=P_can_max(1,1,w)]; 48 | Constraints=[Constraints, 0<=P_can_gen(2,1,w)<=P_can_max(1,1,w)+P_can_max(2,1,w)]; 49 | 50 | Constraints=[Constraints, jita+(8760*(14*(P_esixting_gen(1,1,w)+P_esixting_gen(2,1,w))+... 51 | 20*(P_esixting_gen(1,2,w)+P_esixting_gen(2,2,w))+... 52 | 15*(P_can_gen(1,1,w)+P_can_gen(2,1,w)))+... 53 | (0.3*300000)*P_can_max(1,1,w)+0.15*cost(w)*P_can_max(2,1,w))<=ita(w,1)]; 54 | Constraints=[Constraints, ita(w)>=0]; 55 | 56 | end 57 | Solution=optimize(Constraints,Objective) 58 | 59 | P_can_max=value(P_can_max) 60 | Obj1(i)=value(Objective1); 61 | Obj2(i)=value(Objective2); 62 | clearvars -except cost Demand beta Obj1 Obj2 63 | end 64 | 65 | figure() 66 | plot(Obj2, Obj1) -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Transmission-and-Generation-Expansion-Plannnig---Optimization-of-Mixed-Integer-Non-Convex-Problems 2 | This repository contains various Transmission and Generation related optimization problem. The problems are solved using YALMIP toolbox with CPLEX solver. 3 | The problems are picked from Book **"Investment In Electricity Generation and Transmission_Decision Making Under Uncertainty (2016)" by Antonio J. Conejo, Luis Baringo, S. Jalal Kazempour, Afzal S. Siddiqui** 4 | --------------------------------------------------------------------------------