Sei sulla pagina 1di 42

Queuing

Department of Systems Engineering


and Engineering Management
Charles V. Schaefer Jr. School of
Engineering
Stevens Institute of Technology
Hoboken, New Jersey 07030

Example of Queuing Systems


SYSTEM
Reception Desk
Repair Facility
Garage
Tool Crib
Hospital
Warehouse
Airport
Production Line
Road Network
Market
Laundry
Job Shop
Lumberyard
Saw Mill
Computer
Telephone
Ticket Office
Mass Transit

CUSTOMERS
People
Machines
Trucks
Mechanics
Patients
Pallets
Airplanes
Cases
Cars
Shoppers
Dirty Linen
Jobs
Trucks
Logs
Jobs
Calls
Football Fans
Riders

SERVER(S)
Receptionist
Repairperson
Mechanic
Tool Crib Clerk
Nurses
Crane
Runway
Case Packer
Traffic Light
Checkout Counter
Washing Machines/Dryers
Machines/Workers
Overhead Crane
Saws
CPU/Disk/Tapes
Exchange
Clerk
Buses/Trains

Definitions

Queue waiting line


Queuing Systems system involving a queue
Queuing Theory techniques to describe the
behavior of a queuing systems
Calling Units members of the the queue
Service Facility the source of the goods or
services for which the calling units wait
Single Channel only one server
Multi Channel more than one server
performing the same service

Queuing System

CALLING
POPULATION
-SIZE
-ARRIVAL PATTERN
-ATTITUDE

QUEUE
-LENGTH

SERVICE
FACILITY
-STRUCTURE
-DISTRIBUTION
-DISCIPLINE

SERVED
CALLING
UNITS

Queuing Terms and Statistics


Lq = mean number of calling units in the queue

L or Ls = mean number of calling units in the system


Wq = mean time spent in the queue
W or Ws = mean time spent in the system

The subscript q means


queue whereas the s means
the system or the queue plus
the server

Queuing Terms and Statistics


= Mean arrival rate (#units/unit time)
1/ = Interarrival time (time between units)
= Mean service rate (#units served/unit time)

1/ = Mean service time (time/unit)


Mu and Lambda are always
rates the inverse of a rate
is a time for example
customers/min is the rate
and the time would be
minutes/cust

Queuing Terms and Statistics


S = Number of equivalent servers in the
service facility
U = Server utilization (% of time server
expected to be busy)
P(n) = Probability of having n units in the
system
M = Maximum number of calling units in
the system (finite or limited source
problems)

Simple Stream
Stationary Mean is the same for any interval of measurement
No Aftereffects Number of occurrences in an interval is
independent of number of occurrences in any other interval
(Markovian Property)
Orderliness Probability of more than 1 event approaches zero a
interval approaches zero (i.e. for very small h)
Theorem:
A Simple Stream (Stream with above properties) will result in an
arrival pattern that follows the Poisson Distribution)

Poisson Arrival Times Distribution


Poisson Arrival (probability) distribution:
Let x be a random variable of the number of arrivals
Let p(x) = probability of x arrivals in time t and let
average arrival rate in time t

denote the

If the arrival distribution is Poisson then:

P ( xt n ) ( t ) e
n

n 0,1, 2,....

/ n!

Where
n = # of arrivals in interval of time t
= Average arrival rate in interval t

is probability of exactly n arrivals over interval t


P(x n)
t

P ( x t 0) ( t ) e
0

/ 0! e

P ( x t 0) 1 e

Queuing Formulas
Basic Single Server
M/M/1 : Poisson Arrivals, Exponential service times, 1 Server

P0 1 /
P ( n ) P (0)( / )
Lq / ( )
2

Ls / ( )
Wq / ( )
W s 1 / ( )

Arrival Distribution
Arrivals Rate - Poisson
6000

5000

Frequency

4000

3000

Series1

2000

1000

0
1

10

11

Arrivals Per Day

= 4 Arrivals/day

12

13

14

Interarrival Time Distribution


Interarrival Distribution IA
30000

25000

Frequency

20000

15000

Series1

10000

5000

0
0

10

12

14

16

18

20

Interarrival Tim e

Minutes x 100

Avg. IAT = 1 / = .25 days = 360 Minutes

Types of Models and Assumptions


Basic Single Server
Poisson Arrival Process
Exponential Service Times
Single Server
FCFS Server Discipline
Infinite Source
Infinite Queue

Basic Multiserver
Same as Basic Single Server Except
Multiple Servers

Our main focus in this


class will be the basic
single server

Types of Models and Assumptions


Single Server with Arbitrary Service Times
Poisson Arrival Process
Service Time Distribution is Unknown
(has a mean and variance)
Single Server
FCFS Server Discipline
Infinite Source, Infinite Queue
Single Server Model with Arbitrary Service Times and a
Priority Queue Discipline
Poisson Arrival Process
Service Time for Each Priority Class is Unknown
Single Server
Queue Discipline Divided Into Classes;
Service is FCFS Within Each Priority Class
Infinite Source, Infinite Queue

Server Utilization

Single Server
non
linear

Multi Server
s

Server utilization is important when looking at the


efficiency of a system

Queuing Results
All Queuing Statistics in our closed form analytical models
are STEADY STATE statistics
Steady State: Steady State conditions exist when a
systems behavior is not a function of time.
Transient: Startup Phase

f(x)

Startup

Steady State

Time

A Queuing Problem Solving


Methodology
Read the Problem!!!
Picture/Sketch the system components
Identify the underlying assumptions for each component
Identify the model based on the assumptions
Identify , , s (ensure its a RATE, time units the same)
Determine WHAT statistic(s) you have to solve for
Crunch

Class Problem 2-1


New Jersey Transit (NJT) operates a single train wash as
part of its Hoboken facility. The service time of this
machine is 30 minutes per train. The arrival time of trains
at the cleaning facility can be approximated as a Poisson
process with an arrival rate of 1.4 trains per hour. The
washing center operates 24 hours a day.
a. State the queuing model most appropriate for this
situation (assume that NJT owns and operates a lot of
trains).
b. How many trains on average are waiting to use the
facility?
c. How much time will each train spend at the facility (in
line and being washed)?
d. What is the utilization rate of the washing facility?
e. Do we need to investigate in building another washing
facility or purchasing more efficient equipment?
Quantitatively justify your answer!

Problem 2.1
A. Basic Single Server (trains always running i.e assume infinite pop)
1.4 trains per hour
2 trains per hour

B. How many trains on average are waiting to use the facility?


L q / ( ) 1.96 / 2(.6) 1.63 trains
2

C. How much time will each train spend at the facility (in line and
washed)?
W s 1 /( ) 1 / .6 1.67 Hours

D. What is the utilization rate of the washing facility?


/ 1.4 / 2 .7 70%

E. Do we need to investigate another washing facility or purchase more


efficient equipment?
Utilization rate would drop to 35% (not efficient). More efficient equipment is
probably the way to go.

Class Problem 2-3


As a newly assigned manger of Home Depot, you have received complaints about
the checkout time at the lawn and garden center. You are currently operating one
cash register. You decide to do a queuing analysis on the center and assume the
following:
- The calling population is infinite
- The pattern of arrivals is Poisson distributed
- The customers are patient and will not balk or renege
- The queue length is unlimited (customers will join the system no
matter how long the line is or how crowded the store is).
- The service times by the cashier are exponentially distributed
- The service discipline is first come, first served (no cutting in line by
senior ranks)
Your cash register information tells you the average number of customers at the
checkout counter are 24 customers per hour. The service rate by the checkout
worker averages 30 customers per hour. You are trying to justify whether to hire
another sales associate to corporate headquarters.

Problem 2.3 (Continued)


You need to determine the following statistics for
one and two cashiers:
1. The expected number of customers in the queue
2. The expected number of customers in the system
3. The expected time waiting in line at the register
4. The expected time waiting in line plus the time being
served
5. The mean service time for a customer
6. The probability of having 5 customers in the system
7. The proportion of time the one cashier can be expected
to be busy

Problem 2.3

1. L q / ( ) (24) / 30(30 24) 3.2 C ustom ers


2

2. L s /( ) 24 /(30 24) 4 C ustom ers


3.W q /( ( )) 24 /(30(30 24)) 24 / 180 .133 hrs . 8m inutes.
4.W s 1 /( ) 1 / 6 .167 hrs . 10 m inutes
5.1 / 1 / 30 custom ers / hr .033 hrs / c usstom er 2 m inutes / custom er
6. P (0) 1 / 1 1 (24 / 30) .2, P (5) P (0) .2(.8) .066
5

7. / 24 / 30 .8 proportion of tim e cashier exp ected to be busy

Problem 2.3 (Continued)


For 2 Cashiers (S=2)

Using Formulas on Page 2-15 Appendix 2B

s
2
1. L q P (0)( / ) / s !(1 ) , P (0) .4286 from m ltiserver table *

L q (.4286)(24 / 30) (24 / 2 * 30) / 2 !(1 24 / 2 * 30) .152 custom ers


2

2. L s L q ( / ) .152 (24 / 30) .952 C ustom ers


3.W q L q / .152 custom ers / 24 custom ers / hour .0063 3 hrs .381m inutes
4.W s W q (1 / ) .381 m in/ custom er 2 m in/ custom er 2.381 m in/ custom er
5.1 / ( m ean service tim e for a custom er )
6. P (5) (24 / 30) / 2 !2
5

(5 2)

* .4286, P (0) .4286

P(5) =.008777

7. / s 24 / 2 * 30 .40
* See attached excel spreadsheet for P(0), P(5) Calculations

Some Insights Into Single Server Analysis

What is a best measure of how well a system a


system is working?

= server utilization
Ws = time in system
Wq = time waiting in line

To me, from a customer service perspective, Wq is


the most important measure!

Homework Problem 2.4

Hoboken police have 10 patrol cars. A patrol car breaks down and requires service once every 15 days. The police department
has 2 repair workers each of whom takes an average of 3 days to repair a car. Breakdown and service times are
EXPONENTIALLY distributed.

Limited Source (k=10), s=2, = 1/15 = .0667 cars/day, =.333 cars/day, N = calling population =10

1.

See Formulas in Table 2.3 on Page 2-7


Determine avg. number of cars in good condition

number of good cars = N Ls so we need to find Ls (limited source and s=2)

L s Expected # inSystem 1P (1) 2 P (2) ..... 10 P (10)


s 1

P (0) 1 /[ N !( / ) /( N n ) ! n !
n

n0

for 0 n s P ( 0 )

(N n )!n !
N!

N !( / ) /( N n ) ! s ! s
n

ns

n2

for s n N P ( 0 )

N!
(N n )!s ! s

P(1)=.2404, P(2)= .2163, P(3) = .1731, P(4)=.1211, P(5)=.0727, P(6)=.0363, P(7)=.0145


P(8)=.0044, P(9)=.0009, P(10)=.0001 Ls=2.4037, N-Ls=7.5963 Cars expected to be good!

2.

Determine the average downtime for a police car that needs repairs.

See finit source eq table

k ( N L s ) .0667 (7.5963) .5064 cars / day


W s L s / k 2.4037 / .5064 4.7465 day sin system
3.

=.1202

Determine the fraction of time at least one worker is idle.

1. P(0)+P(1)=.1202+.2404=.3606

ns

Problem 2.4 Spreadsheet

Lambda
Mu
S
0.06666667
0.333333333

Y
3

P(0)
P(1)
P(2)
P(3)
P(4)
P(5)
P(6)
P(7)
P(8)
P(9)
P(10)

X+Y
5.320431

10

RHO
10

0.2

P(0)
8.320431

0.1202

0.1202
0.2404
0.2164
0.1731
0.1212
0.0727
0.0363
0.0145
0.0044
0.0003
0.0001

0.999592

Lets look at the Excel Spreadsheet

GPSS model of Problem 2.4


Repair Storage 2
XPDIS
Function RN1,C24
0,0/.1,.104/.2,.222/.3,.355/.4,.509/.5,.69/.6,.915/.7,1.2/.75,1.38
.8,1.6/.84,1.83/.88,2.12/.9,2.3/.92,2.52/.94,2.81/.95,2.99/.96,3.2
.97,3.5/.98,3.9/.99,4.6/.995,5.3/.998,6.2/.999,7/.9998,8
Generate
360,FN$XPDIS,,10 ; 15 days X 24 Hours per day
Advance
0
Queue1 Queue
Broken
Queue
Repair
Enter
Repair
Depart
Repair
Advance
72,FN$XPDIS
; 3 days X 24 Hours Per Day
Leave
Repair
Depart
Broken
Queue
Good
Advance
360,FN$XPDIS
; 15 days X 24 Hours Per day
Depart
Good
Transfer
,Queue1
Generate
24
; 1 Day X 24 Hours Per Dy
Terminate
1

GPSS Model of Problem 2.4 Results


QUEUE
REPAIR
BROKEN
GOOD

MAX CONT. ENTRY ENTRY(0) AVE.CONT. AVE.TIME AVE.(-0) R


8 0 505566 224900 0.879 41.728 75.165 0
10 2 505566
0
2.396 113.734 113.734 0
10 8 505564
0
7.603 360.951 360.951 0

STORAGE CAP. REM. MIN. MAX. ENTRIES AVL. AVE.C. UTIL. RETRY DELAY
REPAIR
2 0
0 2
505566 1 1.517 0.758 0 0

Summary
One lecture overview of queuing some
universities teach whole classes in queuing
Understanding of queuing necessary for
simulation
These are closed form math solutions
Modeling queues with simulations is a better
technique than closed form if the data is available

Questions?

Process Generators
Discrete Process Generators
Easier to explain and
understand

In many simulations, it is more


realistic and practical to use
continuous random variables
- Computational it is more efficient
- More representative of the
real world

Continuous Process Generators

Another DPG Example


Suppose a random variable can take on the values 2, 5, 8, 9, 12
with corresponding relative frequencies .15, .20, .25, .22, and .18.
DPG:
Value of

RV

12

Relative
Frequency
.15
.20
.25
.22
.18

Cumulative
Frequency
.15
.35
.60
.82
1.0

r1 < r <= r2
Range
0.0 < r <=.15
.15 < r <= .35
.35 < r <= .60
.60 < r <= .82
.82 < r <= 1.0

Corresponding GPSS Function


CLASS FUNCTION
RN4,D5
.15,2/.35,5/.6,8/.82,9/1,12
Note: GPSS RN4 can result in a 0 but not 1.0 so not quite table in
previous slide but not much of a concern.

Discrete Process Generators


1

Time
Between
Truck
Arrivals,
Hours

12

12
10

Frequency

0.75

8
6

0.50

4
0.25

2
0

0
20

10

30

0.5

0.25

0.75

1.0

Time Between Truck Arrivals, Hours

a. Sorted Observations

30/30

1.0

Cumulative
Probability

b. Histogram

24/30

0.8

21/30

Uniform
Random
Variable

Time Between
Truck Arrivals
(hours)

0.6
12/30

0.4
0.2
0
0

0.25

0.5

0.75

1.0

0
0.40
0.70
0.80

<
<
<
<

r
r
r
r

<
<
<
<

0.40
0.70
0.80
1.00

Time Between Truck Arrivals, Hours


c. Cumulative Distribution Function

d. Process Generator

0.25
0.50
0.75
1.00

Role of Statistics in Modeling and


Simulation
Frequency tables or histograms suppress much detail
Idealized mathematical representations are needed
real world is not discrete
mathematically efficient
The curve describing the shape of the distribution is called
a frequency curve
0.4

Area Under
Curve Must Be
Equal to 1

f(x)

0.3
0.2
0.1
0
5

Interarrival Time, Students/Hour

GPSS Basic Single Server Model


Lets RUN a GPSS model of a Basic Single Server augmented to
obtain histograms of inter arrival time distribution, number of
arrivals per unit time distribution, and waiting time distribution.
Lets look at EXCEL plots of the distribution
Are you convinced that math and simulation model agree?

Basic Single Server w/ Histograms


Exponential Inter Arrival and Service Times

XPDIS
Function RN1,C24
0,0/.1,.104/.2,.222/.3,.355/.4,.509/.5,.69/.6,.915/.7,1.2/.75,1.38
.8,1.6/.84,1.83/.88,2.12/.9,2.3/.92,2.52/.94,2.81/.95,2.99/.96,3.2
.97,3.5/.98,3.9/.99,4.6/.995,5.3/.998,6.2/.999,7/.9998,8
IAV
Variable C1-X1
ARR
Variable
X2
HSTIA TABLE
V$IAV,0,100,20
ARRT
TABLE
V$ARR,0,1,20
INQUE QTABLE 1,0,100,30
Generate 360,FN$XPDIS
PATH
Tabulate HSTIA
Savevalue 1,C1
Savevalue 2+,1
Queue
1
Seize
1
Advance
240,FN$XPDIS
Release
1
Depart 1
Terminate 1
Generate 1440
Tabulate ARRT
Savevalue 2,0
Terminate
Plots the Arrival and Wait Time Distributions (What arrival
distribution do you think we will get?)

Interarrival Time Distribution


Interarrival Distribution IA
30000

25000

Frequency

20000

15000

Series1

10000

5000

0
0

10
Interarrival Tim e

Minutes x 100

12

14

16

18

20

Arrival Distribution
Arrivals Rate - Poisson
6000

5000

Frequency

4000

3000

Series1

2000

1000

0
1

Arrivals Per Day

10

11

12

13

14

Time Spent in Queue Distribution

Time in Queue Distribution


14000

Frequency

12000
10000
8000

Series1

6000
4000
2000
0
0

10

20

Minutes x 100

30

Generating Exponential IAs Using EXCEL


Need to Convert Uniform Random Numbers (RAND()) to values of the
Random Variable with desired Exponential Distribution
We could approximate using a Discrete Process Generator but better
to use a Continuous Process Generator when dealing with continuous
distributions such as the exponential.
We will learn a method called the Inverse Transform Method to derive
a formula which can yield the desired distribution. For the exponential
that will be:

x (1 / ) ln ( r )
w h ere 0 r 1

a rriva l ra te
X (1 / ) * ln( RAND ())

Lets Checkout using Excel!

Next Week
Read Chapter 4
Examples of Simulation
Class Problems 4. 2, 4.3, 4.7(Ginos)*
Role of Probability & Statistics
Continuous Process Generators

*see attached word doc for CORRECT Ch 4 problems to do!!!!

Potrebbero piacerti anche