Stigmergy
Stigmergy (pronounced “stig-MER-jee”) is coordination through the environment.
Instead of talking to each other directly, agents communicate by changing their environment. Other agents see those changes and respond.
Traditional vs Stigmergic Coordination
Traditional Coordination: Stigmergic Coordination:
Agent A ──message──► Agent B Agent A ──deposit──► Environment
│
Agent B ◄──perceive────────┘
Real-World Examples
| System | Mark Left | Who Responds |
|---|---|---|
| Ant trails | Pheromone chemicals | Other ants |
| Wikipedia | Edited articles | Future editors |
| Cities | Built buildings | Future developers |
| Markets | Price changes | Future traders |
| Stack Overflow | Answers/votes | Future developers |
How It Works in Our System
In Ants at Work, stigmergy operates on a graph:
- Nodes represent concepts, regions, or states
- Edges connect nodes with traversal costs
- Pheromone accumulates on edges that lead to success
┌──────────┐ pheromone: 15 ┌──────────┐
│ Node A │ ─────────────────────► │ Node B │
└──────────┘ └──────────┘
│
│ pheromone: 2
▼
┌──────────┐
│ Node C │
└──────────┘
Agents are more likely to traverse A→B (high pheromone) than A→C (low pheromone).
The Feedback Loop
1. Agent finds something valuable at destination
│
▼
2. Agent deposits pheromone on path taken
│
▼
3. Future agents sense higher pheromone
│
▼
4. Future agents more likely to take that path
│
▼
5. More value found → more pheromone → stronger trail
This creates positive feedback:
- Good paths get stronger
- Bad paths decay (pheromone evaporates over time)
- Optimal paths emerge without central planning
Why Stigmergy Works
1. No Central Coordinator
No single agent needs to know the big picture. Intelligence emerges from local interactions.
2. Adaptive
When conditions change, trails adjust. Old paths decay; new paths form.
3. Fault Tolerant
If agents fail, the system continues. The environment preserves knowledge.
4. Scalable
Adding more agents adds more exploration power. No coordination bottleneck.
Stigmergy vs Other Approaches
| Approach | Pros | Cons |
|---|---|---|
| Central coordinator | Optimal decisions | Single point of failure, bottleneck |
| Message passing | Direct communication | Complex protocols, overhead |
| Stigmergy | Emergent, fault-tolerant | Slower convergence, no guarantees |
The Pheromone Lifecycle
┌─────────────────────────────────────────────────────────────────┐
│ PHEROMONE LIFECYCLE │
├─────────────────────────────────────────────────────────────────┤
│ │
│ DEPOSIT ─────────► ACCUMULATION ─────────► EXPLOITATION │
│ │ │ │ │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ Agent finds Multiple Harvesters │
│ value and agents use follow the │
│ leaves mark the path "superhighway" │
│ │
│ │ │
│ ▼ │
│ DECAY │
│ │ │
│ ▼ │
│ Pheromone evaporates │
│ over time unless │
│ reinforced │
│ │
└─────────────────────────────────────────────────────────────────┘
Superhighways
When pheromone level exceeds a threshold (default: 20), an edge becomes a superhighway:
- Crystallized knowledge
- Near-optimal path
- Preserved even after mission ends
- Transferable to other missions
# In STAN algorithm
if edge.pheromone_level > 20:
edge.is_superhighway = True
# This path is now permanent colony knowledge
The Balance Problem
Too much exploitation = stuck in local optima Too much exploration = never converge
Our solution: castes with different pheromone sensitivities:
| Caste | Sensitivity | Behavior |
|---|---|---|
| Scout | 0.3 | Mostly ignores pheromone, explores freely |
| Harvester | 0.9 | Strongly follows pheromone, exploits known paths |
| Hybrid | Adaptive | Switches based on environment |
Key Insight
No agent is intelligent. The colony is.
The intelligence doesn’t exist in any individual ant. It exists in the pattern of pheromones across the environment—a form of collective memory that guides all future behavior.
This is emergence: complex behavior arising from simple rules.