Download LINDO API USER MANUAL
Transcript
STOCHASTIC PROGRAMMING
543
Automatic Sampling of Scenario Trees
As an alternative to generation of explicit sample points to be used for setting up explicit scenarios,
LINDO API offers an easy to use function LSloadSampleSizes() to create finite scenario trees
implicitly with user-specified dimensions. This is especially handy when there are several stochastic
parameters and the task of explicit sampling becomes tedious. In this context, the user can specify the
dimensions of a scenario tree by either of the following methods:
Specify the number of nodes per stage: In this method, the user should provide an integer
array of length T (number of stages in the model) and give in each position the number of
nodes to be created in that stage. By default stage-0 will always one node, thus the 0th index in
the array will be one. Other positions in the array, corresponding to the number of nodes in
stages 1,2,…T-1, may take any positive integer values. In this framework, each node
represents a block realization of all the stochastic parameters in that stage and will have a
conditional probability of 1/Nt, where Nt represents the number of nodes in stage t.
Specify the sample size per stochastic parameter: In this method, the user should provide
an integer array of length S (the number stochastic parameters in the model), and give in each
position the samples size for that stochastic parameter.
In either case, LINDO API will automatically construct a finite scenario tree with specified
dimensions. The user can optionally specify the variance reduction technique with
LS_IPARAM_STOC_VARCONTROL_METHOD parameter (the default variance reduction/control method is
LS_LATINSQUARE). The following code snippet illustrates the first method for the Newsvendor
problem (case 2) in C language.
{
int
panSampleSize[]
= {1, 6, 6};
errorcode=LSsetModelIntParameter(pModel,
LS_IPARAM_STOC_VARCONTROL_METHOD,
LS_ANTITHETIC);
errorcode=LSloadSampleSizes(pModel,panSampleSize);
if (errorcode !=0) { fprintf(stdout,"\nError=%d\n",errorcode);
exit(1);}
}
In the Newsvendor problem under case 2, both stochastic parameters are normally distributed each
belonging to a different stage. Therefore, creating N nodes per stage has the same effect as creating N
samples per stochastic parameter whenever there is a single stochastic parameter per stage.
Limiting Sampling to Continuous Parameters
In many cases, the user might want to take into account all possible outcomes of all discretely
distributed random parameters, thus enable sampling only on continuous distributions. This is achieved
by LS_IPARAM_STOC_SAMP_CONT_ONLY parameter.