Step 1 - Defining the Core Model:

The core model is the same optimization model we would construct if all the random variables were known with certainty.  There is nothing in the core model that addresses the stochastic nature of the model.  The stochastic properties of the model will be introduced in a subsequent model section.  For our current example, the core model is formulated as follows:

! Minimize Total Cost = Purchases + Holding;

[R_OBJ] MIN= PURCHASE_COST + HOLD_COST;

 

! Compute purchase cost;

[R_PC] PURCHASE_COST = 5 * PURCHASE_1 + COST_2 * PURCHASE_2;

 

! Compute holding cost;

[R_HC] HOLD_COST = INVENTORY_1 + INVENTORY_2;

 

! Compute inventory levels;

[R_I1] INVENTORY_1 = PURCHASE_1 - 100;

[R_I2] INVENTORY_2 = INVENTORY_1 + PURCHASE_2 - DEMAND_2;

Core Model for Gas Buying Example

In the first expression:

! Minimize Total Cost = Purchases + Holding;

[R_OBJ] MIN= PURCHASE_COST + HOLD_COST;

we are saying that we want to minimize total cost, which consists of two components: the purchase cost of buying gas in periods 1 and 2, as well as holding costs of buying gas in a current period for use in a future period.

The following expression:

! Compute purchase cost;

[R_PC] PURCHASE_COST = 5 * PURCHASE_1 + COST_2 * PURCHASE_2;

calculates the total purchase cost, which is $5 per unit of gas purchased in period 1 plus the cost of gas in period 2 (COST_2) multiplied by the number of units of gas purchased in period 2.  Note that COST_2 is stochastic and will depend on how the weather plays out.  We will convey the probabilistic nature of period 2 cost in the next section.

We next compute total holding costs, which, given the $1/unit holding cost, is simply the sum of units held over in periods 1 and 2:

! Compute holding cost;

[R_HC] HOLD_COST = INVENTORY_1 + INVENTORY_2;

Finally, we compute the inventory levels for the two periods:

! Compute inventory levels;

[R_I1] INVENTORY_1 = PURCHASE_1 - 100 ;

[R_I2] INVENTORY_2 = INVENTORY_1 + PURCHASE_2 - DEMAND_2;

Period 1's inventory is the amount purchased in period 1 (PURCHASE_1) less the known demand in period 1.  While inventory in period 2 (INVENTORY_2) if equal to any inventory carried over from period 2 plus the purchase in period 2 (PURCHASE_2) minus the demand in period 2 (DEMAND_2).  Once again, DEMAND_2 is not known with certainty.  The uncertain nature of DEMAND_2 will be established in the next section of the model - the stochastic declarations section.