Structure of a Swarm Simulation

The core of a Swarm simulation is the modeled world itself. In the simplest case, a model consists of one swarm inhabited by a group of agents and a schedule of activity for those agents. The agents themselves are implemented as objects. Agents are created by taking a class from the Swarm libraries, specializing it for the particular modeling domain, and then instantiating it, one object per agent. For example, an agent that is a neural network could start by taking a general purpose neural network class from the neuro library, adding extra methods needed for the specific type of network, and then creating an instance of it to be the actual neural network.

In modeling it is common (but not universal) to speak of agents as living in an environment. Many simulation platforms fix the environment as a particular type; two dimensional grids are common. A distinguishing feature of Swarm is that there is no design requirement for a particular kind of environment. For instance, a coyote/rabbit model might have the rabbits living in the environment of a garden. In Swarm, this environment is itself just another agent. The garden is simply an instance of a user-defined garden agent, perhaps based on a cellular automata to simulate growth of carrots. The garden agent might have a special status in the model, but in the underlying software it is treated no differently than any other agent. In the general case, the environment for the agents is the agents themselves: some agents might have a larger influence than others, but in Swarm they are considered fundamentally equivalent.

Once a user has defined the agents and established their relationships, the last step in building the model itself is to put the agents together into a swarm. The user writes a schedule of activity for the agents, defining how time is simulated in the system by creating a set of actions in a specified ordering. Schedules are built by creating instances of data structures from the activity library, filling them in with ordered object/message pairs. Once the schedule is completed the model swarm is ready to be executed.

A model running by itself is not very interesting: data collection tools are needed to observe the model and record what is happening. In Swarm measurement happens by the actions of observer agents, special objects whose purpose it is to observe other objects via the probe interface (Figure 4). For example, one observer agent might be watching the number of rabbits and producing a time series graph of population dynamics. Another observer agent could track the spatial distribution of the coyotes, storing data to a file for later analysis.

  figure54
Figure 4: A Swarm of Observer Agents Measuring a Model

The observer agents themselves are a swarm, a group of agents and a schedule of activity. By combining this swarm with a model swarm running as a subswarm of the observer, a full experimental apparatus is created. By using hierarchical swarms to separate data collection from the model, the model itself remains pure and self-contained, a simulated world under glass. Different observer swarms can be used to implement different data collection and experimental control protocols, but the model itself remains unchanged.


next up previous
Next: Swarm Libraries Up: The Swarm Simulation System: Previous: Object Oriented Technology

Formatted: Wed Jun 11 18:08:29 EDT 1997
Nelson Minar