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.
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 ↓Try this: add a second food of a different type, then draw a wall across the busiest tube.
| Method | Network solves | J ÷ J* | Length / Steiner | Fault tolerance |
|---|
SMA restarts its schedule whenever you edit the map, keeping its population.
| Gen | Best | Mean | Reference fitness | Engulfed | Lost | Champion |
|---|
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.
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.
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.
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.
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.
Qₑ⁽ˢ⁾ = (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.
Q̃ₑ = √ Σₛ (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.
dD/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.
dcᵢ/dt = rᵢ − δcᵢ + Σⱼ κᵢⱼ(cⱼ − cᵢ), κ = (κ₀ + κ₁Q̃²)/LReleased 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).
wₖ = 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.
J(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.
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.
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.
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.
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.
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.
| Approach | What changes | Useful for |
|---|---|---|
| Slime Mould Algorithm (SMA) LOWER PANEL | A population of candidate positions, via fitness-ranked weights and shrinking oscillation | Continuous black-box optimization: it only sees J, not the flows behind it |
| Fruit fly COMPETITOR IN THE ARENA | Nothing: a fixed spiking connectome decides each bite | Fast all-or-nothing decisions; it does not build or optimise anything |
| Genetic algorithm on mold strategies ARENA | Six strategy genes for a moving mold, via selection, crossover and mutation | Finding growth strategies that win food races against flies |
| Physarum adaptation UPPER PANEL | One network's tube conductivities, via flow, appetite, signal and decay | Routing and adaptive transport networks that keep working while the map changes |
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.
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.
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.