We'll now look at a few summaries of the simulation in action. The operation of the simulation will also be discussed including the available command-line options that are available.
The simulation can be run by simply executing the application with no options, such as:
./sim
This will run the simulation given the parameters defined in the header file common.h . The defaults within common.h include 36 agents (18 herbivores and 18 carnivores) and 35 plants within a 30x30 grid. The maximum number of simulation steps is set to 1 million. Figure 7.10 shows the maximum age reached for each of the two species.
It's interesting to note the trend of increasing age in the agents. When the carnivore species finds an interesting strategy that increases its longevity, shortly thereafter, herbivores find another strategy that gives them the ability to live a little longer. In some ways, the species compete with one another. When a species evolves an interesting strategy, the other species must evolve to counteract this new strategy.
Once a run is complete, the two best agents of the species are saved off into a file called agents.dat . These agents can then be pitted against one another in a simulation called playback. This mode doesn't seed the population with random members, but instead starts with the best members from the last run. This can be performed using the following command:
./sim -prn
The 'p' argument defines that we want to run in playback mode. The 'r' specifies that we wish to save off the run-time trend information, and 'n' defines that no reproduction is permitted. The trend data stored in playback mode includes agent birth and death counts (for both species).
Using agents evolved in the prior run, Figure 7.11 shows a plot of the runtime trend data that was created.
As we've defined that no reproduction may occur, this simulation shows no births occurring, only deaths. When the playback simulation has begun, the landscape is initialized with herbivores and carnivores. It's clear from the plot that the carnivores have a field day with the abundance of herbivores that are available to consume . Once this winds down, carnivore deaths begin a steep increase as the landscape has been stripped of prey and starvation sets in. With the loss of food for the carnivores, their demise is certain.
The simulation provides a number of options. These are shown in Table 7.1.
Option | Description |
---|---|
| |
-h | Command-line help |
-p | Playback mode (read agents.dat) |
-r | Save run-time trend data (runtime.dat) |
-g | Don't regrow plants |
-c | Convert carnivores to plants when they die |
-n | No reproduction is permitted |
-s | Manual step ( carriage -return required) |
One interesting scenario is provided by the following parameters:
./sim -prncg
This provides a circular food web in which carnivores hunt and eat herbivores, but conversely, once carnivores die, they become food available to herbivores.