The fundamental component that organizes the agents of a Swarm model is an object called a ``swarm.'' A swarm is a collection of agents with a schedule of events over those agents. For example, a swarm could be a collection of 15 coyotes, 50 rabbits, a garden with carrots, and a simple schedule: the rabbits eating the carrots and hiding and the coyotes eating the rabbits (Figure 1). The swarm represents an entire model: it contains the agents as well as the representation of time.
Figure 1: A Swarm of Rabbits and Coyotes
In addition to being containers for agents, swarms can themselves be agents. A typical agent is modeled as a set of rules, responses to stimuli. But an agent can also itself be a swarm: a collection of objects and a schedule of actions. In this case, the agent's behavior is defined by the emergent phenomena of the agents inside its swarm. Hierarchical models can be built by nesting multiple swarms. For example, one could build a model of a pond inhabited by single celled animals. At the highest level, a swarm is created that contains agents: the swarm represents the pond, and each agent represents one animal. The behavior of cells could be defined simply as some algorithm, but a cell is itself a collection of organelles: a nucleus, mitochondria, endoplasmic reticulum. Another way to represent a cell is as a swarm of agents, the organelles. Two models are being combined: the pond as a swarm of cells and the cell as a swarm of organelles.
Figure 2: Hierarchical Swarms: Rabbits, Rabbit Parts, Individual Cells
The ability to build models at various levels can be very powerful. Swarm allows users to explicitly build and test multi-level models. A swarm can explicitly represent an emergent structure, a group of agents behaving cohesively as a single agent. Because swarms can be created and destroyed as the simulation executes, Swarm can be used to model systems where multiple levels of description dynamically emerge.
Another use of multiple swarms is to support the modeling of agents that themselves build models of their world. As noted in Hogeweg's MIRROR system [4], in some simulations, especially those where the agents have a cognitive component, an important factor in the system dynamics is an agent's own beliefs about its world. In Swarm, agents can themselves own swarms, models that an agent builds for itself to understand its own world. For example, in an economic simulation of a swarm of companies the researcher might be interested in the theory each company has of its competitors' actions. To model this in the Swarm system, the model builder would give each company-agent its own swarm: these private swarms implement each company's model of the world.
Figure 3: Coyote with a Model for Hunting
The formalism of the swarm is a natural way of encapsulating a simulation: a swarm simply represents a group of agents and their schedule of activity. The modularity and composability of swarms allows for a flexible modeling system. Swarms can be nested to directly represent multi-level simulations, and they can be used by the agents themselves as models of their own world.