ESD: Recitation #5 The barbershop revisited Photo removed due to copyright restrictions. Infinite number of waiting seats • One barber, infinite number of chairs for waiting customers. • Prospective customers arrive in a Poisson manner at the rate of λ per hour. • It takes the barber 1/µ on average to serve a customer (λ = 0.9 x µ). • No prospective customer is ever lost. • What is the average number of customers? Model λ 0 λ 1 µ λ 2 µ λ 3 µ 4 µ … Solving (1) • What is the probability that N customers are in the barbershop? ! ! P1 = P0 ;P2 = P1 µ µ " ! %N PN = $ ' P0 #µ& ) * Pi = 1 ( P0 = i= 0 1 1 1 = = = 0.1 k ) ) 10 "!% k 0.9 *$# µ '& * k= 0 k= 0 Solving (2) • Average number of customers: # " &N PN = 0.1! % ( = 0.1! 0.9 N $µ' ) ) k= 0 k= 0 E[Nb _ customers] = * k.Pk =0.1! * k ! 0.9 k = 9 Different service completion rate • One barber, two chairs for waiting customers. • Prospective customers arrive in a Poisson manner at the rate of λ per hour. • It takes the barber 1/µ on average to serve a customer. The service completion rate is described by a second order Erlang pdf. Assume λ = µ. • Prospective customers finding the barbershop full are lost forever. • What is the average number of customers? Model 0 2.µ λ λ λ λ λ 1 2 3 4 5 2.µ 2.µ 2.µ 2.µ Arrival rate: fA(x) = λ.e- λ.x, x ≥ 0 Service rate: fS(x) = 4.µ2.x.e-2.µ.x, x ≥ 0 6 2.µ Solving (1) • Steady-state probabilities: !.P0 = 2.µ.P1 (2.µ + !).P1 = 2.µ.P2 (2.µ + !).P1 = 2.µ.P2 (2.µ + !).P2 = ! .P0 + 2.µ.P3 (2.µ + !).P3 = ! .P1 + 2.µ.P4 (2.µ + !).P4 = ! .P2 + 2.µ.P5 2.µ.P5 = ! .P3 + 2.µ.P6 2.µ.P6 = ! .P4 Solving (2) • Calculate P0: 6 1 3 5 11 21 11 65 " Pk = 1 ! P0 + 2 P0 + 4 P0 + 8 P0 + 16 P0 + 32 P0 + 32 P0 = 16 P0 k= 0 6 16 " Pk = 1 ! P0 = 65 k= 0 Solving (3) • Average number of customers: " 8 12 % 16 E[Nb _ customers] = 0 ! + 1! $ + ' # 65 65 & 65 " 2 11 % " 21 11 % +2 ! $ + ' + 3 ! $ + ' # 13 65 & # 130 130 & 22 E[Nb _ customers] = ( 1.692 13 Additional barber • Two barbers: – Adam (takes 1/µ1 on average to serve a customer) – Ben (takes 1/µ2 on average to serve a customer) • One chair for waiting customers. • Prospective customers arrive in a Poisson manner at the rate of λ per hour. • Prospective customers finding the barbershop full are lost forever Modeling the system λ 0,0 µ1 µ2 λ 1,0 µ1 µ2 λ 0,1 µ2 λ λ 1,1 µ1 2,0 2,1 µ1 State of the system: Si,j i: number of people being serviced by or waiting for Adam j: number of people being serviced by Ben The question • Suppose λ = µ1 = µ2. • What is the probability that Ben is busy at a random time? Solving (1) • Steady-state probabilities: !.P0,0 = µ1 .P1,0 + µ 2 .P0,1 (µ1 + ! ).P1,0 = ! .P0,0 + µ1 .P2,0 + µ 2 .P1,1 (µ1 + ! ).P2,0 = ! .P1,0 + µ 2 .P2,1 (µ1 + µ 2 ).P2,1 = ! .P2,0 + !.P1,1 (µ1 + µ 2 + ! ).P1,1 = ! .P0,1 + µ1 .P2,1 (µ 2 + ! ).P0,1 = µ1 .P1,1 Solving (2) • P{Ben busy} = P0,1 + P1,1 + P2,1 • Using: P0,0 + P1,0 + P2,0 + P2,1 + P1,1 + P0,1 = 1 • We find: P{Ben _ busy} = 8 4 22 42 + + = ! 0.326 129 43 129 129