IdleTheory

The IdleSpider Simulation

ivy spiders Silken Fetters

Once I spent a spring morning sitting watching spiders. There were dozens of them, less than half the size of a fingernail, each of which had built a web the size of a playing card strung between ivy leaves. The webs had no obvious structure, and appeared to be randomly interwoven mattresses of silk. The spiders lurked under nearby leaves. Flies and midges darted in the air above. All seemed set for action.

But nothing happened. Occasionally a midge would get snagged in a web, but would soon escape, without the web owner taking any action. And on the one occasion that a midge really did get caught, the owner spider rushed out, and, bouncing trampoline-like on the web on the opposite face from the snared midge, succeeded in dislodging it - almost as if it was trying to get rid of a nuisance.

The spiders spent most of their time doing nothing, sitting under their leaves. Their webs ranged from spanking new glossy mattresses, to threadbare ruins. It was clear that, if there had been any fly-catching that day, it was over, and the spiders were on holiday. These were, it seemed, very idle spiders.

In Richard Dawkins' Climbing Mount Improbable, there is a chapter - Silken Fetters - on the spiderweb simulation NetSpinner model. In Netspinner, spiders build orb webs, which cost them some amount of silk, and which catch some number of flies. The 'best' spiders are those that 'catch the most flies minus a cost function computed from the length of silk'. A fixed proportion of the spiders with the best webs go on to the next generation, where they reproduce and vary.

The IdleSpider simulation model came out of reading Dawkins, and remembering those spiders in the ivy. As I read Dawkins, it seemed to me that subtracting the cost of the silk from the number of spiders could mean subtracting numbers with different dimensions, like subtracting length from weight. Why, I wondered, hadn't Dawkins regarded flies as having an energy value - like food in supermarkets has its energy value in KJoules or Calories printed on it -, and treated web construction as energy-consuming work. But, the word 'energy' in this physical sense hardly appears in any of Dawkins' books.

Also, building a web and catching flies are processes that take time. Building a web means expending energy at some rate, Pe. And as flies are caught in the web, they bring an energy income, Pi. So the best spiders become those with the best Pi - Pe.

But if the basal (resting) metabolism of the spiders, Pm is also included, then spider idleness I is given by:

I = 1 - ( Pm / ( Pi - Pe ) ) (1)

If flies are plentiful, webs cheap, and metabolism low, spiders will be very idle. They'll just occasionally build a crude web, catch a few flies, and then revert to torpid inactivity - like the ivy spiders. But if flies are few and far between, webs expensive, and spider metabolism high, then spiders will be nearly continuously working. So busy, in fact, that even working continuously weaving a web and catching flies, they still won't get enough energy to keep themselves alive.

So instead of simply selecting the 'best' spiders of each generation, the IdleSpider simulation would simulate in 'real time' spiders making webs and catching flies, and selection pressure would be increased by reducing the size of flies, or the rate at which they passed through the web. As selection pressure increased, the spiders that built the least effective webs would die, and be replaced by variants of the survivors. No need to arbitrarily declare that a fixed proportion of spiders survived each generation.

NetSpinner's spiders also build orb webs. This made it seem realistic. But my ivy spiders built tangled mattresses of silk, without any obvious structure. Why not just have the spiders weave strands of silk from random perimeter points across a square field? Or have them obey a simple rule, like walk some fixed distance round the perimeter of the square, and draw silk from start point to end point? Maybe a simple ladder web wouldn't be too hard either? Much easier, it seemed, than constructing a complicated computer algorithm to generate a sophisticated orb web.

Then, with 9 spiders building 9 webs, set them to work. Each spider would have a threshold stored energy level below which, hungry, it would start building a web. Flies would come randomly though the web, and if any fly touched the silk, it would be caught and eaten. As flies were consumed, stored energy levels would rise, until the threshold was reached, at which point the spiders would stop making webs (but continue to catch any flies that got snared). And the silken strands in the webs would have a limited lifetime, so that, if not kept in repair, webs would gradually become threadbare, like some of the ivy spiderwebs.

The Java simulation applet starts off with the 9 webs shown in a 3 x 3 grid, with the random webs on the top row, the perimeter-walk webs on the second row, and the ladder webs at the bottom. Information on the light-blue highlighted web is given at the bottom, along with a moving graph display of the spider's energy level (red), and the start-building-web threshold (blue). In the example shown left, energy level has dipped below the threshold, and then risen back above it. A black background of the graph shows when the spider is busy (weaving a web or eating flies), and a white background shows it idle. At the top is a button the starts and stops the simulation, and a menu of options (like increase or decrease fly size).

When the simulation runs, the applet 'observes' how idle the spiders are, simply by totalling up the time they're inactive. But it also calculates the 'theoretical' idleness using equation 1. The two values agree, at least whenever the energy store returns to its start level.

The IdleSpider applet, if the ReduceFlySize option is selected, gradually reduces the size of the flies. As flies get smaller, the spiders have to work longer, until they're working continuously, and their energy stores are dwindling away. Since newborn spiders arrive with a full energy store, they are likely to outlast older spiders who are near dead. In order to even things up, the applet periodically increases fly size, so that all the spiders can take a breather and refill their depleted energy store. So the applet lowers, and then raises fly size, cyclically. If fly size is clamped at some arbitrarily low level at which no spider can survive ( >68 in the current model ) the result is that those spiders that are slowest to die manage (somehow) to leave descendants - and the spiders that are slowest to die are the ones which don't waste energy making webs at all!

Initially, with relatively big fat energy-rich flies getting caught, all the spiders live relatively idle lives. Even the random web builders flourish. They make webs, catch flies, and then leave their webs to disintegrate. But as the flies get smaller, they have to work longer. One by one they begin dying. Whenever a spider dies, the webs all shift up leaving a space at bottom right for a new spider. A slight variant of one of the existing spiders is chosen to take over the new space. The new spider walks a bit further, or not quite as far, round the perimeter than its parent. Otherwise, all the spiders are the same.

As the flies gradually get smaller, the random web builders do better than the ladder web builders, but neither do as well as the perimeter web builders. And the best of the perimeter webs is the one which leaves a fairly small hole in the centre. At left is the simulation after some 67 spiders have died and been replaced. All the original spiders are dead. The survivors are all perimeter spiders with a similar sized hole in the centre of their web.

The perimeter web builders are interesting. While a moderate sized hole in the centre seems to get the best results, the important thing is that they build webs which don't retrace their steps. If the spider walks halfway round the perimeter to make the two ends of a strand, it will end up going backwards and forwards along the same line. If it goes exactly a third of the way round the perimeter, it will produce a triangular web consisting of 3 strands, and so on. The 'fitness' of perimeter spiders isn't a smooth curve that peaks gradually at one point, but a series of hills with deep valleys between where the length walked produces a triangle, a square, a pentangle, and other regular shapes.

Reproduction really should be included as (another) energy expenditure, but isn't. Instead it's assumed that all the spiders are reproducing, and that there's always at least one of each available to fill an empty space in the webfield. Also, spiders aren't given 'natural' lifetimes after which they die. They only die when they run out of energy.

The IdleSpider simulation doesn't always produce the same result. If the first perimeter spiders are inefficient, and die out quickly, it's usually the random web builders that predominate. Also, since the webs are being bombarded randomly with flies, it's possible that from time to time even the best web catches comparatively few of them, and its builder dies through sheer bad luck.

The IdleSpider applet is just a doodle, which came out of my memory of watching the indolent ivy spiders, and reading Climbing Mount Improbable.

Idle Theory

Author: Chris Davis
Last edited: 11 Jan 1999