Runs when the model activates an agent. The main logic of an agent-based model should be hooked here. This function will be executed n×s times per period, where n is the number of agents and s is the number of model stages, unless the period is cut short.
This hook generalizes to [primitive]Step
, e.g. the step function of an agent with primitive 'bank'
would be hooked with bankStep
. To hook the step function of agents of all primitives, use baseAgentStep
.
The list of agents to be stepped is finalized at the beginning of each stage, so any agent who is alive at the beginning of the stage will be stepped, even in the unusual case that it dies between then and its actual stepping. If this is undesired, if agent.dead: return
at the beginning of the hook will prevent this.
Required Parameters
agent — Agent
The agent being activated.
model — Helipad
The model object.
stage — int
The current stage of the model. For single-stage models, this parameter will always pass
1
.
Notes and Examples