Expand description
Social Force Model (Helbing & Molnár 1995; Helbing, Farkas & Vicsek 2000).
Each pedestrian experiences a sum of three forces:
- a driving force pulling it toward its destination at its desired speed,
- a repulsive social force from every other pedestrian,
- a repulsive force from every static obstacle (wall segment).
The resulting acceleration is integrated with semi-implicit
(symplectic) Euler: each tick first updates velocity from the
current acceleration, then advances position using the new
velocity (v ← v + a·dt; p ← p + v·dt). This is the classic
stability fix for stiff pair interactions — it preserves energy
far better than fully explicit Euler at identical dt and is
the same integration scheme used by JuPedSim and PedSim for the
Social Force family. Combined with the Params::max_accel cap
and the dt · max_accel ≤ max_speed CFL check in
Params::validate, this keeps the integrator stable at the
default 30 Hz timestep even under panic-flow parameterisation.
The speed is clipped to params.max_speed after the velocity
update, before the position advance.
This implementation follows Eq. 1–3 of Helbing, Farkas & Vicsek (2000), “Simulating dynamical features of escape panic”, Nature 407, 487–490, with the elliptical repulsion shape from Helbing & Molnár (1995).
§References
- Helbing, D., & Molnár, P. (1995). “Social force model for pedestrian dynamics”. Physical Review E, 51(5), 4282–4286.
- Helbing, D., Farkas, I., & Vicsek, T. (2000). “Simulating dynamical features of escape panic”. Nature, 407(6803), 487–490.
Structs§
- Params
- Parameters for the Social Force model.
- Social
Force - Unit marker type implementing
PedestrianModelfor Social Force.
Functions§
- cap_
accel - Clamp the magnitude of an acceleration vector to
cap. - driving_
force f_drive = m * (v0 * e_dest - v) / tau- neighbor_
cutoff - Recommended neighbour cutoff radius for grid queries (metres).
- ped_
repulsion - Pairwise repulsion
A * exp((r_ij - d_ij) / B) * e_ijalong the line connectingqtop, wherer_ij = p.radius + q.radius. - step
Deprecated - Free-function step for callers that do not need trait dispatch.
- step_
scratch - Zero-allocation step variant. Reuses
scratch.bufand rebuildsscratch.gridagainstpeds, then runs the same math asstep_with_gridwithout any per-tick allocation. - step_
with_ grid - Grid-accelerated step variant. Semantically equivalent to
stepup to numerical floating-point noise for interaction pairs insideneighbor_cutoff(params); pairs outside that radius are pruned because their contribution is below 1 mN at default parameters. - wall_
repulsion - Repulsion from the closest point on a wall segment.