Skip to main content

Crate rustsim

Crate rustsim 

Source
Expand description

rustsim - high-performance agent-based modelling engine.

This is the top-level orchestration crate that re-exports all sub-crates and adds:

  • compute - CUDA/CPU compute routing and SoA batch stepping.
  • control_plane - deterministic replay, checkpoint/restore, engine metrics, typed failures, and partition metadata.
  • device_store - persistent device-side SoA storage (FlameGPU2-style).
  • ensemble - parameter sweep and batch simulation runner.
  • layers - layer-based execution model for multi-function steps.
  • interaction - columnar spatial interaction/message indexes.
  • telemetry - end-to-end pipeline from data collection to ClickHouse.

§Quick start

See the full working example under examples/basic_particle.rs:

use rand::rngs::StdRng;
use rand::SeedableRng;
use rustsim::prelude::*;
use rustsim_spaces::nothing::NothingSpace;

#[derive(Debug, Clone)]
struct Particle { id: AgentId, x: f64 }
impl Agent for Particle { fn id(&self) -> AgentId { self.id } }

let mut store: HashMapStore<Particle> = HashMapStore::new();
store.insert(Particle { id: 1, x: 0.0 });

let rng = StdRng::seed_from_u64(42);
let mut model: StandardModel<NothingSpace, Particle, _, (), _, Fastest> =
    StandardModel::new(
        store,
        NothingSpace,
        Fastest::new(),
        (),
        rng,
        None::<Box<dyn FnMut(&mut Particle, &mut StepContext<NothingSpace, Particle, (), StdRng, Fastest>)>>,
        None,
        true,
    );
model.step_n(100);

§Crate architecture

CratePurpose
rustsim-coreABM engine: agents, models, stores, schedulers, stepping, messaging
rustsim-spacesSpace implementations: nothing, grid, continuous, graph, hybrid
rustsim-schedulersRe-exports scheduler types
rustsim-pathfindingGeneric A* and grid-specific pathfinding
rustsim-ioArrow batch building, ClickHouse writer
rustsim-geometry2-D and 3-D geometric primitives (vectors, AABB, rays, triangles, spheres)
rustsim-broadphaseSpatial neighbour queries: uniform grids in 2-D and 3-D
rustsim-modesShared mode semantics (TravelMode, AllowedModes)
rustsim-trafficMacroscopic traffic-flow semantics (link properties, FDs, signals, turns)
rustsim-crowdMicroscopic crowd locomotion (5 pedestrian models + layered 2.5-D)
rustsim-vehicleVehicle dynamics: IDM longitudinal, bicycle lateral, MOBIL lane-change
rustsim-transitTransit primitives: stops, routes, schedules, boarding queues, dwell times
rustsim-mobilityMulti-modal glue: trips, legs, mode-transition state machine, modal Dijkstra, shared obstacle trait
rustsim (this crate)Orchestration, compute routing, device storage, ensemble, telemetry

Re-exports§

pub use rustsim_broadphase;
pub use rustsim_core;
pub use rustsim_crowd;
pub use rustsim_geometry;
pub use rustsim_io;
pub use rustsim_mobility;
pub use rustsim_modes;
pub use rustsim_pathfinding;
pub use rustsim_schedulers;
pub use rustsim_spaces;
pub use rustsim_traffic;
pub use rustsim_transit;
pub use rustsim_vehicle;

Modules§

columnar_runtime
Authoritative columnar phase runtime.
compute
Compute backend detection and GPU-accelerated batch stepping.
control_plane
Production control plane for authoritative columnar simulations.
crowd_telemetry
Crowd → Arrow telemetry adapter.
device_store
Persistent device-side SoA storage for GPU-accelerated stepping.
ensemble
Ensemble runner for parameter sweeps and batch simulations.
interaction
Device-ready spatial interaction structures for columnar runtimes.
layers
Layer-based execution model inspired by FlameGPU2.
prelude
Convenience re-exports for common usage.
telemetry
End-to-end headless telemetry pipeline.