Agent Based Modeling
How to read this page: This article maps the topic from beginner to expert across six levels � Remembering, Understanding, Applying, Analyzing, Evaluating, and Creating. Scan the headings to see the full scope, then read from wherever your knowledge starts to feel uncertain. Learn more about how BloomWiki works ?
Agent-Based Modeling (ABM) is a powerful computational technique for studying complex systems by simulating the actions and interactions of autonomous individuals (called Agents). It is a "Bottom-Up" way of doing science. Instead of using a single equation to predict how a whole population will act, we create thousands of "Digital People," give them simple rules, and watch what happens when they interact. ABM allows us to see how a small change in individual behavior can lead to massive "Emergent" shifts in a city, a market, or an ecosystem. It is the closest thing science has to a "Virtual Laboratory."
Remembering
- Agent-Based Modeling (ABM) — A simulation technique used to understand the behavior of a system by modeling its individual parts.
- Agent — An autonomous entity in a simulation that follows a set of rules (e.g., a Person, a Car, a Bird).
- Emergence — When a complex global behavior arises out of simple local rules (The "Magic" of ABM).
- Environment — The virtual space in which agents move and interact (e.g., a Grid, a Network, or a Map).
- Bounded Rationality — The idea that agents only have limited information and limited brainpower (unlike the "perfect" individuals in classical economics).
- Local Interaction — Agents only react to things immediately around them, not the whole system.
- Stochasticity — The use of "Randomness" in a model to represent the unpredictability of the real world.
- Monte Carlo Simulation — Running the same model thousands of times with different random seeds to see the average outcome.
- Validation — The process of ensuring that the model's output matches real-world data.
- Emergent Property — A macro-level pattern that was not explicitly programmed (e.g., a traffic jam).
- NetLogo — The most popular programming language and platform for building agent-based models.
- Sensitivity Analysis — Testing how much the final result changes when you slightly change one individual rule.
Understanding
ABM is understood through Rules and Aggregation.
1. The 'Three-Step' Loop: Every agent in every simulation follows a loop:
- Observe: What is happening around me? (e.g., "Is there a predator nearby?")
- Decide: Based on my rules, what should I do? (e.g., "If yes, run away.")
- Act: Change the state or position. (e.g., "Move to coordinate X,Y.")
2. Complexity from Simplicity: The power of ABM is that the rules can be very dumb, but the result is very smart.
- The Boids Model: To simulate a flock of birds, you don't need a "Leader." You just give every bird three rules: "Don't hit others," "Stay near the group," and "Fly in the same direction."
- Result: Perfectly realistic, "swarming" behavior.
3. Discovering 'Tipping Points': ABM is excellent for finding "The Point of No Return."
- If 10% of people wear masks, the virus spreads. If 15% wear them, nothing changes. But if 20% wear them, the virus suddenly dies out. ABM helps us find that "Magic Number" (the Phase Transition).
The Schelling Model of Segregation: This is the most famous ABM. Thomas Schelling showed that even if every person is "tolerant" (meaning they are happy as long as 30% of their neighbors are like them), the entire city will still end up 100% segregated. This proved that "Individual Intent" is not the same as "Group Outcome."
Applying
Modeling 'The Forest Fire' (A Cellular Automaton): <syntaxhighlight lang="python"> import random
def simulate_fire(grid_size, density):
"""
Agents: Trees. Rule: 'If neighbor is on fire, I catch fire.'
"""
# Create a grid of trees (1) or empty (0)
grid = [[1 if random.random() < density else 0 for _ in range(grid_size)]
for _ in range(grid_size)]
# Start a fire at the top row
fire = [(0, i) for i in range(grid_size) if grid[0][i] == 1]
burnt_count = len(fire)
# Simple 'Spread' logic
while fire:
x, y = fire.pop(0)
grid[x][y] = 2 # Burnt
# Check 4 neighbors
for dx, dy in [(0,1), (0,-1), (1,0), (-1,0)]:
nx, ny = x+dx, y+dy
if 0 <= nx < grid_size and 0 <= ny < grid_size:
if grid[nx][ny] == 1:
grid[nx][ny] = 2
fire.append((nx, ny))
burnt_count += 1
return burnt_count / (grid_size * grid_size)
- Low Density: 40% trees
print(f"Burnt area at 40%: {simulate_fire(20, 0.40) * 100:.1f}%")
- High Density: 70% trees
print(f"Burnt area at 70%: {simulate_fire(20, 0.70) * 100:.1f}%")
- Note: The fire doesn't just grow linearly; it 'explodes'
- once the density hits a critical point (~59%).
</syntaxhighlight>
- ABM Landmarks
- Conway's Game of Life → A 0-player game where 4 simple rules create infinite patterns, gliders, and even "computers" made of cells.
- Sugarscape → A simulation that proved how inequality and wealth gaps emerge naturally even when everyone starts with the same ability.
- Epidemiological Models (COVID) → Using ABM to simulate every individual in a city to see how "closing schools" vs "wearing masks" affects the hospitals.
- Financial Market Simulators → Trading bots competing against each other to see how "Flash Crashes" happen.
Analyzing
| Feature | Equation-Based (Physics/Calc) | Agent-Based (ABM) |
|---|---|---|
| Level | Top-Down (The whole group) | Bottom-Up (The individual) |
| Variation | Everyone is 'Average' | Everyone is 'Unique' |
| Interaction | Aggregate (Mean-Field) | Direct and Local |
| Strength | Very fast / Mathematically pure | Can find 'Surprising' emergence |
| Analogy | A 'Formula' | A 'Video Game' |
The Concept of "Verification vs. Validation":
- Verification: "Did I build the model right?" (Is the code bug-free?).
- Validation: "Did I build the right model?" (Does it actually look like a real city?).
Analyzing the "Truthfulness" of a simulation is the most difficult part of ABM.
Evaluating
Evaluating an ABM: (1) Stochasticity: If you run the model 10 times, do you get 10 completely different answers (too much randomness)? (2) Rule Simplicity: Are the rules based on real psychology or just "guesses"? (3) Scaling: Does the model still work when you go from 100 agents to 1,000,000? (4) Equifinality: Is there more than one way the model could have produced the result?
Creating
Future Frontiers: (1) Digital Twins: Creating a perfect ABM of a real-world city (like Singapore) to test every new law or bridge before it is built. (2) Social Media Simulation: Using 100 million "Bot Agents" to see how fake news spreads and how to stop it. (3) AI-Agents: Replacing simple "If/Then" rules with "Large Language Models" so the agents can actually "talk" and "reason" with each other. (4) Multi-Scale ABM: Modeling a whole country by linking models of cells, people, and weather into one giant system.