simmer (version 4.0.0)

branch: Fork the Trajectory Path

Description

Activity for defining a fork with N alternative sub-trajectories.

Usage

branch(.trj, option, continue, ...)

Arguments

.trj

the trajectory object.

option

a callable object (a function) which must return an integer between 0 and N. A return value equal to 0 skips the branch and continues to the next activity. A returning value between 1 to N makes the arrival to follow the corresponding sub-trajectory.

continue

a vector of N booleans that indicate whether the arrival must continue to the main trajectory after each sub-trajectory or not (if only one value is provided, it will be recycled to match the number of sub-trajectories).

...

N trajectory objects (or a list of N trajectory objects) describing each sub-trajectory.

Value

Returns the trajectory object.