Do you think we can model one server checkout counter in a retail store using what chapter 6 covers?

Let’s try it:

Assumptions: * The processing time per customer at the checkout counter depends on the number of items that the person carries plus some overhead. This results in the following model: \(p = 0.05i +0.5\). Here, i is the number of items in the order and p is the order processing time per customer in minutes * Checkout Items: People checkout anywhere between 1 and 5 items per order with a uniform distribution (3 items in average) * People traffic: we assume that there can be anywhere between 1 and 3 people purchasing some items every 5 minutes.

Let’s see what’s the average waiting time under these conditions for a given “rush hour”:

checkout_clerk_simulator <- function(){
  n<-c(0:60)
  
  people_waiting <- c(0)
  accumulated_work <- c(0)
  for ( k in n) {
    # simulate customers and items for those customers in this iteration
    customers_checking_out <- round(runif(1, 1, 3))
    items_per_customer <- c(round(runif(customers_checking_out, 1, 5)))
    processing_time_per_customer <- 0.05*items_per_customer+0.5
    time_required_to_checkout_customers <- sum(processing_time_per_customer)
  
    # accumulate with previous work
    accumulated_work <- c(accumulated_work, accumulated_work[k] + time_required_to_checkout_customers - 1)
  
  }
  
  return (accumulated_work)
}

# Let's grossly estimate the number of people waiting by dividing the accumulated work in items by the average number of items that people checkout

simulation <- replicate(1000,checkout_clerk_simulator())/3



# Average amount of people waiting
mean(apply(simulation,2,mean))
## [1] 3.063237
hist(apply(simulation,2,mean),main="Distrubution of Average Queue Size (people)")

#longest size of queue
mean(apply(simulation,2,max))
## [1] 6.137367
hist(apply(simulation,2,max),main="Distrubution of Longest Queue Size (people)")

As we can see above, for this simulation, the average number of people waiting at this checkout counter is 3. The average longest queue is composed of 6 people.