Add Active Walker trail formation example
Summary
This example implements an Active Walker model that simulates how informal pedestrian trails emerge in grassy open spaces. Agents move between predefined stops while gradually wearing down the grass. Worn areas become easier and more attractive to traverse, reinforcing frequently used routes.
Over time, stable paths form organically without explicit pathfinding. This model utilizes a continuous space and a custom property layer to track wear.
Motive
This example demonstrates agent–environment feedback dynamics in Mesa. It showcases how simple local movement rules combined with environmental modification can produce large-scale pattern formation. In parks, campuses, and urban green spaces, informal footpaths often appear before any pavement is installed. These “desire paths” emerge because people tend to prefer routes that are already partially worn.
This example models that feedback loop:
- Walking wears down grass
- Worn grass becomes easier to traverse
- Easier paths attract more walkers
- Repeated use strengthens certain routes
Implementation
-
ActiveModel
- Continuous 2D space
- Configurable agent population
- Staggered agent activation
- Origin–destination cycling
-
WalkerAgent
- Moves toward destinations
- Direction influenced by wear gradient
- Variable speed (normal distribution)
-
StepDeposit (PropertyLayer)
- Tracks grass wear intensity
- Diffusion-based spreading
- Exponential decay (recovery)
Each simulation step:
- Agents move according to combined destination and wear gradient
- Wear is deposited spatially
- The layer diffuses and decays over time
Usage Examples
- Initialize the model with configurable population size and wear parameters.
- Adjust
print_strength,vision, ortrail_dies_into observe different trail formation dynamics. - Modify the number and positions of stops by editing the parameters in
app.pyto explore different origin–destination layouts. - Observe how stable paths emerge between frequently visited stops.
References
-This model is inspired by the Active Walker model described by Helbing et al. (1997): https://arxiv.org/abs/cond-mat/9806097.
I’ve updated the implementation to use a NumPy array as suggested. I Initially chose property layers with potential continuous space support in mind, If there’s interest, extending property layers to continuous space could be explored separately in the future.
Hi @quaquel, just following up on this PR. I've implemented the suggested changes, let me know if there's anything else you need from my end to finalize this!