As mentioned in the previous section, the ability to generate the deterministic equivalent (DE) of a stochastic programming (SP) model can be very useful when initially formulating and debugging an SP model. The only problem is that the DE can become quite unwieldy for all but the simplest SPs. For example, if the core model has 500 variables and there are 1,000 scenarios, then the DE will have 500,000 variables. Tracking down problems in such a large model can be difficult. Fortunately, in most cases when an SP is either infeasible or unbounded, LINGO will report the index of the first scenario that is causing the problem. With such information, we can focus our attention on the isolated scenario that's causing the problem. This is where the Scenario command comes in - it allows us to generate the formulation for an individual scenario, as opposed to the entire DE, which should substantially cut down on the burden of our debugging task.
As an example, we will work again with the SPGAS.LG4 gas buying model. After loading the model and issuing the Solver|Generate|Scenario command, we are prompted for the index of the scenario we wish to view:
For our purposes, suppose we are interested in viewing scenario 2, in which case, we enter a 2 in the edit box and then press the OK button. LINGO the displays the following report:
MODEL:
TITLE Scenario 2;
[ _1] MIN = PURCHASE_COST + HOLD_COST;
[ _2] PURCHASE_COST - 5 * PURCHASE_1 - 6 * PURCHASE_2 = 0;
[ _3] HOLD_COST - INVENTORY_1 - INVENTORY_2 = 0;
[ _4] INVENTORY_1 - PURCHASE_1 = - 100;
[ _5] - INVENTORY_1 + INVENTORY_2 - PURCHASE_2 = - 150;
END
You will note that this is the core model, with the period 2 random variable DEMAND replaced by its sampled value of 150 in row 5. Nonanticipativity constraints are not generated as part of individual scenario models.