(!****************************************************** Xpress-SP Example ====================== `````````````````` FILE: CapacityExpansionExhaustive.mos DESCRIPTION: Stochastic multi-stage linear model TYPE: Energy In a power-generating plant, we consider three modes of operations; namely low, average, and high. Clearly, the trend of power demanded in each year may vary depending on various factors such as rainfall, weather conditions, etc. We also consider three technologies (old, current, and new). Capacity expansion plans and the operational decisions need to be laid out for next three years. The objective is to minimize the expected total investment and production cost. MODEL: • Sets o Stages=1..4 :indexed by t o Technology={old,curr,new} :indexed by i o Modes={low,avg,high} :indexed by j • Data o g(i,t): existing capacity of technology i added at time t o r(i,t):investment cost per unit of capacity of technology i added at time t o q(i,t):production cost per unit of capacity of technology i added at time t • Decision variables o x(i,t): capacity of technology i added at time t o y(i,j,t):capacity of type i dedicated in mode j at time t • Constraints o Accumulated Capacity balance o Demand balance • Objective o minimize the expected total investment and production cost The capacities are added in the first two years and hence the total available capacities are realized in the second and the third year. In the years second through fourth, the available capacities are distributed among different modes. The scenarios are created by discretizing the load-duration curve. For simplicity, the duration in each mode is considered one-third of a year. We present following way of generating scenarios: Exhaustive: The demand (low, average, and high) has an independent distribution in each year. FURTHER INFO: see section II.4.6: Capacity Expansion of Electric Power Generation Systems, 'Stochastic Modeling in Economics and Finance' - Jitka Dipacova, Jan Hurt, and Joseph Stepan, Kluwer Academic Publishers see Xpress-SP guide DATE: Oct 2006 (c) 2006 Dash Associates Author: Nitin Verma Dash Optimization Inc, NJ *******************************************************!) model CapacityExpansion uses 'mmsp' parameters T=4 !years DIR="Data/" end-parameters forward procedure generateExhaustiveTree declarations Stages=1..T Technology={"old","curr","new"} Modes={"low","avg","high"} r:array(Technology,1..T-2) of real !investment cost in $1000/MW capacity added g:array(Technology,1..T-1) of real !existing capacity in MW q:array(Technology,2..T) of real !unit production cost in $1000/MWh tau:real !time in hour spent in each mode Budget:real !maximum additional capacity that can be added in MW Penalty:real !for not meeting demand in $1000/MW end-declarations declarations d:array(Modes,2..T) of sprand !total demand in MW umd:array(Modes,1..T-1) of spvar !total unmet demand in MW x:array(Technology,1..T-2) of spvar !additional capacity in MW w:array(Technology,2..T-1) of spvar !total available capacity in MW y:array(Technology,Modes,2..T) of spvar !capacity used in production in MW Cost:splinctr BudgetSpent:splinctr AccumulatedCapacity:array(Technology,2..T-1) of splinctr Demand:array(Modes,1..T-1) of splinctr Capacity:dynamic array(Technology,1..T-1) of splinctr end-declarations ! Read in data from external file initializations from DIR+'CapacityExpansion.dat' r q g tau Budget Penalty end-initializations setparam('xsp_implicit_stage',true) spsetstages(Stages) generateExhaustiveTree Cost:=sum(t in 1..T-2,i in Technology) r(i,t)*x(i,t) + sum(t in 2..T,i in Technology,j in Modes) q(i,t)*tau*y(i,j,t) + sum(j in Modes,t in 1..T-1) Penalty*umd(j,t) BudgetSpent:=sum(i in Technology,t in 1..T-2) x(i,t)<=Budget forall(i in Technology,t in 2..T-1) if(t-1>=2) then AccumulatedCapacity(i,t):=w(i,t)=x(i,t-1)+w(i,t-1); else AccumulatedCapacity(i,t):=w(i,t)=x(i,t-1) end-if forall(j in Modes,t in 1..T-1) Demand(j,t):=umd(j,t)+ sum(i in Technology) y(i,j,t+1)>=d(j,t+1) forall(i in Technology,t in 1..T-1) if(t>=2) then Capacity(i,t):=sum(j in Modes) y(i,j,t+1)<=(g(i,t)+w(i,t)); else Capacity(i,t):=sum(j in Modes) y(i,j,t+1)<=g(i,t) end-if forall(t in 2..T) OperatingCost(t):=sum(i in Technology,j in Modes) q(i,t)*tau*y(i,j,t) minimize(Cost) writeln(getobjval) procedure generateExhaustiveTree declarations E=3 !max # values, each demand can assume val,prob:array(Modes,2..T,1..E) of real end-declarations initializations from DIR+'CapacityExpansionExhaustive.dat' val prob end-initializations declarations vals,probs:array(1..E) of real end-declarations forall(j in Modes,t in 2..T) do forall(e in 1..E) do vals(e):=val(j,t,e) probs(e):=prob(j,t,e) end-do spsetdist(d(j,t),vals,probs) end-do spgenexhtree end-procedure end-model