mesa-examples
mesa-examples copied to clipboard
add: Ratchet Effect model — remote work path dependency (closes #249)
Summary
Implements the Ratchet Effect example proposed by @EwoutH in issue #249, open since March 2025.
The model demonstrates how systems move easily in one direction (going remote) but strongly resist moving in the opposite direction (returning to office) once lock-in has accumulated — the defining property of a ratchet.
Model mechanics
WorkerAgentplaced on a 15×15OrthogonalMooreGrid(Mesa 4.xdiscrete_space)- Asymmetric dynamics:
adaptation_rate(going remote, fast) >> effective return rate (slow and decaying) - Lock-in multiplier:
p_return × (1 − lock_in)— return probability collapses as workers invest in remote arrangements (home office, habits, relocation) - External shock (optional, default step 30): simulates pandemic-like push; post-shock equilibrium is permanently elevated vs. baseline
- Social contagion: remote fraction among Moore neighbors drives peer influence
What the ratchet looks like in practice
| Scenario | Final remote % |
|---|---|
| No shock (baseline) | ~3% |
| After shock at step 30 + recovery period | ~20% |
| Ratchet gap | +17 percentage points |
Even after institutional pressure brings most workers back, 17% remain remote who would never have gone remote without the shock. The system cannot return to its pre-shock state.
Key parameters (all exposed as Solara sliders)
| Parameter | Default | Effect |
|---|---|---|
adaptation_rate |
0.025 | Lock-in gain per step remote — higher = stronger ratchet |
return_rate |
0.35 | Return asymmetry factor — lower = harder to return |
social_influence |
0.35 | Peer contagion weight |
shock_step |
30 | Set to 0 to disable shock entirely |
shock_duration |
8 | Length of shock period |
Visualization
- Grid: green squares = remote workers (size + shade = lock-in intensity), blue = office workers
- Top chart: Remote Workers % (green) + Return Resistance ×100 (red dashed) + shock period shading (orange)
- Bottom chart: Avg Lock-in accumulation over time
README
Uses the YAML frontmatter schema proposed in discussion #417 (single-file, machine-readable metadata).
Self-review checklist
- [x] Model runs for 100+ steps without error
- [x] DataCollector collects at every step and produces non-empty output
- [x] Solara app imports cleanly and all visualisation components render
- [x] Shock mechanism activates and deactivates correctly at configured steps
- [x] Model demonstrates the claimed phenomenon (ratchet gap measurable and consistent across seeds)
- [x] README includes frontmatter, abstract, model description, parameters table, how-to-run, and results discussion
- [x] Mesa 4.x APIs used throughout (
OrthogonalMooreGrid,FixedAgent,model.time,shuffle_do)
How to run
cd examples/ratchet_effect
pip install -r requirements.txt
solara run app.py
Closes #249
🤖 Generated with Claude Code