(!****************************************************** 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: Explicit: The demand in the subsequent year depends on the earlier years’ demand and hence, all possible realizations are explicitly defined. 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) 2005 Dash Associates Author: Nitin Verma Dash Optimization Inc, NJ *******************************************************!) model CapacityExpansion uses 'mmsp' parameters T=4 !years DIR="Data/" end-parameters forward procedure generateExplicitTree 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) !setparam('xsp_ive_enable',false) spsetstages(Stages) generateExplicitTree 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) 1*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) 1*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) 1*y(i,j,t+1)<=(g(i,t)+w(i,t)); else Capacity(i,t):=sum(j in Modes) 1*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 generateExplicitTree declarations S=7 !#scenarios A:array(1..S,1..T) of integer !#node numbers in tree N:array(1..T) of integer !#number of nodes in each stage end-declarations initializations from DIR+'CapacityExpansionExplicit.dat' A N end-initializations spcreatetree(A) Nmax:=max(t in 1..T) N(t) declarations val:array(2..T,Modes,1..Nmax) of real prob:array(2..T,1..Nmax) of real end-declarations initializations from DIR+'CapacityExpansionExplicit.dat' val prob end-initializations forall(t in 2..T,n in 1..N(t)) spsetprobcondatnode(t,n,prob(t,n)) forall(t in 2..T,j in Modes,n in 1..N(t)) spsetrandatnode(d(j,t),n,val(t,j,n)) spgentree end-procedure end-model