leave {simmer} | R Documentation |
Activity for leaving the trajectory with some probability.
leave(.trj, prob)
.trj |
the trajectory object. |
prob |
a probability or a function returning a probability. |
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.
Returns the trajectory object.
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