FIG. 29

Evolving Ecosystem

Python lab · plants, prey, predators · Ecology
‹ All models

A grid world of plants, herbivores and predators, from the Python ABM lab. Plants regrow on free cells, herbivores graze, predators hunt, every move costs energy, and creatures that store enough energy reproduce with mutated speed and vision, so those traits evolve under selection. Optuna searched for lasting coexistence: all three species survive, stay clear of extinction and keep bounded, balanced numbers. The browser Predator – Prey sheet shows the same cycle as two differential equations.

Engine
Mesa 3.5 · MultiGrid
World
50 × 50 torus · 300 plants, 80 herbivores, 50 predators at start
Key parameters
plant regrowth 0.026 · mutation rate 0.05 · reproduction at 22.3 energy
Run
1000 steps · seed 34600
Tuning
Optuna, 500 trials · winner #346
Score
0.7341 of 1 (coexistence, stability, balance)
Colours
green cells = plants · white = herbivores · orange = predators
Predators · 34–131 · one value per step, downsampled
Plants, herbivores and predators over the run
Plants, herbivores and predators 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. 29 · Sheet 30

Plants, herbivores and predators on a grid, with speed and vision evolving under selection — tuned for lasting coexistence. A recorded run.

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