At your local barbershop, there are always four barbers working simultaneously. Each haircut takes exactly 15 minutes, and thereβs almost always one or more customers waiting their turn on a first-come, first-served basis.
Being a regular, you prefer to get your hair cut by the owner, Tiffany. If one of the other three chairs opens up, and itβs your turn, youβll say, βNo thanks, Iβm waiting for Tiffany.β The person behind you in line will then be offered the open chair, and youβll remain at the front of the line until Tiffany is available.
Unfortunately, youβre not alone in requesting Tiffany β a quarter of the other customers will hold out for Tiffany, while no one will hold out for any of the other barbers.
One Friday morning, you arrive at the barber shop to see that all four barbers are cutting hair, and there is one customer waiting. You have no idea how far along any of the barbers is in their haircuts, and you donβt know whether or not the customer in line will hold out for Tiffany.
What is the expected wait time for getting a haircut from Tiffany?
Solution
Let T be the random variable of the remaining time for haircut being done by Tiffany.
Let Biβ be the random variable of the remaining time for haircut being done by Barber i, for i=1,2,3.
Let CTβ be the indicator random variable which takes the value 1 if the waiting customer holds out for Tiffany and 0 otherwise.
The quantity E[1βFBβ(T)] can be interpreted as the average probability of T being the minimum of T,B1β,B2β and B3β, which by symmetry is 41β.
Derivation of FBβ
To derive FBβ we need to first calculate P[min(B1β,B2β,B3β)>x].
Of course, min(B1β,B2β,B3β)>x exactly when Biβ>x for i=1,2 and 3.
Therefore the expected wait time for getting a haircut from Tiffany is 14.0625 mins.
Monte Carlo Simulation
from random import random, uniformruns = 1000000total_wait_time = 0for _ in range(runs): t, b1, b2, b3 = [uniform(0, 15) for _ in range(4)] if random() <= 0.25: wait_time = 15 + t else: if t < min(b1, b2, b3): wait_time = 15 + t else: wait_time = t total_wait_time += wait_timeprint("Average wait time: ", total_wait_time/runs)