◉ PHYSARUM LABAN EXPERIMENT IN ADAPTIVE NETWORKS AND REAL FLY BRAINSHow it works ↗
BIOLOGY → COMPUTATION / EXPERIMENT 003

No blueprint.
Just feedback.

How does a slime mold decide where to invest? Place foods with different nutrients, draw walls, shine light on shortcuts. Watch tubes grow and fade as appetite, chemical signals and flow pull the network together.

Then watch a living, moving mold race fruit flies for food in an arena. Each fly is steered by a spiking model of the real fly brain wiring. The mold defends its food by engulfing it, and evolves, generation by generation, to do it better.

Then see how the Slime Mould Algorithm, a population-based optimizer, does on the exact same problem.

Explore the idea ↓
LIVE TRANSPORT NETWORKSTEP 0000
CLICK A NODE TO ADD OR REMOVE FOOD
Mold Protein Carbohydrate Mineral Tube Signal Wall Light
ENERGY / OPTIMUM—J ÷ J*, closer to 1 is better
LENGTH / STEINER—Active tubes vs tree estimate
FAULT TOLERANCE—Single cuts survived
FOODS REACHED—Connected to the mold
PROTEIN STORE
CARBOHYDRATE STORE
MINERAL STORE

Try this: add a second food of a different type, then draw a wall across the busiest tube.

SLIME MOULD ALGORITHM · SAME MAP, SAME OBJECTIVEGEN 0000
SMA BEST CANDIDATE (ONE TUBE = ONE DIMENSION)
Energy gap vs network solves since the last map edit
Physarum SMA best
Show as a table
MethodNetwork solvesJ ÷ J*Length / SteinerFault tolerance
SMA ENERGY / OPTIMUM—Same J as Physarum
LENGTH / STEINER—Active tubes vs tree estimate
FAULT TOLERANCE—Single cuts survived
NETWORK SOLVES—Population × generations

SMA restarts its schedule whenever you edit the map, keeping its population.

ARENA · LIVING MOLD VS FRUIT FLIES · EVOLUTIONGEN 001 · REFERENCE
LOADING THE FLY CONNECTOME…
Mold body Tube Protein Carbohydrate Mineral Engulfed Fly Wall
GENERATION1Round 0 of 9
BEST ADVANTAGE, LAST GEN—Fitness above the reference mold
FOODS ENGULFED0By evolved molds, all rounds
FOODS LOST TO FLIES0Flies ate half before the mold arrived
Advantage over the reference mold, per generation (each generation plays a new maze)
Best genome Population mean
Show as a table
GenBestMeanReference fitnessEngulfedLostChampion
BEST STRATEGY SO FARWaiting for the first generation

Each generation gets a new random maze. The reference mold plays it first, then every genome, then the best breed. The arena pauses while scrolled out of view.

THE IDEA

A different kind of search.

A genetic algorithm or SMA evolves a population of candidate solutions. A Physarum network adapts one living network: flow, appetite and chemical signals act as feedback about where to invest.

01 / SENSE

Know what it lacks.

The mold keeps internal stores of protein, carbohydrate and minerals and burns them steadily. Foods that supply what is missing become more attractive, so demand shifts as stores fill.

02 / SIGNAL

Food sends a message.

Food triggers the release of a softening agent. Flow disperses it through the tubes. Where it arrives, tubes dilate more easily, so routes near rewarding food grow faster.

03 / ADAPT

Invest in what flows.

Every pair of food sites and mold bodies exchanges flow. Tubes that carry flow thicken, idle ones decay, walls cut tubes and light makes tubes costly. The network that remains balances cost, efficiency and resilience.

FLOW THROUGH A TUBE, PER SCENARIO sQₑ⁽ˢ⁾ = (Dₑ / L*ₑ) · (pᵢ − pⱼ), L* = L · (1 + 4·light)

D is conductivity, L* the light-weighted length, p pressure. Each scenario sends current Iₛ between a mold and a food (Iₛ = appetite), two molds, or two foods. Kirchhoff's law is solved for all pressures.

WHAT EACH TUBE FEELSQ̃ₑ = √ Σₛ (Iₛ · Qₑ⁽ˢ⁾)²

The root-mean-square flow over all scenarios. It is the time average of Tero et al.'s (2010) random switching between food sources, and gives food-to-food links, not just a single path.

ADAPTATIONdD/dt = Q̃^γ · (1 + α·c̄) − μ·D + ε

