Our first example of how to formulate and solve an SP is a gas buying example.  This example was taken from the Committee on Stochastic Programming's (COSP) website: http://stoprog.org/index.html?spintroduction.html.  The complete LINGO model can be found in the LINGO samples folder under the name SPGAS1.LG4.

A gas company must come up with a plan for its gas purchases under uncertain weather conditions.  The demand for the current period (period 1) is known and is 100 units.  The demand for the upcoming period is not known with certainty and will depend on how cold the weather is.  There are three possible outcomes for the weather: normal, cold and very cold.  Each of these outcomes are equally likely.  The following table lists the costs and demands under the three outcomes

Outcome

Probability

Gas Cost/Unit ($)

Units Demand

Normal

1/3

5.0

100

Cold

1/3

6.0

150

Very Cold

1/3

7.5

180

Gas for the current period is bought now and delivered directly to the customers at a cost of $5 per unit.  Gas in the upcoming period can either be bought now and held in storage for period 2 use, or it can be purchased in period 2 at a price that will depend on the weather as per the table above.  Storing gas bought in period 1 for use in period 2 costs the company $1 per unit.  The question the company is faced with is:  How much gas should be bought in periods 1 and 2 to meet total customer demand at minimal expected cost?