leave {simmer}R Documentation

Leave the Trajectory

Description

Activity for leaving the trajectory with some probability.

Usage

leave(.trj, prob)

Arguments

.trj

the trajectory object.

prob

a probability or a function returning a probability.

Details

Arrivals that leave the trajectory will set the finished flag to FALSE in the output of get_mon_arrivals. Unfinished arrivals can be handled with a drop-out trajectory that can be set using the handle_unfinished activity.

Value

Returns the trajectory object.

See Also

handle_unfinished, renege_in

Examples

set.seed(1234)

traj <- trajectory() %>%
  log_("leave with some probability") %>%
  leave(function() runif(1) < 0.5) %>%
  log_("didn't leave")

simmer() %>%
  add_generator("dummy", traj, at(0, 1)) %>%
  run() %>% invisible


[Package simmer version 4.3.0 Index]