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

Show simulation progress #103

Closed
Enchufa2 opened this Issue Jun 1, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@Enchufa2
Member

Enchufa2 commented Jun 1, 2017

With a helper verb such as the following:

run_with_progress <- function(.env, until=1000, steps=10) {
  for (i in seq(until/steps, until, until/steps)) {
    run(.env, until=i)
    message(paste0(100*i/until, "%"))
  }
  .env
}

@Enchufa2 Enchufa2 added the enhancement label Jun 1, 2017

@Enchufa2 Enchufa2 closed this in 72e7359 Jun 5, 2017

@Enchufa2

This comment has been minimized.

Member

Enchufa2 commented Jun 5, 2017

Finally, implemented in run() as an option. Example using the progress package:

library(simmer)
library(progress)

mm1 <- trajectory() %>%
  seize("server", 1) %>%
  timeout(function() rexp(1, 66)) %>%
  release("server", 1)

simmer() %>%
  add_resource("server", 1) %>%
  add_generator("customer", mm1, function() rexp(100, 60)) %>%
  run(3000, progress=progress_bar$new()$update, steps=10)
@spgarbet

This comment has been minimized.

spgarbet commented Jun 5, 2017

Excellent!

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