New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic timeout for batches #93

Closed
Enchufa2 opened this Issue May 5, 2017 · 0 comments

Comments

Projects
None yet
1 participant
@Enchufa2
Member

Enchufa2 commented May 5, 2017

Related to this thread.

Instead of this,

triage <- trajectory("Patient's path") %>%
  log_("arrive at queue") %>%
  trap("check mailbox") %>%
  wait() %>%
  log_("triage")

mailbox <- trajectory() %>%
  timeout(function() rgamma(1, shape = 2, rate = 0.1)) %>%
  send("check mailbox") %>%
  rollback(2, Inf)

set.seed(1234)

env <- simmer()  %>%
  add_generator("person", triage, function() rpois(1, 2)) %>%
  add_generator("mailbox", mailbox, at(0)) %>%
  run(25)

accepting a function in a batch()'s timeout parameter would allow us to do the following (not working yet):

triage <- trajectory("Patient's path") %>%
  log_("arrive at queue") %>%
  batch(Inf, timeout=function() rgamma(1, shape = 2, rate = 0.1)) %>%
  separate() %>%
  log_("triage")

set.seed(1234)

env <- simmer()  %>%
  add_generator("person", triage, function() rpois(1, 2)) %>%
  run(25)

Support for n=Inf would be needed too.

@Enchufa2 Enchufa2 added the enhancement label May 5, 2017

@Enchufa2 Enchufa2 closed this in 656e94f May 5, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment