Expand description
Agent containers - storage backends for the agent population.
Two implementations are provided:
-
HashMapStore- backed byhashbrown::HashMap. General-purpose; supports arbitrary agent addition and removal. Best when agents are frequently created or destroyed. -
VecStore- backed by aVec<Option<RefCell<A>>>indexed by agent ID. Faster iteration for dense, contiguous ID ranges. Best when agents are never (or rarely) removed.
Both stores use RefCell for interior mutability, allowing agent step
functions to borrow one agent mutably while reading others immutably.
§Determinism note
Store iteration order is part of simulation reproducibility whenever a
scheduler or caller relies on iter_ids() / iter_ids_into() without an
additional ordering step.
VecStoreiterates in ascending ID order.HashMapStoreiteration order is not guaranteed and must not be treated as a reproducible activation order.
For deterministic activation order across runs, prefer crate::scheduler::ById
or another scheduler that imposes an explicit order.
Structs§
- Hash
MapStore - Hash-map-based agent store.
- VecStore
- Dense vector-based agent store.
Traits§
- Agent
Store - Trait for agent containers.