The SPSMSZ parameter is used to control the default sample size for random variables in stochastic programming (SP) whose outcomes are determined via sampling.

In many SP models, LINGO will generate a set of sample values for the some or all of the random variables.  This is particularly true when you have one or more continuous random variables, which have an infinite number of possible outcomes.  In such a case, sampling is the only viable alternative.

One way to specify the desired sample size for each stage is via the @SPSAMPSIZE function used directly in the model's text.  If, on the other hand, all or most stages should have the same sample size, then you can use the SPSMSZ parameter to control the default sample size.  Any stage which has not had its sample size specified with @SPSAMPSIZE will default to a sample size equal to the SPSMSZ parameter.

Note:In general, we prefer larger sample sizes to smaller ones in order to reduce sampling error.  However, SP models can become quite large if sample sizes aren't kept reasonably small.  This is particularly true for multiperiod models.  For example, suppose we have a model with just one random variable and ten periods/stages.  If the default sample size is set to 3, then there will be 3^10=59,049 possible scenarios. With this many scenarios, it would only take a handful of decision variables to end up with an underlying deterministic equivalent model approaching one million variables.

The SPSMSZ parameter defaults to a value of 2.