30
The Theory of Queues Models of Waiting in line

The Theory of Queues Models of Waiting in line. Queuing Theory Basic model: Arrivals Queue Being Served Done – Queuing theory lets you calculate:

  • View
    223

  • Download
    2

Embed Size (px)

Citation preview

Page 1: The Theory of Queues Models of Waiting in line. Queuing Theory Basic model: Arrivals  Queue  Being Served  Done – Queuing theory lets you calculate:

The Theory of Queues

Models of Waiting in line

Page 2: The Theory of Queues Models of Waiting in line. Queuing Theory Basic model: Arrivals  Queue  Being Served  Done – Queuing theory lets you calculate:

Queuing Theory

• Basic model:• Arrivals Queue Being Served Done

– Queuing theory lets you calculate:• How long will it take an average customer to

get done?• How many customers are waiting, on average?

Page 3: The Theory of Queues Models of Waiting in line. Queuing Theory Basic model: Arrivals  Queue  Being Served  Done – Queuing theory lets you calculate:

Why this is useful

• How long will it take a customer to get done?– Time allocation

• For customers• For service

• How many customers are waiting?– Space allocation– Social dynamic

Page 4: The Theory of Queues Models of Waiting in line. Queuing Theory Basic model: Arrivals  Queue  Being Served  Done – Queuing theory lets you calculate:

Arrivals Queue Being Served Done

– Jargon:

• Queue < System• Queue is a subset of the System• System = In queue + being served

Page 5: The Theory of Queues Models of Waiting in line. Queuing Theory Basic model: Arrivals  Queue  Being Served  Done – Queuing theory lets you calculate:

Arrivals Queue Being Served Done

– Standard Greek letters:

• λ (Lambda) – Average arrival rate• μ (Mu) – Average service rate

• 1/λ = Average time between arrivals• 1/μ = Average time for service

Page 6: The Theory of Queues Models of Waiting in line. Queuing Theory Basic model: Arrivals  Queue  Being Served  Done – Queuing theory lets you calculate:

Steady State -- when average performance is not changing

• λ Lambda – Average arrival rate• μ Mu – Average service rate

• If μ > λ – if the service rate is faster than the arrival rate – there is a steady state.

• If λ > μ, there is no steady state. The queue will grow and grow.

Page 7: The Theory of Queues Models of Waiting in line. Queuing Theory Basic model: Arrivals  Queue  Being Served  Done – Queuing theory lets you calculate:

Y a Q if λ < μ?

• Why is there a queue if customers are served faster than they are arriving, on average?

Page 8: The Theory of Queues Models of Waiting in line. Queuing Theory Basic model: Arrivals  Queue  Being Served  Done – Queuing theory lets you calculate:

Y a Q if λ<μ?

• Why is there a queue if customers are served faster than they are arriving, on average?

• Because of random variation in arrival and service times.

Page 9: The Theory of Queues Models of Waiting in line. Queuing Theory Basic model: Arrivals  Queue  Being Served  Done – Queuing theory lets you calculate:

Randomness Modeled

– Suppose …• An event can happen at any time• Events are independent• We know the average rate of occurrence

– Then we use …• Poisson distribution

– random variation with no limit– extremes are unlikely but possible

Page 10: The Theory of Queues Models of Waiting in line. Queuing Theory Basic model: Arrivals  Queue  Being Served  Done – Queuing theory lets you calculate:

Poisson distribution

• Limit of the binomial• Cut t amount of time into smaller and smaller

pieces• Only one arrival allowed during each piece.• The probability of an arrival during the piece is

λ/N, where N is the number of pieces.• As N∞, the probability of x arrivals during t

amount of time is …

Page 11: The Theory of Queues Models of Waiting in line. Queuing Theory Basic model: Arrivals  Queue  Being Served  Done – Queuing theory lets you calculate:

Poisson distribution

• Prob (x arrivals during time t) =

