Download here in PDF

Transcript
622 CHAPTER 14
Note: Guidelines for determining the variables and rows that must be explicitly staged are:
♦ All random variables must be assigned to a stage using @SPSTGRNDV.
♦ Any initial decision or recourse variable that belongs to stage N that does not depend either
directly, or indirectly, on another variable (random or otherwise) declared to be in stage N
must be explicitly assigned to stage N using @SPSTGVAR.
♦ If you are uncertain whether a particular variable must be explicitly assigned to a stage, or
not, then it doesn't hurt to assign it anyway using @SPSTGVAR.
♦ In general, stage assignment for rows should be left to LINGO. Each row will be assigned
to the stage equal to the maximum stage of the variables appearing in that row. However,
if you wish to explicitly specify a row’s stage, you may always do so using
@SPSTGROW.
Step 4 - Declare Distributions
Next, we need to declare the joint probability distribution for the random variables COST_2 and
DEMAMD_2. In this case, we will be using an outcome table distribution, and in order to declare our
distribution we will make use of the scalar-based functions: @SPTABLESHAPE and
@SPTABLEOUTC, @SPTABLEINST and @SPTABLERNDV.
@SPTABLESHAPE initializes the distribution with a name, number of outcomes and number of jointly
distributed variables, while @SPTABLEOUTC is called once for each outcome to load information
relevant to each outcome:
!Declare a discrete distribution called 'DST_DMD' with
three outcomes and two jointly distributed variables
(i.e., Demand and Cost);
@SPTABLESHAPE( 'DST_DMD', 3, 2);
!Load the three equally likely outcomes into 'DST_DMD';
!
Dist Name Probability
Cost
Demand;
@SPTABLEOUTC( 'DST_DMD',
1/3,
5.0,
100);
@SPTABLEOUTC( 'DST_DMD',
1/3,
6.0,
150);
@SPTABLEOUTC( 'DST_DMD',
1/3,
7.5,
180);
@SPTABLESHAPE accepts three arguments: a name for the distribution, the number of outcomes and
the number of jointly distributed variables in the distribution. In this case, we've titled the distribution
'DST_DMD', and it has three outcomes along with two jointly distributed variables.
Now, to be able to actually apply the distribution to random variables we need to declare an instance of
the distribution. By doing things this way, it's possible to reuse the same outcome table on more than
one set of random variables. We declare an instance of a particular distribution using the
@SPTABLEINST function, which accepts two arguments - the name of the parent distribution and a
new name for the instance of the distribution. In the case of our example, we do the following: