That’s probably about the cheesiest title I’ve ever come up with, but it captures the spirit of the post well enough. Let me explain.
As I’ve mentioned in previous posts (namely, this one and this one), I’ve always been interested in simulated evolution. Unfortunately, the evolutionary models I’ve built have generally been extremely. Either A) They were designed to address only a single aspect of the evolutionary process; B) They were vastly scaled-down and simplified approximations of the real thing; or C) They were based on shaky evolutionary methods that didn’t produce anything extraordinary.
Well, recently, I’ve been thinking about the biosphere more than usual, and while I was browsing through the Wikipedia article on James Lovelock’s “Daisyworld” simulation (a proof-of concept simulation of the Gaia hypothesis), I got to thinking about the complex interactions between the component species of the ecosystem. I began to realize that each organism performs some function for the ecosystem at large (except humans…more on that in a later post), for example, the way bacteria help to decompose dead organic matter, and the way ticks act as vectors for certain viruses. Being the kind of guy who’s often unsure of the limits of his abilities, I thought I’d try to write a simulation that would capture this complex “Web of Life.”
And so, the E-cosystem was born (I can’t believe it! I said it again! What’s wrong with me?) In a little more than an hour’s worth of coding in NetLogo (of course it was NetLogo. As far as I’m concerned, that’s the only way to write multi-agent simulation code), I cobbled together a working simulation.
Here’s how it works:
At the beginning of the simulation, a random number of species (between 1 and 11) is generated. Associated with each species is the list of species that it preys upon (this can include its own kind), as well as a separate list giving attributes like movement speed and energy capacity.
Once these lists are compiled, the program generates a bunch of organisms (the number is random) from each species. And with that, the ecosystem (!) is ready to go.
During the simulation, the organisms have some very simple behavior: at every step, if there’s nobody around, they wander about randomly. If there’s somebody within two squares, they move towards it (at their native speed, of course). When they get there, if that somebody happens to be of a different species, and it happens to be one of the species on the first organism’s prey list, it tries to eat the other organism. But if that somebody happens to be of the same species, then (unless it’s a cannibal) tries to mate with it (if successful, it passes on a slightly-mutated version of its attributes).
That’s all there is to it, but even in this chopped-down form, the simulation displays some nontrivial behavior. I’ve always thought pictures were much clearer than words, so here are some screenshots from a sample run.
Here’s the population of randomly-generated organisms. The little white thing hovering over each of them (if you can see it) is their species number.
Immediately, the organisms begin to interact. As the population graph makes clear, reproduction begins immediately.
Eventually, weak species and degenerate species (that is, species that have weird relationships with other species, like cannibals or organisms that can’t eat anything) are trimmed away by natural selection, and a few highly-fit species begin to dominate.
After a fairly long run, the entire ecosystem has been reduced to two or three species, with, perhaps, a few residual survivors from other groups. There’s a lot less energy (in the form of prey) to be had, and in fact, this particular ecosystem is doomed.
Free energy has run out, and all the organisms have starved to death. All of the simulations I ran before this one either ended in this state, or in what I call a “biological singularity”: an exponentially-multiplying population of slow-moving fast-breeders that are totally unstoppable. It seems to me that either my simulated biology is a bit too simple (one of my major concerns is that the system doesn’t have any input of free energy (like the Sun provides on Earth), which means that ALL of the ecosystems are doomed to be limited by their starting energy); or else, I need to increase the number of species and the size of the world so that more complex stabilizing interdependencies can develop. Even with these bugs, the simulation is a lot more interesting and robust than I expected, and I’ll post any developments later on.
For now, though, I need to take a break from typing while I’ve still got cartilage in my fingers.