!

)(

x

te xt

Page 12: The Theory of Queues Models of Waiting in line. Queuing Theory Basic model: Arrivals  Queue  Being Served  Done – Queuing theory lets you calculate:

Divide time period into 2 pieces, with 1/2 probability of event in each piece.Each time period is independent of the others.

0.5 0.50 0 1/2*1/2 0.25 10 1 1/2*1/2 0.25 21 0 1/2*1/2 0.251 1 1/2*1/2 0.25 1

Page 13: The Theory of Queues Models of Waiting in line. Queuing Theory Basic model: Arrivals  Queue  Being Served  Done – Queuing theory lets you calculate:

Divide time period into 3 pieces, with 1/3 probability of event in each piece.0.33333 0.33333 0.3333

0 0 0 2/3*2/3*2/3 0.2963 11 0 0 1/3*2/3*2/3 0.14815 30 1 0 2/3*1/3*2/3 0.148150 0 1 2/3*2/3*1/3 0.148151 1 0 1/3*1/3*2/3 0.07407 31 0 1 1/3*2/3*1/3 0.074070 1 1 2/3*1/3*1/3 0.074071 1 1 1/3*1/3*1/3 0.03704 1

Page 14: The Theory of Queues Models of Waiting in line. Queuing Theory Basic model: Arrivals  Queue  Being Served  Done – Queuing theory lets you calculate:

Divide time period into 4 pieces, with 1/4 probability of event in each piece.0.25 0.25 0.25 0.25

0 0 0 0 3/4*3/4*3/4*3/4 0.31641 11 0 0 0 1/4*3/4*3/4*3/4 0.10547 40 1 0 0 3/4*1/4*3/4*3/4 0.105470 0 0 1 3/4*3/4*3/4*1/4 0.105470 0 1 0 3/4*3/4*1/4*3/4 0.105471 0 0 1 1/4*3/4*3/4*1/4 0.03516 61 1 0 0 1/4*1/4*3/4*3/4 0.035161 0 1 0 1/4*3/4*1/4*3/4 0.035160 1 0 1 3/4*1/4*3/4*1/4 0.035160 0 1 1 3/4*3/4*1/4*1/4 0.035160 1 1 0 3/4*1/4*1/4*3/4 0.035161 1 1 0 1/4*1/4*1/4*3/4 0.01172 41 1 0 1 1/4*1/4*3/4*1/4 0.011720 1 1 1 3/4*1/4*1/4*1/4 0.011721 0 1 1 1/4*3/4*1/4*1/4 0.011721 1 1 1 1/4*1/4*1/4*1/4 0.00391 1

Page 15: The Theory of Queues Models of Waiting in line. Queuing Theory Basic model: Arrivals  Queue  Being Served  Done – Queuing theory lets you calculate:
Page 16: The Theory of Queues Models of Waiting in line. Queuing Theory Basic model: Arrivals  Queue  Being Served  Done – Queuing theory lets you calculate:
Page 17: The Theory of Queues Models of Waiting in line. Queuing Theory Basic model: Arrivals  Queue  Being Served  Done – Queuing theory lets you calculate:

10 pieces

Page 18: The Theory of Queues Models of Waiting in line. Queuing Theory Basic model: Arrivals  Queue  Being Served  Done – Queuing theory lets you calculate:

0 1 2 3 4 5 6 7 80

0.05

0.1

0.15

0.2

0.25

0.3

0.35

0.4

0.45

0.5Prob(x)

Poisson

60 pieces

Page 19: The Theory of Queues Models of Waiting in line. Queuing Theory Basic model: Arrivals  Queue  Being Served  Done – Queuing theory lets you calculate:

A model of randomness and independence of events

– Using the Poisson distribution in your queuing model means adopting to binomial distribution’s assumptions:

• An event can happen at any time• With equal probability• Independent events

Page 20: The Theory of Queues Models of Waiting in line. Queuing Theory Basic model: Arrivals  Queue  Being Served  Done – Queuing theory lets you calculate:

Poisson distribution application

• Running total of Poisson distribution can show how much inventory is needed.

Page 21: The Theory of Queues Models of Waiting in line. Queuing Theory Basic model: Arrivals  Queue  Being Served  Done – Queuing theory lets you calculate:

Exponential Distribution

• Probability that the next ARRIVAL will be during the next t amount of time =

te 1

Page 22: The Theory of Queues Models of Waiting in line. Queuing Theory Basic model: Arrivals  Queue  Being Served  Done – Queuing theory lets you calculate:

Exponential Distribution

• Probability that the SERVER will finish with the current customer during the next t amount of time =

te 1

Page 23: The Theory of Queues Models of Waiting in line. Queuing Theory Basic model: Arrivals  Queue  Being Served  Done – Queuing theory lets you calculate:

Exponential Distribution example

• If μ = 1 per hour,• Probability the the SERVER will finish current

customer during the next hour is 1 – e-1

• = 0.632• For half of the customers, the service takes

less than 42 minutes.

Page 24: The Theory of Queues Models of Waiting in line. Queuing Theory Basic model: Arrivals  Queue  Being Served  Done – Queuing theory lets you calculate:

Steady State

• When the distribution of probabilities of various numbers in the system stabilizes

• When startup conditions are far behind• λ<μ required for steady state to exist• ρ=λ/μ is how busy the server is• ρ is server busy time ÷ all time• ρ< 1 for steady state to be possible

Page 25: The Theory of Queues Models of Waiting in line. Queuing Theory Basic model: Arrivals  Queue  Being Served  Done – Queuing theory lets you calculate:

Steady State with Poisson arrivals and service times

• For single-server single-stage queue with Poisson arrivals and service:

• Probability of n in the system (waiting or being served)= (1-ρ)ρn

Page 26: The Theory of Queues Models of Waiting in line. Queuing Theory Basic model: Arrivals  Queue  Being Served  Done – Queuing theory lets you calculate:

Customers in System and in Queue

• L – customers in system =

• Lq – customers in queue = ρL

• These are averages, once the steady state is reached.

• There are usually fewer in the system than L because the prob of n in system is skewed.

1

Page 27: The Theory of Queues Models of Waiting in line. Queuing Theory Basic model: Arrivals  Queue  Being Served  Done – Queuing theory lets you calculate:

L = ρ/(1-ρ) = λ/(u-λ)

• When the arrival rate nearly equals the service rate, the line can get very long.

• If the arrival rate nearly equals the service rate, small changes in either rate can make a big difference.

Page 28: The Theory of Queues Models of Waiting in line. Queuing Theory Basic model: Arrivals  Queue  Being Served  Done – Queuing theory lets you calculate:

Time in System

• W – time in system = L/λ

• Wq – time waiting to be served = ρW

• These are averages, once the steady state is reached.

• Most customers get through in less time.

Page 29: The Theory of Queues Models of Waiting in line. Queuing Theory Basic model: Arrivals  Queue  Being Served  Done – Queuing theory lets you calculate:

W = L/λ = 1/(u-λ)

• When the arrival rate and the service rate are nearly equal, the wait can be very long.

• When the arrival rate and the service rate are nearly equal, small changes in either rate can make a big difference.

Page 30: The Theory of Queues Models of Waiting in line. Queuing Theory Basic model: Arrivals  Queue  Being Served  Done – Queuing theory lets you calculate:

Economic Analysis

Weigh• The cost of waiting

– Against -- • The cost of speeding up service or reducing

arrivals.