Você está na página 1de 7

Operational Research Methods Simulation

Random Sampling from Different Distributions


Previously, we showed how we could use simulation to represent the variability in demand for the
coffee shop problem. The distribution in demand for soya milk was assumed to be one of six fixed
values, with differing probabilities. In this part of the module, we will consider how random numbers
can be used to generate random samples for a number of commonly occurring distributions.

Sampling from a Discrete Distribution


Consider the case where the potential outcomes are discrete, i.e. not continuous, for example: the
number of emergency calls received by an ambulance station on any given day and bidding for a
contract you either win or lose. Provided we can associate a likelihood or probability with each
outcome, we can use random digits to produce a random sample representing the discrete distribution.
Generating a Random Sample for a Discrete Distribution
Assuming that we have a table of outcomes and associated probabilities (expressed as percentages):
1. Add a column to the table containing cumulative percentage
2. Add a further column to the table entitled Random Digits
3. In the row corresponding to the first outcome, begin with 00 and go up to one less than the
cumulative percentage for that row
4. In subsequent rows, begin with the next pair of digits following on from the previous row and
again, go up to one less than the cumulative percentage for that row so the final row will end
with 99
5. Take a pair of uniformly distributed random digits (i.e. digits in the range 0099) and then choose
the outcome corresponding to where these digits are located in the Random Digits column
Note: The above method assumes that percentages are whole numbers, which might not always be the
case. The method can be modified to include percentages with decimal places, but requires that
additional random digits are required. For example, if the percentages were specified (or rounded) to
two decimal places, then we would use four random digits ranging from 0000 to 9999. Using ever
more decimal places might seem like a good idea, but in practice historical data is often used to
estimate the percentages, which will be subject to the inaccuracies and variability associated with
samples.
Example: Emergency Call Centre
A call centre for a gas supplier classifies incoming calls into three categories: emergencies requiring
immediate assistance; non-emergencies that require non-immediate action and misplaced calls, e.g.
wrong numbers, enquiries about customer accounts, . Analysis of historical data has revealed that on
a particular day of the week, the percentage of each category of calls is as follows:
Category Percent of calls in this category Cumulative Percentage Random Digits
Emergency 25 25 00-24
Non-Emergency 60 85 25-84
Misplaced 15 100 85-99
So, if we are given the random digits 87 and 36:
Random Digits Random Digits Range Category of Call
87 85-99 Misplaced
36 25-84 Non-Emergency

1
Operational Research Methods Simulation

Exercise: Automated Car Wash


Customers at an automated car wash can choose from one of three wash cycles: Standard, Premium and
Deluxe. Historical data has been collected and 27% of customers opt for Standard, whilst 17% opt for
Deluxe. Use the following random digits to produce a sample of 10 wash cycle choices:
48 13 35 06 98 64 53 93 17 79

Sampling from a Continuous Uniform Distribution


A continuous uniform distribution represents cases where a variable is equally likely to be anywhere
between a minimum and maximum value and is usually referred to as just a uniform distribution (we
have already seen how to handle discrete distributions above).
Generating a Random Sample for a Uniform Distribution
1. Take a pair of uniformly distributed random digits (i.e. digits in the range 0099) and use the
following formula:
digits
= min + (max min)
100
Note: Taking pairs of random digits means that the above method is only capable of producing 100
different sampled values, which will probably prove sufficient in most cases. It should also be noted that
it is not possible to generate the theoretical maximum using this method. These shortcomings can be
addressed by taking three or more random digits and dividing by the appropriate value, e.g. four
random digits would need to be divided by 10000.
Example: Emergency Response Times
Analysis has revealed that the time taken by gas engineers to travel to reach customers who have
reported an emergency is equally likely to be anywhere between 10 minutes and 30 minutes
So, if we are given the random digits 98 and 27:
Random Digits Travel time Calculation
98
98 29.6 10 + (30 10)
100
27
27 15.4 10 + (30 10)
100
Exercise: Ordering Time
The time taken to order and pay at a fast-food restaurant is anywhere between 30 seconds and 4
minutes. Use the following random digits to produce a sample of 10 food ordering times:
06 54 87 81 72 20 60 08 29 79

Sampling from a Histogram


If we are presented with data in the form of a histogram, then we can combine ideas from discrete
distributions and uniform distributions to allow us to generate suitable random samples.

2
Operational Research Methods Simulation

Generating a Random Sample for a Discrete Distribution


