Assignment 2: Weasley Barber Shop (30 marks)
Due Date: Thursday, February 14, 2019 (4:00pm)
Learning Objectives
The purpose of this assignment is to learn about analytical and simulation modeling. In particular, you will use Markov chains and discrete-event simulation to study the loss behaviour of a finite-capacity queue in a heterogeneous multi-server system.
Scenario
The Weasley twins, Fred and George, have opened a new barber shop at Hogwarts. Their shop has two identical barber chairs for customers to sit in while getting their hair cut, either by Fred (barber chair F) or George (barber chair G). There are also three ordinary chairs in the waiting room for customers who are waiting for service, in a First-Come-First-Serve (FCFS) fashion.
Customers arrive to the barber shop according to a Poisson arrival process with average rate λ. If both barber chairs are empty when a customer arrives, then the arriving customer chooses their barber chair uniformly at random (since they can't tell the twins apart), and starts getting their hair cut immediately by the chosen barber. If only one barber chair is empty, the customer goes to that chair, and starts getting their hair cut immediately. If both barber chairs are occupied, then the arriving customer goes to the waiting room, if space is available, and waits for their turn to get a haircut. If the waiting room is full, the customer leaves in a huff and never returns. If there are waiting customers, they receive service by the next available barber as soon as a barber chair is vacated. The service time for a haircut is exponentially distributed with mean 1/μ, where μ is the service rate for customer haircuts. However, Fred is slightly faster than George at cutting hair. Their respective service rates are μ1 and μ2, with μ1 > μ2.
Analytical Modeling (15 marks)
- (2 marks) Draw a Markov chain representing the states and transition rates of this system.
- (3 marks) Write the set of balance equations for this system.
- (6 marks) Derive the (steady-state) equilibrium state probabilities p_i for this system. (Tip: You may want to ignore the waiting room initially, and then add it back in later, one chair at a time.)
- (4 marks) Assuming λ = 6.0 customers per hour, μ1 = 5.0 customer haircuts per hour, and μ2 = 3.0 customer haircuts per hour, calculate the average utilization of each barber chair, as well as the expected number of customers in the system, and the proportion of customers lost due to waiting room overflow.
Simulation Modeling (15 marks)
- (6 marks) Write a continuous-time discrete-event simulation model of the Weasley Barber Shop, using a programming language of your choice (e.g., C, C++, Java, Python).
- (2 marks) Use your simulation to determine the proportion of lost customers when λ = 6.0, μ1 = 5.0, and μ2 = 3.0. Compare this result to that from your analytical model. Comment on your results.
- (3 marks) Conduct a one-factor simulation experiment varying the waiting room size (e.g., from 0 to 20 chairs) to see the effect on the loss of customers at a fixed high value of load (90%). Draw a graph to show these results. Comment on your results and observations.
- (2 marks) Use your simulation to compare your results (e.g., graphically, statistically, or in a table) to the known analytical results for an M/M/1/K queue, where the single server has an aggregate service rate of μ1 + μ2. Comment on your results.
- (2 marks) Use your simulation to compare your results to the known analytical results for an M/M/2 queue, where the servers have homogeneous rates μ1 = μ2. Comment on your results.
Optional Bonus (2 marks)
Using either your analytical model or your simulation model (or both), test the sensitivity of your results to the customer arrival process, while leaving the service time distribution the same as before (i.e., exponential). In particular, keep the average customer arrival rate the same, but change the characteristics/properties of the inter-arrival time distribution to see the effect (if any) on customer loss. Indicate what arrival process(es) you used, and comment on your results.
Assignment Submission
When you are finished, please hand in a hardcopy of your analytical and simulation modeling results, including diagrams, equations, graphs, and the writeup about your observations. You do not need to provide source code for the simulator that you used, but please indicate what programming language you used, and how many lines of code you needed. (You should also keep your simulator handy, in case I ask for it later).