Agent-Based Models — From Ants to Financial Markets

Give 5,000 virtual birds three simple rules and a flock emerges. Give 500 virtual traders a price signal and a market crash emerges. Agent-based modelling is the science of complexity — how surprising collective behaviour arises from simple individual rules.

What is an Agent?

An agent is a computational entity with:

  1. A state — position, velocity, health, money, beliefs
  2. A set of rules — how it changes state based on what it senses
  3. A local perspective — it only know about its immediate neighbourhood

The key feature of agent-based models is that there is no central controller. No agent knows the global state. Patterns emerge purely from local interactions repeated thousands of times per second.

Emergence: When a collection of simple agents produces patterns or behaviours that none of the individual agents intended or "knows about", we call this emergent behaviour. It's one of the most profound ideas in modern science.

Classic Examples

🐦 Boids (Flocking)
Each bird has 3 rules: avoid crowding neighbours (separation), steer toward average heading (alignment), steer toward average position (cohesion).
→ Emergent: convincing murmuration, lane splitting around obstacles
🐜 Ant Colony
Each ant deposits pheromone on its path and follows higher pheromone concentrations. Pheromone evaporates over time.
→ Emergent: shortest-path finding without any ant knowing the map
🦠 Disease Spread
Each person can be Susceptible, Infected, or Recovered. Infection spreads by proximity. Recovery happens after a fixed period.
→ Emergent: epidemic waves, herd immunity threshold, super-spreader events
🏙️ City Growth
Each land cell prefers to become the same type as its neighbours, with some random new development. Industrial areas repel residential.
→ Emergent: zoning boundaries, sprawl, urban renewal patterns
🐟 Fish Schooling
Same as Boids but with predator avoidance — schools split around threats and reform behind them.
→ Emergent: ball-of-prey defence formation, predator confusion effect
🏦 Bank Run
Each depositor withdraws if they observe enough other depositors withdrawing (social contagion). Banks fail if withdrawals exceed reserves.
→ Emergent: systemic collapse from a small initial shock

Why Agent-Based Models Are Used in Science

Many real systems are too complex for equations — there's no closed-form mathematical description of how a city grows or how a pandemic spreads through a heterogeneous population. Agent-based models are used when:

The Limitation: Validation

The power of ABMs is also their danger. With enough agents and enough rules, almost any macro-level pattern can be reproduced. A good ABM doesn't just reproduce the observed pattern — it should also fail to reproduce patterns that don't exist, and predict new ones before they're observed. This is harder than it looks.

Try the Simulations