Queueing Theory (Part 3) - University of Washington · 2015. 2. 18. · Queueing Theory-22...

24
Queueing Theory-1 Queueing Theory (Part 3) M/M/s Queueing Systems with Variations (M/M/s, M/M/s//K, M/M/s///N)

Transcript of Queueing Theory (Part 3) - University of Washington · 2015. 2. 18. · Queueing Theory-22...

  • Queueing Theory-1

    Queueing Theory (Part 3)

    M/M/s Queueing Systems with Variations (M/M/s, M/M/s//K, M/M/s///N)

  • Queueing Theory-2

    M/M/s Queueing System •  We define

    λ = mean arrival rate µ = mean service rate s = number of servers (s > 1) ρ = λ / sµ = utilization ratio

    •  We require λ < sµ , that is ρ < 1 in order to have a steady state

    Rate Diagram

    0 1 2

    λ λ λ

    µ 2µ 3µ

    s-1 s

    λ λ λ

    (s-1)µ sµ sµ

    s+1

    λ

    … 3 4

    λ λ

    4µ 5µ

  • Queueing Theory-3

    M/M/s Queueing System Steady-State Probabilities

    !!!!

    "

    !!!!

    #

    $

    ++=%%&

    '(()

    *µ+

    =%%&

    '(()

    *µ+

    =µµµ+++

    =

    ,

    ,

    ,,

    ... 2,s 1,s!

    s ..., 2, 1,!

    ......

    11

    021

    nss

    nn

    C

    sn

    n

    n

    nn

    nnn

    )(

    1

    /11

    !)/(

    1

    0!)/(

    0

    µ!"µ!

    "

    =

    µ! +=

    # sss

    nn

    snP

    and Pn = CnP0

    where

    Use Birth Death Processes Rate In = Rate Out Coefficients are easy to remember if you think of rate diagram Example: s = 3

    0 1 2

    λ λ λ

    µ 2µ 3µ

    3 4

    λ λ

    3µ 3µ

    !

    C0 =1

    C1 ="µ

    C2 ="µ"2µ

    ="µ

    #

    $ % &

    ' (

    212!

    C3 ="µ

    #

    $ % &

    ' (

    313!

    !

    C4 ="µ

    #

    $ % &

    ' (

    41313!

    C5 ="µ

    #

    $ % &

    ' (

    513#

    $ % &

    ' ( 2 13!

    Cn ="µ

    #

    $ % &

    ' (

    n1s#

    $ % &

    ' ( n)s 1s!

  • Queueing Theory-4

    M/M/s Queueing System L, Lq, W, Wq

    21

    10

    20

    )()!1(

    )1(!)/(

    !"µµ"

    !=

    #"

    #µ!=

    "

    +

    ssP

    sPL

    s

    s

    s

    q

    !"

    #$%

    &''(

    )**+

    ,

    --

    -

    -+=>

    ----

    µ./µ.

    0µ.µ

    µ

    /11

    )1(!)/(1)(

    )/1(0

    se

    sPetP

    stst

    How to find L? W? Wq? Use Lq to find Wq (Lq = λWq):

    Wq = Lq/λ Use Wq to find W:

    W = Wq + 1/µ Use L=λW to find L in terms of Lq:

    L = λW = λ(Wq + 1/µ) = λ(Lq/λ + 1/µ) = Lq + λ/µ

    tss

    nnq ePtP

    )1(1

    01)( !µ" ##

    #

    =

    $%

    &'(

    )#=> *

    If s – 1 – λ /µ = 0 then this term is (µt)

  • Queueing Theory-5

    M/M/s Example: A Better ER •  As before, we have

    –  Average arrival rate = 1 patient every ½ hour λ = 2 patients per hour

    –  Average service time = 20 minutes to treat each patient µ = 3 patients per hour

    •  Now we have 2 doctors s = 2

    •  Utilization ρ = λ/2µ = 2/6 = 1/3 (Before s=1, ρ=2/3)

  • Queueing Theory-6

    M/M/s Example: ER Questions

    In steady state, what is the… 1.  probability that both doctors are idle?

    probability that exactly one doctor is idle?

    2.  probability that there are n patients?

    3.  expected number of patients in the ER?

  • Queueing Theory-7

    M/M/s Example: ER Questions

    In steady state, what is the… 1.  probability that both doctors are idle?

    probability that exactly one doctor is idle?

    2.  probability that there are n patients?

    3.  expected number of patients in the ER?

    !

    P0 =1

    #

    $ % &

    ' (

    0

    0!+

    #

    $ % &

    ' (

    1

    1!+

    #

    $ % &

    ' (

    2

    2!1

    1) *

    =1

    1+ 23

    +49 + 2

    12 3

    =12

    !

    P1 =" µ( )1

    1!P0 =

    2312

    =13

    !

    Pn =

    #

    $ % &

    ' (

    n

    n!P0 =

    23#

    $ % &

    ' ( n 1n!

    12

    if 0 ) n < 2

    #

    $ % &

    ' (

    n

    s!sn*sP0 =

    23#

    $ % &

    ' ( n 1

    2!12#

    $ % &

    ' ( n*2 1

    2=

    13#

    $ % &

    ' ( n

    if n + 2

    ,

    -

    .

    .

    .

    /

    .

    .

    .

    !

    L = "W = " Lq " +1 µ( ) = Lq + " µ =1 12 + 2 3 = 3 4

  • Queueing Theory-8

    M/M/s Example: ER Questions

    In steady state, what is the… 4.  expected number of patients waiting for a doctor?

    5. expected time in the ER?

    6.  expected waiting time?

    7.  probability that there are at least two patients waiting in queue?

    probability that a patient waits more than 30 minutes?

  • Queueing Theory-9

    M/M/s Example: ER Questions

    In steady state, what is the… 4.  expected number of patients waiting for a doctor?

    5. expected time in the ER? W = L/λ = (3/4)/2 = 3/8 hour ≈ 22.5 minutes

    6.  expected waiting time? Wq = Lq/λ = (1/12)/2 = 1/24 hour ≈ 2.5 minutes

    7.  probability that there are at least two patients waiting in queue? P(≥ 4 patients in system) = 1 – P0 – P1 – P2 – P3 = 1 – ½ - 1/3 – 1/9 – 1/27 ≈ 0.0185

    8.  probability that a patient waits more than 30 minutes?

    !

    Lq =P0 " µ( )

    s#

    s! 1$ #( )s=1 2( ) 2 /3( )2 1 3( )2! 2 /3( )2

    =112

    !

    P "q > t( ) = 1# P0 # P1( )e#2µ 1#$( ) t = 1# 12 #13

    %

    & '

    (

    ) * e#2(3) 2 3( )t =

    16e#4 t

    P "q > 30min( ) = P "q > 12 hour%

    & '

    (

    ) * + 0.022

  • Queueing Theory-10

    Performance Measurements

    s = 1 s = 2

    ρ 2/3 1/3

    L 2 3/4

    Lq 4/3 1/12

    W 1 hr 3/8 hr

    Wq 2/3 hr 1/24 hr

    P(at least two patients waiting in queue)

    0.296 0.0185

    P(a patient waits more than 30 minutes)

    0.404 0.022

  • Queueing Theory-11

    Travel Agency Example •  Suppose customers arrive at a travel agency according to a

    Poisson input process and service times have an exponential distribution

    •  We are given –  λ= 0.10/minute, that is, 1 customer every 10 minutes –  µ =0.08/minute, that is, 8 customers every 100 minutes

    •  If there was only one server, what would happen? λ/µ > 1 Customers would balk at long lines – never reach steady state - lose customers - go out of business?

    •  How many servers would you recommend? Calculate P0, Lq and Wq for s=2, s=3, and s=4

  • Queueing Theory-12

    P(ω>t) =

    P(ωq>t) =

  • Queueing Theory-13

    P(ω>t) =

    P(ωq>t) =

  • Queueing Theory-14

    P(ω>t) =

    P(ωq>t) =

  • Queueing Theory-15

    Single Queue vs. Multiple Queues •  Would you ever want to keep separate queues for separate

    servers?

    Single queue

    Multiple queues

    vs.

  • Queueing Theory-16

    Bank Example •  Suppose we have two tellers at a bank •  Compare the single server and multiple server models •  Assume λ = 2, µ = 3,

    L Lq W Wq P0 ρ

    0.75 0.083 0.375 0.042 0.5 λ/2µ =1/3

    1.0 0.334 0.5 0.167 0.4449

    λ`/µ =(λ/µ)/3

    =1/3

  • Queueing Theory-17

    Bank Example Continued

    •  Suppose we now have 3 tellers •  Again, compare the two models

    M/M/3 Three M/M/1 queues λ=2, µ=3 λ’ = λ/3 = 2/3, µ=3 ρ=λ/(sµ) = 2/9 M/M/1: ρ=λ’/3 = 2/9 ρ is the same L= 0.676 L=0.286 3L = 0.858 Lq = 0.009 Lq=0.063 3Lq = 0.189 W = 0.338 W = 0.429 Wq = 0.005 Wq = 0.095 P0 = 0.5122 P0 = 0.7778 (P0)3 = 0.47

  • Queueing Theory-18

    M/M/s//K Queueing Model (Finite Queue Variation of M/M/s)

    •  Now suppose the system has a maximum capacity, K •  We will still consider s servers •  Assuming s ≤ K, the maximum queue capacity is K – s •  Some applications for this model:

    Trunk lines for phone – call center Warehouse with limited storage Parking garage

    •  Draw the rate diagram for this problem:

    0 1

    λ λ

    µ 2µ

    … s-1 s s+1 λ λ λ

    sµ sµ sµ

    K

    0 λ

    (s-1)µ

    λ

  • Queueing Theory-19

    M/M/s//K Queueing Model (Finite Queue Variation of M/M/s)

    Balance equations: Rate In = Rate Out State 0: µP1 = λP0 State 1: λP0 + 2µP2 = (λ+µ)P1 State 2: λP1 + 3µP3 = (λ+2µ)P2 State 3: λP2 + 3µP4 = (λ+3µ)P3

    State K-1: λPK-2 + 3µPK = (λ+3µ)PK-1 State K: λPK-1 = 3µPK

    0 1 2 3=s 4

    λ λ λ

    2µ 3µ 3µ

    λ

    µ

    K

    0 λ

    … λ

    !

    C0 =1

    C1 ="µ

    C2 ="2

    2µ2

    C3 ="3

    3!µ3 (s = 3)

    C4 =1

    3!#3$

    % &

    '

    ( ) "µ

    $

    % & '

    ( )

    4

    !

    Cn =1

    3!#3 n*s( )$

    % &

    '

    ( ) "µ

    $

    % & '

    ( )

    n

    for s + n + K

    CK +1 = 0

    P0 =1

    Cnn=0

    K

    !

    Pn =CnP0

  • Queueing Theory-20

    M/M/s//K Queueing Model (Finite Queue Variation of M/M/s)

    Solving the balance equations, we get the following steady state probabilities:

    Kn

    nP

    ss

    nP

    n

    P nsnn

    n

    n

    n

    >

    +=µ

    !

    !

    ="

    0

    K ..., 1,s s, for!

    s ..., 2, 1, for!

    0

    0

    Verify that these equations match those given in the text for the single server case (M/M/1//K)

    !

    P0 =1

    1+ (" /µ )n

    n!n=1

    s

    # + (" /µ )s

    s!"sµ( )

    n$s

    n= s+1

    K

    #

  • Queueing Theory-21

    M/M/s//K Queueing Model (Finite Queue Variation of M/M/s)

    !!"

    #$$%

    &'++=

    µ(=))')'')')'

    )µ(=

    **'

    =

    '

    =

    ''

    1

    0

    1

    0

    20

    1

    / where)],1()(1[)1(!)/(

    s

    nnq

    s

    nn

    sKsKs

    q

    PsLnPL

    ssKsPL

    WL != qq WL != )1(0

    Kn

    nn PP !"="=" #$

    =

    To find W and Wq: Although L ≠ λW and Lq ≠ λWq because λn is not equal for all n,

    and where

    Also, because there is a finite number of states, the steady state equations do hold, even if ρ>1

  • Queueing Theory-22

    M/M/s///N Queueing Model (Finite Calling Population Variation of M/M/s)

    •  Now suppose the calling population is finite, N •  We will still consider s servers •  Assuming s ≤ N, the maximum number in the queue capacity is

    N – s, so K ≥ N does not affect anything If N is the entire population, then the maximum number in system is N. Assume N ≤ K and s ≤ N

    •  Application for this model: Machine replacement

    •  Draw the rate diagram for this problem:

    0 1

    Nλ (N-1)λ

    µ 2µ

    … s s+1 (N-s)λ (N-(s+1))λ

    sµ sµ

    N

    0 (N-(s-1))λ

    λ

  • Queueing Theory-23

    M/M/s///N Queueing Model (Finite Calling Population Variation of M/M/s)

    Queueing Theory-23

    Balance equations: Rate In = Rate Out State 0: µP1 = λP0 è P1 = (Nλ/µ)P0 State 1: NλP0 + 2µP2 = ((N-1)λ+µ)P1 è P2 = (1/2)(Nλ/µ) ((N-1)λ/µ)P0

    0 1 2 3 4

    (N-1)λ (N-2)λ (N-3)λ

    2µ 3µ 3µ

    µ

    N

    0 λ

    … (N-4)λ

    !

    C0 =1

    C1 = N"µ

    #

    $ % &

    ' (

    C2 =N N )1( )2

    #

    $ % &

    ' (

    2

    C3 =N N )1( ) N ) 2( )

    3!"µ

    #

    $ % &

    ' (

    3

  • Queueing Theory-24

    M/M/s///N Results

    ! !"

    = =" #$

    %&'(µ)

    "+#

    $%

    &'(µ)

    "

    =1

    0

    0

    !)!(!

    !)!(!

    1s

    n

    N

    sn

    n

    sn

    n

    ssnNN

    nnNN

    P

    !!!

    "

    !!!

    #

    $

    >

    %%&&'

    ())*

    +

    µ

    ,

    -

    =&&'

    ())*

    +

    µ

    ,

    -

    =-

    Nn for0

    Nn for!)!(

    !

    ,...,1,0 for!)!(

    !

    0

    0

    sPssnN

    N

    snPnnN

    N

    Pn

    sn

    n

    n

    !=

    "=N

    snnq PsnL )( !!"

    #$$%

    &'++= ((

    '

    =

    '

    =

    1

    0

    1

    01

    s

    nnq

    s

    nn PsLnPL