handle_unfinished: Handle Unfinished Arrivals

View source: R/trajectory-activities.R

handle_unfinishedR Documentation

Handle Unfinished Arrivals

Description

Activity for setting a drop-out trajectory for unfinished arrivals, i.e., those dropped from a resource (due to preemption, resource shrinkage or a rejected seize) or those that leave a trajectory.

Usage

handle_unfinished(.trj, handler, ..., tag)

Arguments

.trj

the trajectory object.

handler

trajectory object to handle unfinished arrivals. A NULL value will unset the drop-out trajectory.

...

unused.

tag

activity tag name to perform named rollbacks (see rollback) or just to better identify your activities.

Value

Returns the trajectory object.

See Also

leave, set_capacity

Examples

traj <- trajectory() %>%
  log_("arrived") %>%
  handle_unfinished(
    trajectory() %>%
      log_("preempted!")) %>%
  seize("res") %>%
  log_("resource seized") %>%
  timeout(10) %>%
  release("res") %>%
  log_("leaving")

simmer() %>%
  add_resource("res", 1, 0, preemptive=TRUE, queue_size_strict=TRUE) %>%
  add_generator("dummy", traj, at(0)) %>%
  add_generator("priority_dummy", traj, at(5), priority=1) %>%
  run() %>% invisible


simmer documentation built on Sept. 28, 2024, 1:07 a.m.