# AMPL model file for gas company two-stage stochastic programming example # from NEOS Server # Modified to be a split variable formulation by Andy Philpott # # Original source model from # http://www-fp.mcs.anl.gov/otc/Guide/CaseStudies/slp/ # param LastPeriod > 0; # Number of periods in the model param LastScenario >= 0; # Number of scenarios in the model set T := 0..LastPeriod; set S := 0..LastScenario; param PurchasePrice{t in T, s in S} >= 0; param Demand {t in T, s in S} >= 0; param Probability {s in S} >= 0; param StorageCost > 0; # VARIABLES # # Note decision variables are replicated in period 0 for each scenario # var Purchase {t in T, s in S} >= 0; var UseFromStorage {t in T, s in S} >= 0; var Storage {t in -1..LastPeriod,s in S} >= 0; # OBJECTIVE FUNCTION # minimize TotalCost: sum{t in T, s in S} Probability[s] * (PurchasePrice[t,s] * Purchase[t,s] + StorageCost * Storage[t,s]); # CONSTRAINTS # subject to MeetDemand{t in T, s in S }: Purchase[t,s] + UseFromStorage[t,s] >= Demand[t,s]; subject to StorageBalance{t in T, s in S }: Storage[t,s] = Storage[t-1,s] + Purchase[t,s] - Demand[t,s]; subject to UseLessThanHave{t in T, s in S }: UseFromStorage[t,s] <= Storage[t-1,s]; subject to InitialStorage: Storage[-1,0] = 0; # NONANTICIPATIVITY CONSTRAINTS ON FIRST STAGE VARIABLES # # Comment out the remaining constraints to compute a # wait-and-see solution subject to NAPurchase {s in 1..LastScenario }: Purchase[0,s] = Purchase[0,s-1]; subject to NAUseFromStorage {s in 1..LastScenario }: UseFromStorage[0,s] = UseFromStorage[0,s-1]; subject to NAStorage {s in 1..LastScenario }: Storage[0,s] = Storage[0,s-1];