SIMULATION
AGENDA
What is Simulation
Advantages of Simulation
Limitations of Simulation
Some of the applications
Types of Simulation
Monte Carlo Simulation
Problems
Simulation is the process of
creating a model of a real system
What is
and conducting experiments on Simulation
that model.
Purpose: To analyze the behavior of systems, make
predictions, and support decision-making.
ADVANTAGES OF SIMULATION
• Simulation is Mathematically less complicated
1
• Simulation is flexible
2
• It can be modified to suit the changing environments. platform independent
3
• It can be used for training purpose
4
• It may be less expensive and less time consuming in a quite a few real
5 world situations
LIMITATIONS OF SIMULATION
• Quantification or Enlarging of the variables maybe difficult.
1
• Large number of variables make simulations unwieldy and more difficult.
2
• Simulation may not yield optimum or accurate results
3
• Simulation are most expensive and time consuming model.
4
• We cannot relay too much on the results obtained from simulation
5 models.
SOME OF THE APPLICATIONS
Inventory Control:
Optimize stock levels and reorder points.
Handle uncertainties in demand and lead times.
Queuing Systems:
Analyze customer wait times and service efficiency.
Improve resource allocation in service industries.
Manufacturing:
Model production processes to minimize downtime
Test changes in workflow before implementation.
Project Management:
Evaluate project timelines and resource allocation.
Identify potential bottlenecks in project workflows
TYPES OF SIMULATION
Discrete Event Simulation:
Focuses on events that occur at specific points in time.
Continuous Simulation:
Models systems changing continuously over time.
Monte Carlo Simulation:
Uses random sampling to obtain numerical results.
MONTE CARLO SIMULATION
Definition:
A statistical technique that uses random sampling to approximate solutions
to quantitative problems.
➢ This method is generally used to solve problems which cannot be
adequately represented by mathematical models or where solution of the
model is not possible by analytical method.
➢ Monte-Carlo simulation yields a solution, which should be very close to
the optimal, but not necessarily the exact solution.
Random numbers
Random number is a number in a sequence of numbers whose probability of
occurrence is the same as that of any other number in that sequence.
Pseudo-Random Numbers
Random numbers which are generated by some deterministic process but
which satisfy statistical test for randomness are called Pseudo-random
numbers.
STEPS IN SIMULATION:
➢ Define a domain of possible inputs: Identify the variables that affect the
system.
➢ Randomly generate inputs: Use random numbers to simulate different
scenarios.
➢ Perform deterministic computations: For each set of inputs, run the model
to calculate results.
➢ Repeat: Perform many simulations (iterations) to obtain a distribution of
results.
➢ Analyze: Use the results to make inferences and decisions.
PROBLEM-1 (Queuing Problems)
A dentist schedules all his patients for 30-minute appointments. Some of the
patients take more 30 minutes some less, depending on the type of dental work
to be done. The following summary shows the various categories of work, their
probabilities and time actually needed to complete the work:
Simulate the dentist’s clinic for four hours and determine the average waiting
time for the patients as well as the idleness of the doctor. Assume that all the
patients show up at the clinic at exactly their scheduled arrival time starting at
8.00 a.m. Use the following random numbers for handling the above problem:
40, 82, 11, 34, 25, 66, 17, 79.
Setup the Problem
➢ The total clinic time is 240 minutes.
➢ Each appointment is scheduled for 30 minutes.
➢ The service time for each type of dental work is provided along with the
probabilities.
Step 1: Cumulative Probability Distribution
Time Required Cumulative
Category Probability
(minutes) Probability (%)
Filling 45 0.4 40
Crown 60 0.15 55
Cleaning 15 0.15 70
Extraction 45 0.1 80
Check-up 15 0.2 100
Step 2: Random Numbers for Patient Service Categories
We are given the following random numbers:
Random numbers: 40, 82, 11, 34, 25, 66, 17, 79
Now, map these random numbers to the corresponding service categories
using the cumulative probability distribution:
Time Required
Random Number Service Category Explanation
(minutes)
40 Filling 45 Falls between 0 and 40
82 Extraction 45 Falls between 70 and 80
11 Filling 45 Falls between 0 and 40
34 Filling 45 Falls between 0 and 40
25 Filling 45 Falls between 0 and 40
66 Cleaning 15 Falls between 55 and 70
17 Filling 45 Falls between 0 and 40
79 Extraction 45 Falls between 70 and 80
Step 3: Simulate the Clinic Operation
•All patients arrive every 30 minutes starting at 8:00 AM.
•We calculate when each patient finishes their appointment and whether
the next patient must wait or whether the doctor will be idle.
Time
Waiting
Require Service Doctor
Random Service Arrival Service Time
Patient d End Idle
Number Category Time Time (minutes
(minut Time Time
)
es)
1 40 Filling 45 08:00 45 08:45 0 0
2 82 Extraction 45 08:30 45 09:30 15 0
3 11 Filling 45 09:00 45 10:15 30 0
4 34 Filling 45 09:30 45 11:00 45 0
5 25 Filling 45 10:00 45 11:45 60 0
6 66 Cleaning 15 10:30 15 12:00 15 0
7 17 Filling 45 11:00 45 12:45 45 0
8 79 Extraction 45 11:30 45 13:30 60 0
Step 4: Calculations
1. Average Waiting Time
Total Waiting Time=0+15+30+45+60+15+45+60=270 minutes
Average Waiting Time=270/8=33.75 minutes
2. Doctor Idle Time
Doctor idle time is when the doctor finishes the previous patient’s work
before the next patient arrives.
In this simulation, since each patient takes more time than their
scheduled arrival time, there is no idle time for the doctor.
3. Average Production Rate
Production Rate=8 patients/240 minutes=0.0333 patients per minute
PROBLEM-2
In a single server queuing system inter arrival time distribution and service
time distribution is as follows :
Consider the following random numbers for inter arrival time:
58, 47, 23, 69, 35, 55, 69, 90, 86, 74
The following random numbers for service time:
87, 39, 28, 97, 69, 87, 52, 52, 15, 85
Simulate the system for 10 arrivals and find average waiting time of the
customers.
Step 1: Calculate Inter-Arrival Time Step 2: Calculate Service Time
Distribution Distribution
We need to calculate cumulative We need to calculate cumulative
probabilities based on the given probabilities based on the given
inter-arrival time distribution service times distribution
Cumulative Cumulative
Inter-arrival Inter-arrival
Frequency Probability Frequency Probability
Time (min) Time (min)
(%) (%)
0 12 12 4 8 8
3 18 30 (12 + 18) 6 20 28
6 50 80 (30 + 50) 8 36 64
9 74 154 10 88 152
12 32 186 12 48 200
15 14 200
Step 3: Assign Inter-Arrival Times Using Random Numbers
Now we map the random numbers for inter-arrival times to their
corresponding times based on the cumulative probabilities:
Random numbers for inter-arrival time: 58, 47, 23, 69, 35, 55, 69, 90, 86,
74
Random Number Inter-Arrival Time (min) Explanation
58 6 Falls between 30 and 80
47 6 Falls between 30 and 80
23 3 Falls between 12 and 30
69 6 Falls between 30 and 80
35 6 Falls between 30 and 80
55 6 Falls between 30 and 80
69 6 Falls between 30 and 80
90 9 Falls between 80 and 154
86 9 Falls between 80 and 154
74 9 Falls between 80 and 154
Step 4: Assign Service Times Using Random Numbers
Next, map the random numbers for service times:
Random numbers for service time: 87, 39, 28, 97, 69, 87, 52, 52, 15, 85
Random Number Service Time (min) Explanation
87 10 Falls between 64 and 152
39 8 Falls between 28 and 64
28 6 Falls between 8 and 28
97 12 Falls between 152 and 200
69 10 Falls between 64 and 152
87 10 Falls between 64 and 152
52 8 Falls between 28 and 64
52 8 Falls between 28 and 64
15 6 Falls between 8 and 28
85 10 Falls between 64 and 152
Step 5: Simulate the System
Inter-Arrival
Customer Arrival Time Start Time Service Time End Time Waiting Time
Time
1 6 6 6 10 16 0
2 6 12 16 8 24 4
3 3 15 24 6 30 9
4 6 21 30 12 42 9
5 6 27 42 10 52 15
6 6 33 52 10 62 19
7 6 39 62 8 70 23
8 9 48 70 8 78 22
9 9 57 78 6 84 21
10 9 66 84 10 94 18
Step 6: Calculate Average Waiting Time
Total waiting time = 0 + 4 + 9 + 9 + 15 + 19 + 23 + 22 + 21 + 18 = 140 minutes
Average waiting time = 140/10 = 14 minutes
PROBLEM-3- (Inventory Control Problems)
A company observes from past experience that the demand for a special
product has the following probability distribution
Simulate the demand for next 10 days. Also find the average demand.
Step 1: Cumulative Probability Distribution
Daily Demand Probability Cumulative Probability (%)
5 0.01 1
10 0.2 21 (1 + 20)
15 0.15 36 (21 + 15)
20 0.5 86 (36 + 50)
25 0.12 98 (86 + 12)
30 0.02 100 (98 + 2)
Step 2: Random Numbers for 10 Days
generate random numbers for the 10 days of simulation and map them to the
demand values based on the cumulative probability distribution
let's use the following random numbers:
Random numbers: 35, 89, 20, 74, 50, 15, 65, 9, 48, 99
Step 3: Mapping Random Numbers to Demand Values
Demand Value
Random Number Explanation
(Mapped)
35 15 Falls between 21 and 36
89 25 Falls between 86 and 98
20 10 Falls between 1 and 21
74 20 Falls between 36 and 86
50 20 Falls between 36 and 86
15 10 Falls between 1 and 21
65 20 Falls between 36 and 86
9 5 Falls between 0 and 1
48 20 Falls between 36 and 86
99 30 Falls between 98 and 100
Step 4: Simulated Demand for 10 Days
Day Random Number Demand
1 35 15
2 89 25
3 20 10
4 74 20
5 50 20
6 15 10
7 65 20
8 9 5
9 48 20
10 99 30
Step 5: Calculate Average Demand
Total Demand=15+25+10+20+20+10+20+5+20+30=175
Average Demand=175/10=17.5
PROBLEM-4
Two persons X and Y work on a two-station assembly line. The distributions
of activity times at their solutions are
(i) Simulate operation of the line for eight items
(ii) Assuming Y must wait until X completes the first item before starting
work, will he have to wait to process any of other seven items? What is the
average waiting time of items for Y. Use the following random numbers:
For X: 83, 70, 06, 12, 59, 46, 54 and 04
For Y: 51, 99, 84, 81, 15, 36, 12 and 54
(iii) Determine the inventory of items between the two stations
(iv) What is average production rate?
Part (i) Simulate operation of the line for eight items
Step 1: Calculate Cumulative Frequency for X and Y
Cumulative Cumulative
Time (sec) Frequency for X Probability for Frequency for Y Probability for
X (%) Y (%)
10 4 4 2 2
20 7 11 (4 + 7) 3 5 (2 + 3)
30 10 21 (11 + 10) 6 11 (5 + 6)
40 15 36 (21 + 15) 8 19 (11 + 8)
50 35 71 (36 + 35) 12 31 (19 + 12)
60 18 89 (71 + 18) 9 40 (31 + 9)
70 8 97 (89 + 8) 7 47 (40 + 7)
80 3 100 (97 + 3) 3 50 (47 + 3)
Step 2: Assign Activity Times Using Random Numbers
For Y: Random numbers = 51, 99, 84,
For X: Random numbers = 83, 70, 06, 81, 15, 36, 12, 54
12, 59, 46, 54, 04 Random Activity
Rando Number Time for Y Explanation
Activity
m for Y (sec)
Time for Explanation
Numbe Falls between 50 and
X (sec) 51 60
r for X 100
83 60 Falls between 71 and 89 99 80 Falls between 47 and 50
70 50 Falls between 36 and 71 84 70 Falls between 40 and 47
6 10 Falls between 0 and 11 81 70 Falls between 40 and 47
12 20 Falls between 11 and 21 15 30 Falls between 11 and 19
59 50 Falls between 36 and 71 36 40 Falls between 31 and 40
46 50 Falls between 36 and 71 12 20 Falls between 5 and 11
54 50 Falls between 36 and 71 Falls between 50 and
54 60
4 10 Falls between 0 and 11 100
Step 3: Simulate the Process
Waiting
Time X Time X Time X Time Y Time Y Time Y
Item Time for
(sec) Start End (sec) Start End
Y (sec)
1 60 0 60 60 60 120 0
2 50 60 110 80 120 200 10
3 10 110 120 70 200 270 80
4 20 120 140 70 270 340 130
5 50 140 190 30 340 370 150
6 50 190 240 40 370 410 130
7 50 240 290 20 410 430 120
8 10 290 300 60 430 490 130
Part (ii) Will Y Have to Wait? Average Waiting Time for Y
Total waiting time for Y = 0 + 10 + 80 + 130 + 150 + 130 + 120 + 130 = 750 seconds
Average waiting time for Y = 750/88 = 93.75 seconds
Part (iii) Inventory of Items Between Two Stations
Inventory between the two stations occurs when X finishes an item, but Y hasn't
started working on it yet. The number of items in the inventory is the number of
items that X finishes before Y starts working on them.
Based on the table:
For item 2: X finishes at time 110, and Y starts at 120 (1 item in inventory).
For item 3: X finishes at time 120, and Y starts at 200 (2 items in inventory).
For item 4: X finishes at time 140, and Y starts at 270 (3 items in inventory).
For item 5: X finishes at time 190, and Y starts at 340 (4 items in inventory).
For item 6: X finishes at time 240, and Y starts at 370 (5 items in inventory).
For item 7: X finishes at time 290, and Y starts at 410 (5 items in inventory).
For item 8: X finishes at time 300, and Y starts at 430 (5 items in inventory).
Part (iv) Average Production Rate
The total time taken to produce 8 items is from the start of the first item to the
end of the 8th item.
Total time = Time Y finishes the 8th item - Time X starts the 1st item
Total time = 490 seconds - 0 seconds = 490 seconds
Average production rate = 8/490 items per second
= 0.0163 items/second or
1 item every 61.25 seconds.