Assuming that we have a table with ranges and associated probabilities (expressed as percentages):
1. Add a column to the table containing cumulative percentage
2. Add a further column to the table entitled Random Digits
3. In the row corresponding to the first range, begin with 00 and go up to one less than the
cumulative percentage for that row
4. In subsequent rows, begin with the next pair of digits following on from the previous row and
again, go up to one less than the cumulative percentage for that row so the final row will end
with 99
5. Take a pair of uniformly distributed random digits (i.e. digits in the range 0099) and then choose
the range corresponding to where these digits are located in the Random Digits column.
6. Take a different pair of uniformly distributed random digits (i.e. digits in the range 0099) and
use the following formula:
digits
= min + (max min)
100
where min and max are the two extremes of the range selected in step 5
Example: Emergency Repair Times
Analysis of the time taken to make emergency repairs has been undertaken and is summarised below:
Repair Time (mins) Percent of times in this category Cumulative Percentage Random Digits
15 to <30 55 55 00-54
30 to <60 25 80 55-79
60 to 120 20 100 80-99
So, if we are given the random digits 29, 71, 62 and 22:
Random Random Digits Repair Time Random Repair
Calculation
Digits 1 Range Range Digits 2 Time
71
29 00-54 15 to <30 71 25.65 15 + (30 15)
100
22
62 55-79 30 to <60 22 36.6 30 + (60 30)
100
Exercise: Expenditure
Analysis of the amount spent by customers on each order at the fast-food restaurant reveals:
Expenditure () Percent of expenditure in this category
1 to <3 17
3 to <5 42
5 to <10 28
10 to <20 13
Use the following random digits to produce a sample of 5 expenditures:
22 52 73 74 00 15 15 84 62 10

3
Operational Research Methods Simulation

Random Sampling Table Normal Distribution


Prob Z Prob Z Prob Z Prob Z
0.00 -3.0000 0.25 -0.6745 0.50 0.0000 0.75 0.6745
0.01 2.3263 0.26 0.6433 0.51 0.0251 0.76 0.7063
0.02 2.0537 0.27 0.6128 0.52 0.0502 0.77 0.7388
0.03 1.8808 0.28 0.5828 0.53 0.0753 0.78 0.7722
0.04 1.7507 0.29 0.5534 0.54 0.1004 0.79 0.8064
0.05 1.6449 0.30 0.5244 0.55 0.1257 0.80 0.8416
0.06 1.5548 0.31 0.4959 0.56 0.1510 0.81 0.8779
0.07 1.4758 0.32 0.4677 0.57 0.1764 0.82 0.9154
0.08 1.4051 0.33 0.4399 0.58 0.2019 0.83 0.9542
0.09 1.3408 0.34 0.4125 0.59 0.2275 0.84 0.9945
0.10 1.2816 0.35 0.3853 0.60 0.2533 0.85 1.0364
0.11 1.2265 0.36 0.3585 0.61 0.2793 0.86 1.0803
0.12 1.1750 0.37 0.3319 0.62 0.3055 0.87 1.1264
0.13 1.1264 0.38 0.3055 0.63 0.3319 0.88 1.1750
0.14 1.0803 0.39 0.2793 0.64 0.3585 0.89 1.2265
0.15 1.0364 0.40 0.2533 0.65 0.3853 0.90 1.2816
0.16 0.9945 0.41 0.2275 0.66 0.4125 0.91 1.3408
0.17 0.9542 0.42 0.2019 0.67 0.4399 0.92 1.4051
0.18 0.9154 0.43 0.1764 0.68 0.4677 0.93 1.4758
0.19 0.8779 0.44 0.1510 0.69 0.4959 0.94 1.5548
0.20 0.8416 0.45 0.1257 0.70 0.5244 0.95 1.6449
0.21 0.8064 0.46 0.1004 0.71 0.5534 0.96 1.7507
0.22 0.7722 0.47 0.0753 0.72 0.5828 0.97 1.8808
0.23 0.7388 0.48 0.0502 0.73 0.6128 0.98 2.0537
0.24 0.7063 0.49 0.0251 0.74 0.6433 0.99 2.3263
Note: Technically there is no Z value corresponding to a probability of 0.00, but 3 will suffice.
Generating Normally Distributed Random Variables
For a normal distribution with mean, and standard deviation, :
1. Take a pair of uniformly distributed random digits from the table (i.e. digits in the range 0099)
2. Divide the random digits by 100 to obtain a probability
3. Find the probability in the Prob column and look across to find the corresponding Z value
4. Use the formula below to convert the Z value into the corresponding X value
= +
Example
If we wish to sample from a normal distribution with mean 100 and standard deviation 20 and are given
the random digits 09 and 64:
Digits Prob Z X Calculation
09 0.09 1.3408 73.184 100 + 201.3408
64 0.64 0.3585 107.17 100 + 20 0.3585

4
Operational Research Methods Simulation

Exercise: Expenditure
A slightly deeper analysis of the amount spent by customers on each order at the fast-food restaurant
reveals that the distribution appears to be normal, with a mean expenditure of 6.07 and a standard
deviation of 0.75.
Use the following random digits to produce a sample of 10 expenditures:
07 91 83 84 66 45 31 50 13 74

Random Sampling Table Negative Exponential Distribution


Prob Z Prob Z Prob Z Prob Z
0.00 0.0000 0.25 0.2877 0.50 0.6931 0.75 1.3863
0.01 0.0101 0.26 0.3011 0.51 0.7133 0.76 1.4271
0.02 0.0202 0.27 0.3147 0.52 0.7340 0.77 1.4697
0.03 0.0305 0.28 0.3285 0.53 0.7550 0.78 1.5141
0.04 0.0408 0.29 0.3425 0.54 0.7765 0.79 1.5606
0.05 0.0513 0.30 0.3567 0.55 0.7985 0.80 1.6094
0.06 0.0619 0.31 0.3711 0.56 0.8210 0.81 1.6607
0.07 0.0726 0.32 0.3857 0.57 0.8440 0.82 1.7148
0.08 0.0834 0.33 0.4005 0.58 0.8675 0.83 1.7720
0.09 0.0943 0.34 0.4155 0.59 0.8916 0.84 1.8326
0.10 0.1054 0.35 0.4308 0.60 0.9163 0.85 1.8971
0.11 0.1165 0.36 0.4463 0.61 0.9416 0.86 1.9661
0.12 0.1278 0.37 0.4620 0.62 0.9676 0.87 2.0402
0.13 0.1393 0.38 0.4780 0.63 0.9943 0.88 2.1203
0.14 0.1508 0.39 0.4943 0.64 1.0217 0.89 2.2073
0.15 0.1625 0.40 0.5108 0.65 1.0498 0.90 2.3026
0.16 0.1744 0.41 0.5276 0.66 1.0788 0.91 2.4079
0.17 0.1863 0.42 0.5447 0.67 1.1087 0.92 2.5257
0.18 0.1985 0.43 0.5621 0.68 1.1394 0.93 2.6593
0.19 0.2107 0.44 0.5798 0.69 1.1712 0.94 2.8134
0.20 0.2231 0.45 0.5978 0.70 1.2040 0.95 2.9957
0.21 0.2357 0.46 0.6162 0.71 1.2379 0.96 3.2189
0.22 0.2485 0.47 0.6349 0.72 1.2730 0.97 3.5066
0.23 0.2614 0.48 0.6539 0.73 1.3093 0.98 3.9120
0.24 0.2744 0.49 0.6733 0.74 1.3471 0.99 4.6052

Generating Negative Exponentially Distributed Random Variables


For a negative exponential distribution with mean, :
1. Take a pair of uniformly distributed random digits from the table (i.e. digits in the range 0099)
2. Divide the random digits by 100 to obtain a probability
3. Find the probability in the Prob column and look across to find the corresponding Z value
4. Use the formula below to convert the Z value into the corresponding X value
=

5
Operational Research Methods Simulation

Example
If we wish to sample from a negative exponential distribution with mean 100 and are given the random
digits 93 and 81:
Digits Prob Z X Calculation
93 0.93 2.6593 265.93 100 2.6593
81 0.81 1.6607 166.07 100 1.6607
Exercise: Emergency Call Centre
The distribution of times between calls arriving at the emergency call centre for the gas supplier has
been analysed and is reckoned to follow a negative exponential distribution, with a mean of 54 seconds
between each call.
Use the following random digits to produce a sample of 10 inter-arrival times:
80 78 37 47 36 85 28 05 84 39

Mini Case: Customer Help Line


