initialize
Reset context membership at the start of every replication.
KSL initializes a model element's children before the element itself, so this Context (a child of the AgentModel) is reset before the user's AgentModel.initialize() runs and repopulates per-replication agents — there is no ordering race.
Semantics:
First replication: whatever was added during model construction is the permanent scaffolding; it is captured as the setup membership and left in place.
Subsequent replications: every agent added during the previous replication is removed (via remove, firing each projection's
onAgentLeftso per-agent spatial state is cleaned), restoring the context to exactly its setup membership. Setup members — and the structural projection state tied to them, such as network edges laid at construction — are never touched.
This makes multi-replication runs independent without requiring users to manually clear() in afterReplication.