γ > 1 makes strong tubes win (sparse trees), γ < 1 keeps redundant loops. c̄ is the signal concentration at the tube's ends. ε is an exploration floor. Time step Δt = 0.08.

SOFTENING SIGNALdcᵢ/dt = rᵢ − δcᵢ + Σⱼ κᵢⱼ(cⱼ − cᵢ), κ = (κ₀ + κ₁Q̃²)/L

Released at food in proportion to appetite (r), decaying at δ = 0.6. Dispersion grows with flow², as in Taylor dispersion along an oscillating tube (Alim et al. 2017).

APPETITEwₖ = 0.1 + 0.9 · Σₙ mixₖₙ · max(0, 1 − storeₙ / targetₙ)

Targets are protein 1 : carbohydrate 0.5 (the 2:1 ratio Physarum defends in Dussutour et al. 2010) and minerals 0.2. Intake grows with the effective conductance between mold and food, so building a good tube pays off.

SHARED OBJECTIVEJ(D) = Σₛ Iₛ² · R_eff,ₛ + μ² · Σₑ Dₑ L*ₑ

Pumping cost plus building cost. It is convex, so the reference optimum J* is found by running the fixed-point iteration D ← (D + Q̃/μ)/2 to convergence. With γ = 1, α = 0 and ε = 0, Physarum's steady state D = Q̃/μ is exactly J's minimum. The biology layers trade some J for other goals.

SLIME MOULD ALGORITHM (Li et al. 2020)Xᵢ ← X_best + v_b·(W·X_A − X_B) if r < p = tanh|S(i) − S_best|, else Xᵢ ← v_c·Xᵢ

Each candidate is a vector of log₁₀ conductivities, one per tube (249 dimensions), in [−4, 0.5]. Fitness is the same J. W weights by fitness rank ("smell"), v_b ∈ [−a, a] with a = artanh(1 − t/T), v_c shrinks linearly to 0, and 3% of candidates restart at random each generation.

THE ARENA

A mold that moves, grows and defends.

In the arena the mold is a body of biomass m on the graph, not a fixed point. Each step, biomass flows down the potential ψ = −χ·ln(smell) + s·(m/0.5)². It climbs a smell field diffused from the food and is pushed outward when crowded. It travels slowly by crawling and much faster through its own tubes, which carry flow between the body's core and the food it touches, exactly as in the network lab. Only a thick edge of the body can advance into new ground, so the body stays in one piece.

Where the body touches food it eats, and food it is hungry for builds more body. Idle biomass is reabsorbed, faster when the mold is starving. A food is engulfed when the mold covers it (m ≥ 0.3) and every open neighbouring node (m ≥ 0.12). Flies cannot land on engulfed food, and a feeding fly is pushed off. Flies fly over walls; the mold must find a way round them.

THE GENETIC ALGORITHM
  • Genes: chemotaxis χ, spread s, tube decay, route selectivity γ, retraction, and sugar guard. Sugar guard is extra pull toward carbohydrate food, the only food the flies eat.
  • Fitness: food eaten by the mold − food eaten by flies + 0.25 per food engulfed − 0.25 per food lost. A food is lost when flies eat half of it before the mold engulfs it.
  • Each generation: a new random maze of five foods and two walls. The reference mold (every gene at mid-range) plays it first, then every genome. The chart shows advantage over the reference, so easy and hard mazes stay comparable.
  • Breeding: the top 2 survive unchanged. The rest come from tournaments of two, uniform crossover, and a 25% chance per gene of a mutation of about 15% of its range.
  • Fly brains: they run in simulated time, 10 ms of brain per step, so a round plays out the same at any watch speed.

Hand-built and not calibrated to real growth rates: the body and smell model, the engulf rule and the fitness. Arena flies are hungrier than the lab's (bites of 0.06, 6 bites before sated); their eat and escape decisions still come from the connectome.

THE COMPETITION

A real wiring diagram decides whether to eat.

Each fly runs its own copy of a leaky integrate-and-fire network: 2,234 neurons and 169,695 synapses, taken from the FlyWire map of an adult Drosophila brain with the model and constants of Shiu et al. 2024. The weights are the fly's own, not trained, and they do not change.

When a fly lands on food, the food's carbohydrate share drives the 20 sugar-taste neurons at up to 170 Hz for 300 ms. If the MN9 feeding motor neuron fires at least 8 times, the fly takes a bite. If a Giant Fiber escape neuron (DNp01) fires at least 20 times, it bolts instead. The looming detectors are driven by anything closing in, such as another fly crowding in.

WHAT FOLLOWS FROM THE WIRING
  • The feeding threshold is sharp. Measured over 20 trials per level, sugar drive 0.3 never fed and 0.4 fed 95% of the time. Carbohydrate-rich food (0.8) is eaten; protein (0.15) and mineral (0.1) foods are tasted and rejected.
  • So flies compete with the mold for carbohydrate only, and the mold can lose that food entirely.
  • Looming overrides sugar. Even a weak looming drive (0.3) silences feeding and triggers escape in every trial.

Hand-built, not from the connectome: flight, steering by blurry smell, memory of rejected food, satiety after 4 bites, and how sweetness maps to sugar-neuron drive. The fly brain code and data come from Sivolc2/obsidian-spren.

Which “slime mold algorithm”?

ApproachWhat changesUseful for
Slime Mould Algorithm (SMA) LOWER PANELA population of candidate positions, via fitness-ranked weights and shrinking oscillationContinuous black-box optimization: it only sees J, not the flows behind it
Fruit fly COMPETITOR IN THE ARENANothing: a fixed spiking connectome decides each biteFast all-or-nothing decisions; it does not build or optimise anything
Genetic algorithm on mold strategies ARENASix strategy genes for a moving mold, via selection, crossover and mutationFinding growth strategies that win food races against flies
Physarum adaptation UPPER PANELOne network's tube conductivities, via flow, appetite, signal and decayRouting and adaptive transport networks that keep working while the map changes

What to expect from the comparison

Physarum uses the physics: one network solve per step tells every tube how much it is used. SMA treats the same problem as a black box with 249 unknowns. It usually needs tens of thousands of solves to get close and leaves a dense mesh. That is not a flaw in this implementation: on a 20-dimensional test function it converges to 10⁻³.

SMA's v_c·X step pulls candidates toward the origin of the search space, a bias Kudela (2022) found in many recent metaheuristics. Here the origin means D = 1 on every tube, so the encoding matters. Raise γ or α and Physarum stops minimising J, so SMA can beat it on J while losing on resilience or diet.

What is and is not modelled

Modelled: multi-source flow, nutrient balancing, a flow-carried softening signal, light aversion, walls, food depletion. The mineral nutrient is a demo extension; the published diet experiments cover protein and carbohydrate. The signal molecule is real but unidentified, and its effect here is a simplified multiplier on growth.

In the arena, flies and mold interact only through food and engulfing. Not modelled: the rhythmic contractions (Ca²⁺/cAMP oscillations) that pump the cytoplasm, growth into unexplored space, extracellular slime as an external memory, and real tube geometry. The graph is fixed: 96 nodes and 249 tubes.

GO TO THE SOURCE Tero, Kobayashi & Nakagaki · A mathematical model for adaptive transport network (2007) ↗ Tero et al. · Rules for biologically inspired adaptive network design (Science, 2010) ↗ Alim, Andrew, Pringle & Brenner · Mechanism of signal propagation in Physarum polycephalum (PNAS, 2017) ↗ Dussutour, Latty, Beekman & Simpson · Amoeboid organism solves complex nutritional challenges (PNAS, 2010) ↗ Nakagaki et al. · Minimum-risk path finding by an adaptive amoebal network (PRL, 2007) ↗ Li et al. · Slime mould algorithm: a new method for stochastic optimization (2020) ↗ Kudela · A critical problem in benchmarking and analysis of evolutionary computation methods (2022) ↗ Ito et al. · Convergence properties of the Physarum solver ↗ Shiu et al. · A Drosophila computational brain model reveals sensorimotor processing (Nature, 2024) ↗ Dorkenwald et al. · Neuronal wiring diagram of an adult brain (Nature, 2024) ↗ Schlegel et al. · Whole-brain annotation and multi-connectome cell typing of Drosophila (Nature, 2024) ↗ Zheng et al. · A complete electron microscopy volume of the brain of adult Drosophila melanogaster (Cell, 2018) ↗ Sivolc2 · obsidian-spren, source of the fly brain engine (MIT) ↗

Fly brain data (fly_circuit.json): a 2,234-neuron sub-network of the FlyWire connectome (FAFB v783) via philshiu/Drosophila_brain_model, distilled in obsidian-spren by keeping the neurons that fire under sugar, looming and touch. Licensed CC BY-NC 4.0; used here unchanged and non-commercially. The page's code is MIT.