Core ABM engine for rustsim.
This crate provides the foundational abstractions for agent-based modelling:
Agenttrait - the interface every agent type must implement.Modeltrait - the abstract model interface exposing time, RNG, space, and agents.StandardModel- discrete-time model with per-agent and per-model step functions.EventQueueModel- continuous-time model driven by a deterministic event queue.AgentStore- container trait withHashMapStoreandVecStoreimplementations.Scheduler- trait for controlling agent activation order each step.StepContext- safe, borrow-checked context passed to agent step functions.- Core semantic types - shared identifiers and interfaces for nodes, edges, zones, levels, and connectors.
SoaExtractable- trait for extracting agent data into GPU-friendly SoA buffers.
Architecture
The crate mirrors the design of Julia's Agents.jl:
- Define agent types implementing
Agent. - Choose a space (from
rustsim-spaces) and a scheduler. - Wire up step functions and build a
StandardModelorEventQueueModel. - Call
StandardModel::step/StandardModel::step_nto advance the simulation. - Use
collect_stepto gather data at each step.
Interior Mutability
Agent stores use RefCell-based interior mutability so that agent step functions
can read other agents while mutating the current one. This means the model types
are !Send and !Sync - see the top-level rustsim crate for compute-routing
alternatives.