SCENE Command
The ability to generate the deterministic equivalent (DE) of a stochastic programming (SP) model via the XDETEQ command 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 model for 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 gas buying model. In the following example, we load the SP model and then use the SCENE command to generate the algebraic formulation of the second scenario:
: take \lingo\samples\spgas.lng
: scene 2
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.