Simulation 4 Unit
Simulation 4 Unit
Simulation 4 Unit
MODELING
COMPUTER SCIENCE
ENGINEERING
DEPARTMENT
CS 703
INTRODUCTION TO MODELING AND
SIMULATION
UNIT I
SYSTEM
A System is defined as an aggregation or assemblage of
objects joined in some regular interaction or
interdependence. While this definition is broad enough to
include static systems, the principal interest will be in
dynamic systems where the interactions cause changes over
time.
CUSTOMER PRODUCTION
ORDER CONTROL DEPT.
RAW
MATERIALS
PRODUCT
SYSTEM ENVIRONMENT
System is affected by changes occurring outside the system.
ENDOGENEOUS EXOGENEOUS
DITERMINISTIC STOCHASTIC
SYSTEM SYSTEM
CONTINUOUS AND
DISCRETE SYSTEM
In continuous In discrete system,
system, changes changes are
are predominantly predominantly
smooth. discontinuous.
System
Simulation
STATIC PHYSICAL
MODEL
Relevance
Model should only include those aspects
of the system that are relevant to the
study objectives.
SYSTEM SIMULATION AND CONTINUOUS
SYSTEM SIMULATION
UNIT II
TECHNIQUE OF SIMULATION
ANALYTICAL NUMERICAL
DISTRIBUTION
RANDOM SIMULATION
NUMBER RANDOM OUTPUT
VARIABLE
MODEL
REAL
SYSTEM
TYPES OF SYSTEM
CONTINUOUS DISCRETE SYSTEM
SYSTEM
If the slope of the supply curve is less than the slope of the
demand curve (in absolute value), then the fluctuations
increase in magnitude with each cycle, so that prices and
quantities spiral outwards. This is called the unstable or
divergent case.
COBWEB MODEL
UNIT III
EXPONENTIAL GROWTH
MODEL
Exponential growth (including exponential decal occurs
when the growth rate of a mathematical function is
propotional to the function's current value.
UNIT IV
Learning Objectives
3 6
Phase 1 Phase 2
Example Queuing
Systems
Arrival & Service
Patterns
• Arrival rate:
The average number of customers arriving
per time period
Modeled using the Poisson distribution
Arrival rate usually denoted by lambda ()
Example: =50 customers/hour; 1/=0.02
hours between customer arrivals (1.2 minutes
between customers)
Arrival & Service Patterns
• Service rate:
The average number of customers that can be
served during the period of time
Service times are usually modeled using the
exponential distribution
Service rate usually denoted by mu (µ)
Example: µ=70 customers/hour; 1/µ=0.014
hours per customer (0.857 minutes per
customer).
• Even if the service rate is larger than the
arrival rate, waiting lines form!
Reason is the variation in specific customer
Example Priority Rules
• First come, first served
• Best customers first (reward loyalty)
• Highest profit customers first
• Quickest service requirements first
• Largest service requirements first
• Earliest reservation first
• Emergencies first
• Etc.
Waiting Line Performance
Measures
• Lq = The average number of customers
waiting in queue
• L = The average number of customers
in the system
• Wq = The average waiting time in
queue
• W = The average time in the system
• p = The system utilization rate (% of
time servers are busy)
Single-Server Waiting Line
• Assumptions
Customers are patient (no balking, reneging, or
jockeying)
Arrivals follow a Poisson distribution with a mean
arrival rate of . This means that the time
between successive customer arrivals follows an
exponential distribution with an average of 1/
The service rate is described by a Poisson
distribution with a mean service rate of µ. This
means that the service time for one customer
follows an exponential distribution with an
average of 1/µ
The waiting line priority rule is first-come, first-
served
Infinite population
Formulas: Single-Server
Case
λ= lambda= mean arrival rate
μ= mu= mean service rate
λ
p= = average system utilization
μ
Note:μ>λ for system stability. If this is not the case,
an infinitly long line will eventually form.
Formulas: Single-Server
Case (continued)
λ
L= = average number of customers in system
μ− λ
Lq =pL=average number of customers in line
1
W= = average time in system including service
μ− λ
W q =pW=average time spent waiting
Pn= 1− p p n= probability of n customers in the system
at a given point in time
Example
• A help desk in the computer lab serves
students on a first-come, first served
basis. On average, 15 students need
help every hour. The help desk can
serve an average of 20 students per
hour.
• Based on this description, we know:
µ = 20 students/hour (average service time
is 3 minutes)
= 15 students/hour (average time
between student arrivals is 4 minutes)
Average Utilization
λ 15
p= = = 0 .75 or 75
μ 20
Average Number of Students
in the System, and in Line
λ 15
L= = = 3 students
μ− λ 20− 15
1 1
W= = = 0.2 hours
μ− λ 20− 15
or 12 minutes
s− 1 n s −1
[
P0 = ∑
λ/ μ
n=0 n!
λ /μ 1
s! 1− p ] = probability of zero
{ }
λ/ μ
P0 for n≤ s
n!
Pn = n = probability of n customers
λ/ μ
n− s
P0 for n>s
s!s
in the system at a given point in time
Multiple Server Formulas
(continued)
s
P0 λ / μ p
Lq = 2
= average number of customers in line
s! 1− p
W q =Lq / λ=average time spent waiting in line
1
W=W q = average time in system including service
μ
L=λW= average number of customers in system
Example: Multiple Server
• Computer Lab Help Desk
• Now 45 students/hour need help.
• 3 servers, each with service rate of
18 students/hour
• Based on this, we know:
µ = 18 students/hour
s = 3 servers
= 45 students/hour
Flexible Spreadsheet Approach
• Formulas are somewhat complex to set up initially, but
you only need to do it once!
0.1600
0.1400
0.1200
Probability
0.1000
0.0800
0.0600
0.0400
0.0200
0.0000
0
2
4
6
8
10
12
14
16
18
20
22
24
26
28
30
Number in System
Changing System Performance
• Customer Arrival Rates
Try to smooth demand through non-peak discounts
or price promotions
• Number and type of service facilities
Increase or decrease number of servers, or dedicate
specific servers for certain tasks (e.g., express line
for under 10 items)
• Change Number of Phases
Can use multi-phase system instead of single phase.
This spreads the workload among more servers and
may result in better flow (e.g., fast food restaurants
having an order phase, pay phase, and pick-up
phase during busy hours)
Changing System Performance
• Server efficiency
Add resources to each phase (e.g., bagger
helping a checker at the grocery store)
Use technology (e.g. price scanners) to
improve efficiency
• Change priority rules
Example: implement a reservation protocol
• Change the number of lines
Reduce multiple lines to single queue to
avoid jockeying
Dedicate specific servers to specific
transactions
Supplement D Highlights