Skip to contents

Execute steps until a given criterion.

Usage

run(.env, until = Inf, progress = NULL, steps = 10)

stepn(.env, n = 1)

Arguments

.env

the simulation environment.

until

stop time.

progress

optional callback to show the progress of the simulation. The completed ratio is periodically passed as argument to the callback.

steps

number of steps to show as progress (it takes effect only if progress is provided).

n

number of events to simulate.

Value

Returns the simulation environment.

See also

Examples

## show the progress just printing the steps
simmer() %>%
  run(progress=message, steps=5)
#> 0
#> 0.2
#> 0.4
#> 0.6
#> 0.8
#> 1
#> simmer environment: anonymous | now: 0 | next: 
#> { Monitor: in memory }

## using the 'progress' package
if (FALSE) { # \dontrun{
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::progress_bar$new()$update)
} # }