Lecture04 Simulation Examples
Lecture04 Simulation Examples
Simulation Examples
Sanja Lazarova-Molnar
Purpose
• To present several examples of simulations that can be
performed by devising a simulation table either manually or
with a spreadsheet.
• To provide insight into the methodology of discrete-system
simulation and the descriptive statistics used for predicting
system performance.
2
Outline
• The simulations are carried out by following steps:
– Determine the input characteristics.
– Construct a simulation table.
– For each repetition i, generate a value for each input, evaluate the
function, and calculate the value of the response yi.
• Simulation examples are in queueing, inventory, reliability and
network analysis.
3
Simulation of Queueing Systems
• A queueing system is described by its calling population, nature of arrivals,
service mechanism, system capacity and the queueing discipline
• In a single-channel queue:
– The calling population is infinite.
– Arrivals for service occur one at a time in a random fashion, once they join the
waiting line, they are eventually served.
• Arrivals and services are defined by the distribution of the time between
arrivals and service times.
• Key concepts:
– The system state is the number of units in the system and the status of the
server (busy or idle).
– An event is a set of circumstances that causes an instantaneous change in the
system state, e.g., arrival and departure events.
– The simulation clock is used to track simulated time.
4
Simulation of Queueing Systems
• Event list: to help determine what happens next.
– Tracks the future times at which different types of events
occur. (this chapter simplifies the simulation by tracking
each unit explicitly.)
– Events usually occur at random times.
• The randomness needed to imitate real life is made possible
through the use of random numbers, they can be generated
using:
– Linear congruential method, next week
– Simulation packages and spreadsheets.
5
Simulation of Queueing Systems
• Single-channel queue illustration:
– Assume that the times between arrivals were generated by rolling a die
5 times and recording the up face. Input generated:
Customer Interarrival Time Arrival Time on Clock
1 - 0
2 2 2
3 4 6
4 1 7
5 2 9
6 6 15
• The 1st customer is assumed to arrive at clock time 0. 2nd customer arrives
two time units later (at clock time 2), and so on.
– Assume the only possible service times are 1,2,3 and 4 time units and
they are are equally likely to occur. Input generated:
Customer Service Time Customer Service Time
1 2 4 2
2 1 5 1
3 3 6 4
6
Simulation of Queueing Systems
– Resulting simulation table emphasizing clock times:
Customer Arrival Time Time Service Service Time Time Service
Number (clock) Begins (Clock) (Duration) Ends (clock)
1 0 0 2 2
2 2 2 1 3
3 6 6 3 9
4 7 9 2 11
5 9 11 1 12
6 15 15 4 19
9
Grocery Store Example
[Simulation of Queueing Systems]
• Generated time-between-arrivals:
Customer Interarrival Times (minutes)
1 -
2 1
3 1
4 6
5 3
6 7
… …
100 4
• Service times are also random-generated:
Customer Service Times (minutes)
1 4
2 2
3 5
4 4
5 1
6 5
… …
100 2
10
Grocery Store Example
[Simulation of Queueing Systems]
• For manual simulation, Simulation tables are designed for the problem
at hand, with columns added to answer questions posed:
2nd customer was in the
system for 5 minutes.
Time Waiting Time Time
Arrival Service Service Time in Service customer Idle time
Interarrival Time Time Begins Queue Ends spends in of server
Customer Time (min) (clock) (min) (clock) (min) (clock) system (min) (min)
1 0 4 0 0 4 4
2 1 1 2 4 3 6 5 0
3 1 2 5 5 4 11 9 0
4 6 8 4 11 3 15 7 0
5 3 11 1 15 4 16 5 0
6 7 18 5 18 0 23 5 2
… … … … … … … … …
100 5 415 2 416 1 418 3
Totals 415 317 174 491 0
• Tentative inferences:
– About half of the customers have to wait, however, the average waiting time is
not excessive.
– The server does not have an undue amount of idle time.
12
Grocery Store Example
[Simulation of Queueing Systems]
14
Able-Baker Call Center Example
[Simulation of Queueing Systems]
18
Simulation of Inventory Systems
• The News Dealer’s Example: A classical inventory problem
concerns the purchase and sale of newspapers.
– News stand buys papers for 33 cents each and sells them for 50 cents
each.
– Newspaper not sold at the end of the day are sold as scrap for 5 cents
each.
– Newspaper can be purchased in bundles of 10 (can only buy 10, 20,… 50,
60…)
– Random Variables:
• Types of newsdays.
• Demand.
21
News Dealer’s Example
[Simulation of Inventory Systems]
22
News Dealer’s Example
[Simulation of Inventory Systems]
• From Excel: running the simulation for 400 trials (each for 20 days)
23
News Dealer’s Example
[Simulation of Inventory Systems]
• The manual solution had a profit of $131.00, not far from the
average over 400 days, $137.61.
• But the result for a one-day simulation could have been the
minimum value or the maximum value.
• Hence, it is useful to conduct many trials.
• On the “One Trial” sheet in Excel spreadsheet
– Observe the results by clicking the button ‘Generate New Trail.’
– Notice that the results vary quite a bit in the profit frequency graph and
in the total profit.
24
Order-Up-To Level Inventory Example
[Simulation of Inventory Systems]
25
Other Examples of Simulation
• Reliability problem:
– A machine with different failure types of which repairman is called to
install or repair the part.
– Possible random variables: time to failure, time to service.
– Possible decision variables: decide strategy of repair verses replace,
number of repairman to hire.
• Random normal numbers:
– e.g. a bomber problem – where the point of impact is normally
distributed around the aim point.
– Possible decision variables: number of bombs to drop for a certain level
of damage.
26
Other Examples of Simulation
• Lead-time demand:
– Lead time is the random variable: the time from placement of an order
until the order is received.
– Other possible random variable: demand.
– Possible decision variables: how much and how often to order.
• Project simulation:
– A project can be represented as a network of activities: some activities
must be carried out sequentially, others can be done in parallel.
– Possible random variables: times to complete the activities.
– Possible decision variables: sequencing of activities, number of workers
to hire.
27
Summary
• Introduced simulation concepts by means of examples, illustrated
general areas of application, and motivated the remaining lectures.
• Ad-hoc simulation tables were used:
– Events in tables were generated by using uniformly distributed random
numbers, and resulting responses were analyzed.
– Ad-hoc simulation table may fail due to system complexities.
• Key takeaways:
– A simulation is a statistical experiment and results have variation.
– As the number of replications increases, there is an increased
opportunity for greater variation.
28