A company selling PCs, laptops and tablets provides a help line for customers. When a call is answered,
the telephone operator asks a series of questions to determine the nature of the problem. The time
taken for this stage is normally distributed with a mean of 2 minutes and a standard deviation of 15
seconds.
In 50% of cases, the telephone operator is able to handle the customers issue directly, but in the
remaining 50% of cases, the customer has to speak to an IT specialist.
In the cases where the telephone operator is able to handle the issue, the time taken to solve the
problem varies. In 20% of cases, the time taken is anywhere between 2 and 3 minutes, in 55% of cases
this can take anywhere between 3 and 4 minutes and in the remaining cases can take anywhere
between 4 and 7 minutes.
For the cases where an IT specialist is required, the customer is put on hold until an IT specialist
becomes available and the waiting time varies quite considerably, following a negative exponential
distribution with an average waiting time of 2.5 minutes.
Once the IT specialist becomes available, the time taken to resolve the customers issue can take
anywhere between 5 and 20 minutes.
Exercise
Use the following random digits to simulate the total time taken to handle FIVE customer calls:
Operator time
Initial Operator can Waiting for IT IT Specialist
(Histogram (Uniform
questions handle? Specialist time
category) distribution)
46 49 36 75 39 91
02 69 17 95 82 95
81 27 94 86 18 07
94 01 71 56 41 70
21 78 33 47 35 10
Exercise
What are the theoretical minimum, maximum and average call times?

6
Operational Research Methods Simulation

Simulation Modelling IT Lab


Build suitable Excel models to represent the following situations.

Lboro Academy
Lboro Academy is developing a new scheme for testing the English of new students called the Lboro
English Testing Scheme (LETS). This requires hiring some testers paid by the hour, and so the LETS
manager needs to know the total times the testers will need for each candidate.
Each candidate answers some multiple choice questions on-line, and then writes an essay. This essay is
marked independently by two testers which takes each of them anywhere between 30 and 50 minutes.
The two testers then discuss together to agree an essay mark. Usually this is easy, but can sometimes
take a long time, so the time to discuss and reach agreement has a negative exponential distribution
with a mean of 10 minutes. The candidate then has a recorded interview with one of the testers who
records marks during the interview. As the interview varies depending on the candidates ability, the
times vary and it can take anywhere between 30 and 40 minutes on 10% of occasions, between 40 and
60 minutes for 40% of occasions and between 60 and 80 minutes for the remaining 50%.
In 30% of cases the marks for the essay and the interview are consistent, so the testers move straight on
to the report stage. However, in other cases extra marking is needed. In 35% of all cases one of the
testers must assess the on-line answers which takes 20 minutes but in the remaining 35% of cases the
second tester must watch and mark the recorded interview.
Finally, the two testers involved meet to discuss and type up a report together. The time to prepare this
report is normally distributed around a mean of 30 minutes with a standard deviation of 10 minutes. So
the total time per candidate for the paid testers includes the times to mark the essay and agree the
mark, the time for the interview, the time for report writing and any time needed for extra marking.

Management Kollege
Management Kollege (MK) is seeking to recruit several new Associate Professors of Finance, so is using
head hunters, who charge by the time involved of their assessors. Before deciding on the number of
applicants to short list the dean of MK wants to know the cost per applicant of the selection process.
Each short listed applicant submits a technical summary of their work to date and then presents to MK
staff and two of the outside assessors, who have previously read the summary submitted.
The head hunters confirm that for each applicant their technical summary will be read and assessed
independently by two assessors. For each assessor this can take anywhere between 30 and 40 minutes.
The dean of MK knows that, although each applicant is asked to present for 45 minutes, the time taken
will be normally distributed around that target with a standard deviation of 10 minutes.
After the presentation the two assessors discuss together to try and agree a recommendation for the
dean. The time taken to do this varies considerably. 25% of the time it is easy and takes between 10
and 20 minutes and 40% of the time takes between 20 and 30 minutes but in 35% of cases it takes
anywhere between 30 minutes and one hour. Overall, in two thirds of discussions the assessors reach
agreement but in a third of the cases they cannot agree and then both must meet with MKs dean to
resolve the recommendation. Such meetings are usually quite short, but occasionally very long and so
the distribution of these meeting times can be taken as negative exponential with a mean of 20 minutes.
The total time per short listed applicant for each assessor is the time to assess the summary, listen to
the presentation, discuss the applicant and possibly meet with the dean. MKs dean is concerned about
the total assessor time per applicant as that determines their cost.
1

Você também pode gostar