Module III·Article I·~3 min read

Agent-Based Modeling: From Cellular Automata to ABM

Agent-Based Modeling and Simulation

Turn this article into a podcast

Pick voices, format, length — AI generates the audio

Agent-based modeling is a computational approach to studying complex systems “from the bottom up”: we specify the behavioral rules for individual agents and observe emergent system behavior. This approach enables the study of systems for which equations are too complex or unknown.

Cellular Automata (CA)

Model: a grid of cells, each in one of a finite number of states. Discrete time. The next state of a cell is a function of its neighbors' states. Formally: $s_{t+1}(i,j) = f(s_t(N(i,j)))$, where $N(i,j)$ is the neighborhood of cell $(i,j)$.

Conway’s Game of Life (1970): 2 states (alive/dead), 8 neighbors (Moore neighborhood). Rules: a live cell with 2–3 neighbors survives; with <2 — dies (loneliness); with >3 — dies (overcrowding); a dead cell with 3 neighbors — comes to life. Simple rules → incredible diversity: gliders, oscillators, growth patterns, self-replicating structures (proven).

Wolfram’s Rule 30 and Rule 110: one-dimensional CA with 3 neighbors, 8 possible configurations → $2^8 = 256$ rules. Rule 110 is proven Turing-complete. Wolfram (“A New Kind of Science”, 2002): complex natural systems operate like CA.

Agent-Based Modeling (ABM)

ABM generalizes CA: agents are heterogeneous (different parameters and states), move in space, interact locally, can learn. ABM is a “virtual laboratory” for social, biological, and economic systems.

Schelling Model (1971) — Segregation from Moderate Preferences:

20×20 cell grid. Agents of two types (red and blue), about 40% of cells empty. Rule: an agent is satisfied if at least 30% of its neighbors are of the same color; otherwise, it moves to a random empty cell.

Result after simulation: despite very moderate preferences (30%), strong segregation arises — homogeneous clusters. “Moderate individual preferences create a strong collective pattern” — a classic example of emergence.

Mathematical analysis: if $p$ is the minimum desired percentage of “same”, then the segregation index reaches about $(1-2p)/2$ for $p \in [0, 0.5]$. For $p = 0.3$: index ≈ 0.35 (significant segregation).

Boids Flocking Models (Reynolds, 1987):

Agents (birds) follow three simple rules:

  1. Separation: avoid neighbors closer than $r_1$ (collision avoidance)
  2. Alignment: fly in the average direction of neighbors ($r_1 < r_2$)
  3. Cohesion: fly toward the center of mass of neighbors ($r_2 < r_3$)

Result: realistic flocks of birds, schools of fish, swarms of insects — no leader, no central control. Used in cinema (Batman Returns, 1992 — bats), video games.

SUGARSCAPE (Epstein-Axtell, 1996):

Agents search for “sugar” (resources) on a two-dimensional field with uneven distribution. Each agent: vision range (search distance), metabolism level. Results: wealth distribution → power law (Pareto), trade improves welfare, migration is self-organized, diseases evolve.

ABM Platforms

NetLogo (Northwestern University): standard academic ABM. Simple syntax, rich libraries, active community.

Mesa (Python): flexible, integrates with scientific Python (numpy, pandas, matplotlib). Best choice for researchers.

Repast (Java): industrial scale — modeling billions of agents. Used for city transport simulation, military simulations.

ABM Applications

Epidemiology: COVID-19 models by Ferguson et al. (Imperial College) — ABM of 66 million UK agents. Account for age, work, households, transport. Predicted effects of different scenarios. Influenced lockdown policy.

Financial markets: ABM of traders with different strategies reproduces “stylized facts”: heavy tails, volatility clustering, volume autocorrelation.

Transport: SUMO (Simulation of Urban MObility) — open ABM of urban transport. Used for traffic light optimization, autonomous vehicle assessment.

Numerical Example: Schelling on a 20×20 Grid

Initial state: random placement of 200 red and 200 blue agents, 400 empty cells. Segregation index = 0.12 (almost random). After 50 iterations: index = 0.68 (high segregation), though satisfaction threshold = 30%. Number of moves per iteration: 40 → 20 → 5 → 0 (convergence).

Assignment: Implement Schelling’s ABM in Python (numpy + matplotlib). (1) Run 10 simulations for each threshold $p \in {0.1, 0.2, 0.3, 0.4, 0.5}$. Plot the dependence of average segregation index on $p$. (2) Implement Boids: 100 agents, separation $r_1=2$, alignment $r_2=5$, cohesion $r_3=8$. Visualize the animation. (3) Implement SugarScape: 100 agents, 50×50 field, plot the “wealth” distribution after 500 steps. Does it follow the Pareto law?

§ Act · what next