die()

Causes the current agent to terminate (die).

Synopsis

die()

Description

This function causes the current agent to die. The agent is immediately removed from the population, including all mixing groups and conditions, and no longer participates in the simulation.

Parameters

This function has no parameters.

Examples

An agent with ID id1 can be selected to die with the action rule:

if (id == id1) then die()

As a more interesting example, the following code shows how agents might behave in a Hospitalized state where 30% of agents do not recover (and die) and the remaining agents recover.

state Hospitalized {
    wait(2 * 24)
    next(NoRecovery) with prob(0.3)
    default(Recovered)
}

state NoRecovery {
    die()
            wait()
    next()
}

Notes

die() is synonomous with exit().

See Also

ref:

exit(),

ref:

give_birth()