Graphs
Nectar delivered to the hive (cumulative)
Green: share of deposited pollen that landed on its own species. Blue: share of hops that stayed on one species. Grey line: the constancy you set
Marginal value theorem for this garden: overall gain rate R(t) of a bee that stays t seconds in a patch (orange); the best moment to leave is the peak (dashed); blue dot = what the simulated bees actually do
Pollen transfer network: where pollen from each species (rows) ends up (columns)
The science
Why this matters. About three quarters of the leading food crops and most wild flowering plants depend at least partly on animals that carry pollen. A flower is a small shop: it pays in nectar (sugar water) and sells pollen delivery. A forager is a small business: it wants the most nectar per second, but its pollen only helps the plant if it lands on a flower of the same species.
1. Foraging in patches: the marginal value theorem. Flowers sit in patches, and a patch gets poorer as the bee drinks from it. If a bee that stays t seconds collects g(t) microlitres and the trip to the next patch costs T seconds, its long-run gain rate is
R(t) = g(t) / (T + t)
The best residence time satisfies g'(t*) = g(t*) / (T + t*): leave when the instantaneous rate in the patch has fallen to the average rate of the whole environment (Charnov, 1976). A bee that searches the patch at random with no memory empties it exponentially, so the garden uses g(t) = G (1 - e-t/τ) with G the nectar in the patch and τ = (flowers per patch) x (time per flower). The simulated bees do not know this formula: each tracks a smoothed intake rate and leaves when it drops below the threshold times its own average rate for the trip. The slider multiplies that threshold (1 = the marginal value rule). The graph compares the theoretical optimum with what the simulated bees do; the dashed line is t*.
2. Flower constancy. Bees tend to keep visiting the species they just used. Here, the weight of a candidate flower at distance d is
w = e-d/λ · (1 if same species else 1 - c)
and the next flower is drawn with probability proportional to w. For nS same-species flowers at distance dS and nO others at dO the chance of staying is nSe-dS/λ / (nSe-dS/λ + nO(1 - c)e-dO/λ), which the page checks by sampling. Patch choice uses the same idea with the share of the preferred species in each patch.
3. Pollen on the move. A visit picks up a fraction of the anther stock and deposits a fraction D = 0.35 of every pollen type the bee carries; grooming removes about 1.2% per second and the hive removes 80% of a returning load. Grains from the right species raise the seed set; grains from other species are wasted and clog the stigma. With con and het the conspecific and heterospecific grains on a flower, the expected seeds are
seeds = 20 (1 - e-con/40) / (1 + het/120)
The matrix is the pollen transfer network between species. Strong constancy makes it nearly diagonal; no constancy fills it, and seed set drops because of clogging and dilution.
4. Weather. Honeybees are grounded below about 11 C and fly at full speed from about 17 C (a linear ramp); nectar secretion scales as 0.5 + T/30; wind reduces flight speed by 4.5% per m/s and sways the flowers.
Honest simplifications. (1) The garden is 20 m by 20 m and flowers hold small amounts of nectar so that the dynamics are visible in minutes, not hours. (2) Insects are drawn about fifteen times life size in 3D so that you can see them; a real honeybee is about 1.2 cm long. (3) Bees avoid recently visited flowers with a single detection probability instead of real scent-mark and memory processes. (4) Butterflies have no hive, half the nectar uptake, weak constancy and little pollen pick-up; other insects are not modelled. (5) Seed set is a saturating curve, not a measured dose-response. (6) The marginal value comparison uses an idealised patch whose parameters are measured from the current garden, so agreement is qualitative, not exact.
Checks run in the page. The theorem's optimum from bisection matches a brute-force scan of R(t); the sampled stay probability matches the closed form; nectar is conserved (initial + secreted - taken - remaining = 0); pollen is conserved (picked - deposited - groomed - removed by the hive - carried = 0); and the crop books balance.