XDETEQ Command

The XDETEQ command displays the explicit deterministic equivalent (DE) for the current model, assuming the current model is a stochastic program (SP).  Viewing the DE can be very helpful in determining if you have properly set up the SP components of your model.  You can refer to Chapter 14, Stochastic Programming, for more information on SP.

When LINGO solves an SP model, it is really solving the deterministic equivalent of the original SP.  The DE contains one instance of the original core model for each scenario, where the random variables in each instance are replaced by their sampled values for the particular scenario. These core instances are tied together by a probabilistically weighted objective of all the objectives form the individual scenarios, plus a set of nonanticipativity constraints.  The nonanticipativity constraints enforce the condition that all scenarios with the same history must implement the same decisions, otherwise, the DE would have the ability to anticipate future events.

As an example below, we load the SP gas buying sample model, SPGAS, and run the XDETEQ command:

: take \lingo\samples\spgas.lng

: xdeteq

 

 MODEL:

 TITLE _DETEQ;

 [ _1] MIN = 0.3333333333333333 * PURCHASE_COST_SC1

 + 0.3333333333333333 * HOLD_COST_SC1 + 0.3333333333333333 *

 PURCHASE_COST_SC2 + 0.3333333333333333 * HOLD_COST_SC2

 + 0.3333333333333333 * PURCHASE_COST_SC3 + 0.3333333333333333

 * HOLD_COST_SC3;

 [ _2_SC01]  PURCHASE_COST_SC1 - 5 * PURCHASE_1_SC1 - 5 *

 PURCHASE_2_SC1 = 0;

 [ _3_SC01]  HOLD_COST_SC1 -  INVENTORY_1_SC1 -

 INVENTORY_2_SC1 = 0;

 [ _4_SC01]  INVENTORY_1_SC1 -  PURCHASE_1_SC1 = - 100;

 [ _5_SC01] -  INVENTORY_1_SC1 +  INVENTORY_2_SC1 -

 PURCHASE_2_SC1 = - 100;

 [ _2_SC02]  PURCHASE_COST_SC2 - 5 * PURCHASE_1_SC2 - 6 *

 PURCHASE_2_SC2 = 0;

 [ _3_SC02]  HOLD_COST_SC2 -  INVENTORY_1_SC2 -

 INVENTORY_2_SC2 = 0;

 [ _4_SC02]  INVENTORY_1_SC2 -  PURCHASE_1_SC2 = - 100;

 [ _5_SC02] -  INVENTORY_1_SC2 +  INVENTORY_2_SC2 -

 PURCHASE_2_SC2 = - 150;

 [ _2_SC03]  PURCHASE_COST_SC3 - 5 * PURCHASE_1_SC3 - 7.5 *

 PURCHASE_2_SC3 = 0;

 [ _3_SC03]  HOLD_COST_SC3 -  INVENTORY_1_SC3 -

 INVENTORY_2_SC3 = 0;

 [ _4_SC03]  INVENTORY_1_SC3 -  PURCHASE_1_SC3 = - 100;

 [ _5_SC03] -  INVENTORY_1_SC3 +  INVENTORY_2_SC3 -

 PURCHASE_2_SC3 = - 180;

 [ _NAC01]  INVENTORY_1_SC1 -  INVENTORY_1_SC2 = 0;

 [ _NAC02]  PURCHASE_1_SC1 -  PURCHASE_1_SC2 = 0;

 [ _NAC03]  INVENTORY_1_SC1 -  INVENTORY_1_SC3 = 0;

 [ _NAC04]  PURCHASE_1_SC1 -  PURCHASE_1_SC3 = 0;

 END

 

:

The first row of the DE is the probabilistically weighted objective over the three scenarios (Normal, Cold and Very Cold).  Note that in the original core model, we had a variable called PURCHASE_COST, which was used to compute the cost of the gas purchases.  In the DE we now have three PURCHASE_COST variables, or one for each of the three scenarios.  LINGO appends the strings _SC1, _SC2 or _SC3 to PUCHASE_COST so as to indicate the appropriate scenario.  Each of the constraints from the core model are also replicated across each of the scenarios with the appropriate scenario tag appended to each row's name.  Finally, at the bottom of the model, there are four constraints beginning with the string: _NAC, which are the nonanticipativity constraints.

It's worthwhile pointing out that this report on DE for SPGAS is a valid LINGO model, too.  In fact, you can copy this report from into a new model file and solve it directly, in which case, you will get the optimal solution to the original SP model.