• No results found

Develop a simulation model in an area in which you are familiar, along similar lines

9 Simulation concepts and methods

9.5 Develop a simulation model in an area in which you are familiar, along similar lines

to that of Example 9.2. Incorporate two or more decision variables in this model, and conduct a deterministic experiment to identify the optimal management policy. Explain how this model could be made into a stochastic simulation model.

Appendix: Generation of random variates

A critical step in any stochastic simulation model is to generate values of random (stochastic) variables or ‘variates’. In Example 9.1, annual demand was recognized as a random variable, and values were obtained by sampling from the demand distribution using random numbers. In simulation practice, variables are frequently recognized as stochastic. It has been said that a refinement in modelling introduces a need for stochasticity. A wide variety of forms of probability distributions have been recognized as reflecting the behaviour of particular random variables. Three examples will be presented here.

The starting point for producing (or ‘generating’ or ‘sampling’) values from any form of probability distribution is to use a random number from a known distribution. In practice, this is usually a number from a uniform distribution over the range 0 to 1, as illustrated below. ‘Uniform’ implies that the probabilities over the range are equal. Since the area under a probability function must be unity, the height of this curve is also 1. When a random number generator is called in a computer spreadsheet or programming language (e.g. using the statement ‘=rand()’ in Excel) a number from this distribution is obtained. The procedure used on the computer is typically to divide a very large number by another large number, and to take the remainder as a fraction of the divisor (hence yielding a number between 0 and 1). As well, the remainder is multiplied by a third large number, and the product divided by the original divisor. By repeating this process, a series of random numbers can be generated. The numbers are sometimes called ‘pseudo-random’ because given the same three large numbers (and the same computer accuracy), the same series will always be produced.

0 1

1

Generating uniform variates over a specified range

Perhaps the simplest form of continuous probability distribution used in simulation models is the uniform distribution, as illustrated in the following diagram. Here a is the smallest value and b the largest value that the variable is expected to take. Since the area under a

Table 9A.1. Probability distribution of number of tickets sold

Number of tickets sold 3,000 4,000 5,000 6,000

Probability 0.2 0.3 0.3 0.2

probability function must be unity, and the range of values of the variable is ba, the height of the curve must be 1/(ba).

a b

1/(b a)

A value y from a uniform distribution can be generated by taking a random number r and applying the expression:

y=a+r (ba)

i.e. the lower limit plus the random number times the distance between the upper and lower numbers. To obtain a series of values on the random variable, simply repeat this process a number of times (on your computer).

Generating values from an empirical probability distribution (discrete probability table)

Suppose it has been found from experience that a random variable (say airline ticket sales) can be described by the distribution shown in Table 9A.1.

This distribution may be converted into cumulative form, and random numbers attached to demand levels, as shown in Table 9A.2.

It is now a relatively simple task to obtain a series of random numbers in the range 0 to 1, and to use these to ‘look up’ demand levels. Suppose the sequence of random numbers 0.2765, 0.8346, 0.1207, 0.4533 and so on has been obtained. The first of these numbers falls in the range 0.2 to 0.4999, hence demand of 4,000 seats is generated. The second random number falls in the range 0.8 to 0.9999, corresponding to a demand of 6,000 seats. Proceeding in this way, a random series of demand levels is generated, in which the relative frequency in each demand class will approximate the estimated probability.

Table 9A.2. Cumulative probability distribution of number of tickets sold, and ranges of random numbers

Demand level Probability of this demand Range of random

(tickets sold) level or greater number

3,000 0.2 0.0–0.1999

4,000 0.2+0.3=0.5 0.2–0.4999

5,000 0.2+0.3+0.3=0.8 0.5–0.7999

6,000 0.2+0.3+0.3+0.2=1.0 0.8–0.9999

Generating normal variates

The normal distribution is widely recognized in statistical methods as a commonly occurring or approximated distribution. Further, many distributions can be converted to approximately normal distributions by applying a suitable transformation, e.g. by taking of logarithms or square roots.

There are several methods for generating normal random variates (values from a normal distribution). The simplest is to take the sum of 12 random values from a uniform 0–1 distribution (e.g. a computer random number generator), subtract six, then multiply by the target standard deviation (500) and add the target mean (0), i.e. to derive:

y=12ri−6500,

where the twelve ri values are observations from a uniform distribution with range 0 to 1 (e.g. from a spreadsheet random number generator). Since the expected value of a single uniform 0–1 random number is 0.5, the expected sum is 6, hence (12ri−6) has an expected value of 0. Further, it can be shown that the variance of a single uniform 0–1 number is 1/12, hence the sum of twelve independent numbers from this distribution has a variance of 1.0 (and this is unaffected by subtracting 6). The sum of twelve numbers from the same distribution will approach a normal distribution, especially if the distribution is not heavily skewed – this follows from the Central Limit Theorem. It follows that (12ri−6) is approximately a standard normal or N(0, 1) variable.

Any normal variable can be converted to a standard normal variable by subtracting the mean and dividing by the standard deviation. Conversely, a standard normal variate z can be converted to a value from a target normal distribution by multiplying by the standard deviation and adding the mean. That is, if y is a normal variable, and z=(yµ), then y=+µmust be a normal variate from the target distribution.

Generating values from a triangular distribution

The triangular distribution is popular since it is often easy for people to make estimates of the most pessimistic, most likely (modal) and most optimistic values of a random variable.

For any variable, these values (denoted a, b and c, respectively) can be used to define a triangular distribution as in the following diagram.

a b c

If a distance parameter d is defined as d=(ba)/(ca), then, using a random number r, a value from this distribution y can be generated by applying the formulae:

For rd y=a+r (ca)(ba) For r>d y=c−(1−r )(ca)(cb)

10

Case study in financial