Skip to content

using different seeds in each part of the trajectory #306

Answered by Enchufa2
Arash-72 asked this question in Q&A
Discussion options

You must be logged in to vote

You can set a dataframe with predefined times, which are added as attributes, and then read them from there:

library(simmer)
set.seed(100)

patient <- trajectory() %>%
  seize("room", 1) %>% 
  seize("nurse", 1) %>%
  timeout_from_attribute("nurse") %>%
  release("nurse", 1) %>%
  seize("doctor", 1) %>%
  timeout_from_attribute("doctor") %>%
  release("doctor", 1) %>%
  release("room", 1)

n <- 5 # number of patients
df <- data.frame(
  time = rexp(n, 1/10), # your interarrival times
  nurse = rgamma(n, 2, 2),
  doctor = rgamma(n, 5, 3)
)

simmer() %>%
  add_resource("room", 10) %>%
  add_resource("nurse", 2) %>%
  add_resource("doctor", 2) %>%
  add_dataframe("patient", patient, df) %>%
…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by Enchufa2
Comment options

You must be logged in to vote
4 replies
@Enchufa2
Comment options

@Arash-72
Comment options

@Enchufa2
Comment options

@Arash-72
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants