Modeling With Agents: Creating Agents [Systems thinking & modelling series]
This is part 66 of a series of articles featuring the book Beyond Connecting the Dots, Modeling for Meaningful Results.
Now that we have learned about state transition diagrams, we are ready to start creating agents. There are three key elements:
- Defining what an agent is
- Creating a group of agents
- Viewing agent results
Defining Agents
We have already introduced the folder primitive as a tool for grouping primitives together and as a tool for unfolding a model. The folder primitive plays an additional role in Agent Based Modeling, as we use folders to define what our agent consists of.
To create an agent, construct the state transition diagram for your agent (and also add any stocks, flows, or any other primitives you want to this agent). Then create a folder containing all these primitives. Give the folder the name of your agent such as “Person” or “Individual” or even just “Agent”. This is all similar to what we have done with folders before, but now there is one extra step. Edit the folder configuration and set the folder to “Agent”. You have now created the definition of your first agent!
You can have as many different types of agents in your model as you would like. Just create a new agent model and use a new folder to define each of the different types of agents. For instance, in a predator-prey model you could have one agent definition describing the behavior of the prey, and a second agent definition describing the behavior of the predators.
Creating a Population of Agents
After you have defined an agent in your model, you are ready to create a collection or population of agents. This is done by adding an Agent Population primitive to your model. The agent population primitive uses the definition of an agent from an agent folder to create many copies of that agent from the definition. The agent population primitive keeps track of these copies and allows them to operate and to interact with one another.
There are a number of different settings for the agent population primitive, but two are of key importance. The first is to select the type of agent that will be in the population. Each population primitive can only have one type of agent. You can have multiple populations, though, and the agents in one population can interact with the agents in another population.
After specifying the type of agent, you need to specify how many agents are in the population at the start of the simulation. This is done by setting the Size property for the agent population. Later you can add to or remove agents from a population by using the Add() and Remove() functions.
Viewing Agent Results
Many of the standard Insight Maker display types can be used to show the results of an agent based simulation. If you add an agent population to a time series or tabular display, the results for the number of agents in each of the various agent states will automatically be shown. You can also use the display type to illustrate agents within a geographic region.
The conversion of a state transition diagram into a model containing multiple agents can be found in Chapter 10 of Beyond Connecting the Dots.
Next edition: Modeling With Agents: Working With Agents.
Article sources: Beyond Connecting the Dots, Insight Maker. Reproduced by permission.