Ecological Artificial Life - contents

Chapter 3. Design and Specification

3.1 Modelling

I investigated UML (Unified Modeling Language) as a way of specifying the structure of this application. However, it isn't very well suited to this, since it is mainly intended to specify use cases, where a (human) actor interacts with a system. In this simulation, the end-user interaction is quite a minimal part of the overall process, since the important part is the interaction amongst agents. UML may include better support when v2.0 is released, but that hasn't happened at the time of writing. For now, the only part of the language that I'm using is the class diagram, to display inheritance and associations:

Inheritance diagram

Associations diagram

There are some other languages which are specifically aimed at agent-based modelling: AUML ( and MAML ( However, these are both in an alpha pre-release state at the moment, so it didn't seem appropriate to use either of them yet. I will monitor their continuing development, since I think that they have potential for future use.

If this application was extended to include other species then some of these classes would probably need to be renamed, e.g. to distinguish between a queen bee and a queen ant. Alternately, they could be grouped together into separately libraries with a suitable prefix, so that Bees.Queen would be distinct from Ants.Queen. Given the current scope of the simulation, using simple names provides the most clarity.

3.2 Framework

One important decision was whether to use an existing framework or to develop my own. Here is a brief discussion of the options available:

3.2.1 Terrarium

This provided me with a useful starting point, but it isn't sophisticated enough for my purposes. For example, all creatures have to be either carnivores or herbivores. Bees get food from plants, but they don't actually eat the plants. The source code was going to be released earlier this year, and I was hoping that I could get some inspiration from that, but this hasn't happened yet. However, I did get some ideas from reading articles about the development process, particularly regarding the game loop.

3.2.2 Swarm

This seems to be related to the subject area, but it also requires development in objective C, so it wasn't suitable for my purposes.

3.2.3 AgentBuilder

This is intended for Java development, and the full version requires purchase.

3.2.4 Ascape

This looks promising, but I didn't come across it until quite late in my development process, by which time I'd already invested significant effort in developing my own framework. I also read a review (, which said: "For example, very large models composed of very simple agents running on a single computer, (such as Robert Axtell's trade network model, which has millions of simple agents trading on a single Macintosh CPU), may not always be suitable candidates." Given that there could be 40,000 bees in a hive, this may rule it out for my purposes.

More generally, there is a gamble involved in spending a lot of time learning a framework, only to then discover that it won't do everything I need. I think that the simulation I've developed could certainly be extended to include other species. There is also the pragmatic point that I am supposed to be demonstrating my own abilities with this project.

3.2.5 Half-Life

The graphics could certainly be improved by using Half-Life (or some similar game) as a front-end. However, that isn't the main goal of the project, and this is a proprietary solution which requires end users to spend extra money.

3.2.6 Mathematical models

The main alternative to agent-based modelling is to create a mathematical model. This will make predictions at a higher-level, e.g. to say that 20% of the bees will die at a given time, rather than dealing with individual bees. The simple reason for not using such a model here is that it doesn't fit the project description that I was assigned. More generally though, it would be interesting to compare the results from my simulation with the predictions from a mathematical model, since the agent-based model should be capable of greater accuracy (at the cost of increased complexity). is an example of a mathematical model.

3.2.7 Other simulations - this is an agent based modelling system that shows how bees select between nectar sources. This is an attempt to model Seeley's experiment with artificial food sources (rather than real plants). - this is a review of Vries' model, although I haven't been able to track down the original model or article. - an agent-based model that addresses swarming specifically.

Again, it would be interesting to compare my model against these others.

3.3 Parallel processing

Adding extra functionality to the model does of course affect the speed of execution. There are ways to compensate for this, such as developing a distributed application that would run across a network.

I investigated multi-threading (on a single processor), but this turned out to be impractical. The main problem there is synchronisation: you could wind up with a situation where 5 seconds has passed on one thread, but only 1 second on the other thread. It is well suited to tasks where you just want a certain amount of work to be done, but it isn't appropriate for cases where you need independent events to happen at the same time. It might be different with multiple processors (on the same PC), but I don't have access to such a machine at present (although my Intel CPU does support "hyper-threading", by pretending to be two physical chips). Having the processing shared across multiple machines would add extra overhead. All in all, this is a non-trivial problem.

However, the simulation is designed with parallel processing in mind as a future development. Bees are "owned" by either a hive or the dome, depending on their location. This is distinct from the concept of a bee's "home hive". The idea is that if a bee from hive 1 flies into hive 2, its ticks are handled by hive 2 rather than hive 1, but it still belongs to hive 1, and may be treated as an intruder by bees that belong to hive 2. In fact, this goes further, by delegating bee ticks down to comb level. In theory, this design allows for parallel processing, by having each hive running on a separate CPU.

Next: 4. Implementation

This page was last updated on 2004-09-05 by John C. Kirk

Valid XHTML 1.0! Valid CSS! Level Double-A conformance icon, W3C-WAI Web Content Accessibility Guidelines 1.0 Labelled with ICRA