Here's the standard bank counter problem to illustrate my question:
Consider a simple bank with customers arriving at random. Customers are to be served at one of two counters, taking a random time for service at each. Also, assume that waiting customers form a single FIFO queue.
Here's the complication:
Suppose we are interested in modeling this system starting noon of a particular day instead of at the start of the day. At noon, both counters are occupied and there is already a queue of 4 customers.
Is there a way to build in this starting state in R simmer?
Here's the code I already have:
library(simmer)
set.seed(1234)
customer <-
trajectory("Customer's path") %>%
log_("Here I am") %>%
set_attribute("start_time", function() {now(bank)}) %>%
seize("counter") %>%
log_(function() {paste("Waited: ", now(bank) - get_attribute(bank, "start_time"))}) %>%
timeout(function() {rexp(1, 1/12)}) %>%
release("counter") %>%
log_(function() {paste("Finished: ", now(bank))})
bank <-
simmer("bank") %>%
add_resource("counter", 2) %>%
add_generator("Customer", customer, function() sample(1:15,1))
bank %>% run(until = 300)
You can set the initial conditions pretty easily: just add another generator to put 6 arrivals at t=0. And if you need to further customise their service times, set up another trajectory for that purpose.