FIG. 27

Evolving Flock

Python lab · Mesa + Optuna · Evolution
‹ All models

The boids rules inside a small ecology, from the Python ABM lab. Each bird spends energy to fly, refuels at food patches, leaves a fading pheromone trail and, with energy to spare, splits in two; the offspring inherit its steering weights with small mutations. Optuna tried parameter sets and kept the one whose flock stayed most aligned and stable while surviving and keeping its energy up. This is that setting, run once offline and played back; the browser Flocking sheet runs the classic three rules live.

Engine
Mesa 3.5 · Python
World
100 × 100 torus · 80 boids at start · 10 food patches
Key parameters
speed 2.72 · vision 10.55 · separation 1.16
Run
500 steps · seed 31800
Tuning
Optuna, 500 trials · winner #318
Score
0.9237 of 1 (alignment, stability, survival, energy)
Colours
glow = pheromone trail · green = food · line colour = heading
Alignment index (0–1) · 0.32–0.85 · one value per step, downsampled
Population and average energy over the run
Population and average energy over the run
Optuna score of every tuning trial
Optuna score of every tuning trial
Source · Python ABM lab (Mesa + Optuna) — python/abm-sim in this repo
NotesFIG. 27 · Sheet 28

Boids that eat, tire, leave pheromone trails and reproduce with mutated steering — a tuned Mesa model from the Python lab. A recorded run.

DrawingSimulation Lab — Sheet 28 / 30
DisciplineComplex Systems
MethodNumerical / Agent
Date2026.05.30