Assignment 1 (10%)
A supermarket has p
checkouts and customers must choose one, forming a queue if it is already occupied. Customers always choose the shortest queue. The time between each new customer arriving at the checkouts has an exponential distribution with mean \mu minutes. The time it takes for a checkout operator to process a customer has an independent exponential distribution with mean \lambda minutes.
Write an R function to simulate the supermarket queues at each checkout, taking the arguments mu
, lambda
, p
and n
, and returning the total number of customers waiting to be served, n
minutes after the supermarket opens. The argument p
should have default value 3, while n
should have default value 720
(the number of minutes in a 12 hour day). The other arguments should have no default values. Your function should be named remaining_customers
.
Your code should be as efficient as possible. Arguments should be checked for range and class.
AI & Generative AI tools may be used in guided ways within this assessment. If you used AI in completing this assignment, please explain how it was used, including any prompts. Where used, AI must be used responsibly, clearly documented and appropriately acknowledged (see Learn HQ). Any work submitted for a mark must:
- represent a sincere demonstration of your human efforts, skills and subject knowledge that you will be accountable for.
- adhere to the guidelines for AI use set for the assessment task.
- reflect the University’s commitment to academic integrity and ethical behaviour.
Inappropriate AI use and/or AI use without acknowledgement will be considered a breach of academic integrity.
Due: 21 March 2025
Join GitHub Classroom
The suggested solutions for this assignment are can be found here: A1_solution.R
.