0% found this document useful (0 votes)
11 views

Agent-based Modeling and Simulation ABMS Examples

Uploaded by

pedro.mourao
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Agent-based Modeling and Simulation ABMS Examples

Uploaded by

pedro.mourao
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Proceedings of the 2008 Winter Simulation Conference

S. J. Mason, R. R. Hill, L. Mönch, O. Rose, T. Jefferson, J. W. Fowler eds.

AGENT-BASED MODELING AND SIMULATION: ABMS EXAMPLES

Charles M. Macal
Michael J. North

Center for Complex Adaptive Systems Simulation (CAS2)


Decision & Information Sciences Division
Argonne National Laboratory
Argonne, IL 60439, USA

ABSTRACT • Used: How ABMS is being used to solve practi-


cal problems.
Agent-based modeling and simulation (ABMS) is a new
approach to modeling systems comprised of autonomous, This tutorial is organized into two parts. The first
interacting agents. ABMS promises to have far-reaching part is a tutorial on how to think about ABMS. The back-
effects on the way that businesses use computers to sup- ground on ABMS and its motivating principles are de-
port decision-making and researchers use electronic labo- scribed to illustrate its main concepts and to indicate the
ratories to support their research. Some have gone so far state-of-the-art. The second part is a tutorial on how to do
as to contend that ABMS “is a third way of doing sci- ABMS. Practical applications of ABMS are described.
ence,” in addition to traditional deductive and inductive ABMS toolkits are introduced, and the development of a
reasoning (Axelrod 1997). Computational advances have simple agent-based model is illustrated.
made possible a growing number of agent-based models
across a variety of application domains. Applications 2 HOW TO THINK ABOUT ABMS
range from modeling agent behavior in the stock market,
supply chains, and consumer markets, to predicting the 2.1 What is an Agent
spread of epidemics, the threat of bio-warfare, and the
factors responsible for the fall of ancient civilizations. Although there is no universal agreement on the precise
This tutorial describes the theoretical and practical foun- definition of the term “agent,” definitions tend to agree on
dations of ABMS, identifies toolkits and methods for de- more points than they disagree. Some modelers consider
veloping agent models, and illustrates the development of any type of independent component (software, model, in-
a simple agent-based model. dividual, etc.) to be an agent (Bonabeau 2001). An inde-
pendent component’s behavior can range from simple, re-
1 INTRODUCTION active if-then decision rules, to general behavioral
models, such as the BDI (belief-desire-intent) framework,
Agent-based Modeling and Simulation (ABMS) is a new to complex models based on artificial intelligence (AI).
modeling paradigm and is one of the most exciting practi- Some authors insist that a component’s behavior must be
cal developments in modeling since the invention of rela- adaptive in order for it to be considered an agent. The
tional databases. ABMS promises to have far-reaching ef- agent label is reserved for components that can learn from
fects on the way that businesses use computers to support their environments and change their behaviors in response
decision-making and researchers use electronic laborato- to their experiences. Casti (1997) argues that agents
ries to support their research (North and Macal 2007). should contain both base-level rules for behavior as well
The goals of this tutorial are to show how ABMS is: as a higher-level set of “rules to change the rules.” The
base-level rules provide responses to the environment
• Useful: Why ABMS is good and even better than while the “rules to change the rules” provide adaptation.
many conventional modeling approaches in Jennings (2000) provides a computer science view of
many cases, agency emphasizing the essential characteristic of auto-
• Usable: How we are progressively advancing to nomous behavior. The fundamental feature of an agent is
usable ABMS systems, with better software de- the capability to make independent decisions. This re-
velopment environments and more application quires agents to be active responders and planners rather
experiences, and than purely passive components.

978-1-4244-2708-6/08/$25.00 ©2008 IEEE 101


Authorized licensed use limited to: Universidade Federal de Vicosa. Downloaded on March 12,2024 at 23:23:01 UTC from IEEE Xplore. Restrictions apply.
Macal and North

From a practical modeling standpoint, we consider management rules, for example. Should such a model be
agents to have certain characteristics (Figure 1): considered an agent-based model? It depends on the struc-
ture of such a model. If the structure is such that the mod-
• An agent is an identifiable, discrete, or modular, el does not preclude the addition of agent characteristics
individual with a set of characteristics and rules and behaviors with minor modifications to it, then it
governing its behaviors and decision-making ca- makes sense to refer to the model as agent-based. We
pability. Agents are self-contained. The discrete- have coined the term proto-agent to refer to agents that
ness requirement implies that an agent has a are missing one or more of the characteristics enumerated
boundary and one can easily determine whether above but to which the characteristics can easily be added
something is part of an agent, is not part of an without modification to the structure of the model.
agent, or is a shared characteristic. Unlike particle systems (idealized gas particles for
• An agent is autonomous and self-directed. An example) which are the subject of the field of particle si-
agent can function independently in its environ- mulation, agents are diverse, heterogeneous, and dynamic
ment and in its interactions with other agents for in their attributes and behavioral rules, as shown in Figure
the limited range of situations that are of interest. 1. Behavioral rules can vary in their sophistication, how
• An agent is social, interacting with other agents. much information is considered in the agent decisions
Agents have protocols for interaction with other (cognitive “load”), the agent’s internal models of the ex-
agents, such as for communication. Agents have ternal world including the possible reactions or behaviors
the ability to recognize and distinguish the traits of other agents, and the extent of memory of past events
of other agents. the agent retains and uses in its decisions. Agents also
• An agent is situated, living in an external envi- vary by their attributes and accumulated resources.
ronment with which the agent interacts in addi- Agent-based modeling is known by many names.
tion to other agents. ABM (agent-based modeling), ABS (agent-based systems
• An agent may be goal-directed, having goals to or simulation), and IBM (individual-based modeling) are
achieve (not necessarily objectives to maximize) all widely-used acronyms, but “ABMS” will be used
with respect to its behaviors. This allows an throughout this discussion. The term “agent” has connota-
agent to compare the outcome of its behavior to tions in realms other than agent-based modeling as well.
the goals it is trying to achieve. ABMS agents are different from the agents typically
• An agent is flexible, having the ability to learn found in mobile agent systems. “Mobile agents” are light-
and adapt its behaviors based on experience. weight software proxies that roam over the world-wide
This requires some form of memory. An agent web and perform various functions for users and to some
may have rules that modify its rules of behavior. extent can behave autonomously.
Another point of clarification concerns the term “si-
mulation.” Agent-based simulation refers to a model in
which the dynamic processes of agent interaction are si-
mulated repeatedly over time, as in systems dynamics,
and time-stepped, discrete-event, and other types of con-
ventional simulation. An agent-based model, more gener-
ally, is a model in which repeatedly agents interact. For
example, when agents collectively optimize behavior
through simple exchanges of information as is done in ant
colony optimization or a particle swarm optimization
models, the purpose is to achieve a desired end-state, i.e.,
the optimized system, rather than to simulate a dynamic
process for its own sake.
ABMS has roots in the fields of multi-agent systems
(MAS) and robotics from the field of AI, as well as Arti-
ficial Life (ALife). But ABMS is not only tied to under-
standing and designing “artificial” agents. Its main roots
are in modeling human social and organizational behavior
Figure 1: An agent
and individual decision-making (Bonabeau 2001). With
this, comes the need to represent social interaction, col-
Often, the agents in an agent-based model will lack
laboration, group behavior and the emergence of higher
one or more of these characteristics. It may not be neces-
order social structures.
sary to model adaptation in a supply chain model if the
model’s purpose is to evaluate a set of specific inventory

102
Authorized licensed use limited to: Universidade Federal de Vicosa. Downloaded on March 12,2024 at 23:23:01 UTC from IEEE Xplore. Restrictions apply.
Macal and North

2.2 The Need for Agent Based Modeling 1995) such as (1) Aggregation: allows groups to form, (2)
Nonlinearity: invalidates simple extrapolation, (3) Flows:
Why is agent-based modeling becoming so widespread? allow the transfer and transformation of resources and in-
The answer is because we live in an increasingly complex formation, and (4) Diversity: allows agents to behave dif-
world. First, the systems that we need to analyze and ferently from one another and often leads to the system
model are becoming more complex in terms of their in- property of robustness. CAS mechanisms are: (1) Tag-
terdependencies. Traditional modeling tools are no longer ging: allows agents to be named and recognized, (2) In-
as applicable as they once were. An example application ternal models: allows agents to reason about their worlds,
area is the deregulation of the formerly centralized elec- and (3) Building blocks: allows components and whole
tric power industry in which agents are suddenly free to systems to be composed of many levels of simpler com-
make pricing and investment choices based on their indi- ponents. These CAS properties and mechanisms provide a
vidual criteria. Second, some systems have always been useful reference for designing agent-based models.
too complex for us to adequately model. Modeling eco-
nomic markets has traditionally relied on the notions of 2.3.1 Simple Rules Result in Emergent Organization
perfect markets, homogeneous agents, and long-run equi- and Complex Behaviors
librium because these assumptions made the problems
analytically and computationally tractable. We are begin- The discussion on the background of ABMS begins with
ning to be able to relax some of these assumptions and a simple game developed by the mathematician John
take a more realistic view of these economic systems Conway, the “Game of Life” (Gardner 1970). The GOL,
through ABMS. Third, data are being collected and or- as it is called, is based on cellular automata (CA). Perhaps
ganized into databases at finer levels of granularity. Mi- the simplest way to illustrate the basic ideas of agent-
cro-data can now support individual-based simulations. based modeling and simulation is through CA. According
And fourth, but most importantly, computational power is to Casti (1997), the original notion of CA was developed
advancing rapidly. We can now compute large-scale mi- by the physicist Stanislaw Ulam in response to a question
cro-simulation models that would not have been plausible posed by the famous 20th century mathematician John von
just a couple of years ago. Neumann. The question was, “could a machine be pro-
grammed to make a copy of itself?” In effect, the question
2.3 Background on ABMS had to do with whether it was possible to develop a logi-
cal structure that was complex enough to completely con-
ABMS has connections to many other fields including tain all of the instructions for replicating itself. The an-
complexity science, systems science, systems dynamics, swer turned out to be yes, and it was eventually found in
computer science, management science, several branches the abstract mathematical representation of a machine in
of the social sciences, and traditional modeling and simu- the form of a cellular automata.
lation. ABMS draws on these fields for its theoretical A typical CA is a two-dimensional grid or lattice
foundations, its conceptual world view and philosophy, consisting of cells. Each cell assumes one of a finite num-
and for applicable modeling techniques. ber of states at any point in time. A set of simple rules de-
ABMS has its direct historical roots in complex adap- termines the value of each cell based on the cell’s previ-
tive systems (CAS) and the underlying notion that “sys- ous state. Every cell is updated each period according to
tems are built from the ground-up,” in contrast to the top- the rules. The next value of a cell depends on the cell’s
down systems view taken by systems dynamics. CAS current value and the values of its immediate neighbors in
concerns itself with the question of how complex behav- the eight surrounding cells. Each cell is identical in terms
iors arise in nature among myopic, autonomous agents. In of its update rules. A CA is deterministic in that the same
addition, ABMS tends to be descriptive, with the intent of state for a cell and its neighbors always results in the
modeling the actual or plausible behavior of individuals, same updated state. The GOL has three rules that deter-
rather than normative such as traditional operations re- mine the next state (either On or Off) of each cell:
search (OR), which seeks to optimize and identify optimal
behaviors. 1. The cell will be On in the next generation if ex-
The field of CAS was originally motivated by inves- actly three of its eight neighboring cells are cur-
tigations into adaptation and emergence of biological sys- rently On.
tems. CAS have the ability to self-organize and dynami- 2. The cell will retain its current state if exactly two
cally reorganize their components in ways better suited to of its neighbors are On.
survive and excel in their environments, and this adaptive 3. The cell will be Off otherwise.
ability occurs, remarkably, over an enormous range of
scales. John Holland, a pioneer in the field, identifies Figure 2 shows a snapshot from a GOL simulation show-
properties and mechanisms common to all CAS (Holland ing an initial random distribution of On cells. After sev-

103
Authorized licensed use limited to: Universidade Federal de Vicosa. Downloaded on March 12,2024 at 23:23:01 UTC from IEEE Xplore. Restrictions apply.
Macal and North

eral updates of all cells in the grid, distinctive patterns • Sustainable patterns can emerge in systems that
emerge, and in some cases these patterns can sustain are completely described by simple rules that are
themselves indefinitely throughout the simulation (Figure based on only local information, and
3). The eight-neighbor per neighborhood assumption built • The patterns that may develop can be extremely
into the GOL determines the scope of agent interaction sensitive to the initial conditions.
and the locally available information for each cell to up-
date its state. The Boids simulation is a good example of how in-
teracting agents, characterized by simple behavioral rules,
lead to emergent and seemingly organized behavior (Rey-
nolds 2006). Agent behavior is reminiscent of schooling
or flocking behavior in fish or birds. In the Boids model,
each agent has three rules governing its movement:

1. Cohesion: each agent steers toward the average


position of its nearby “flockmates,”
2. Separation: each agent steers to avoid crowding
local flockmates, and
3. Alignment: each agent steers towards the aver-
age heading of local flockmates.

Here, nearby or local refers to agents in the immediate


neighborhood of an agent as defined by the straight-line
distance. A fourth rule is added to the above three rules to
Figure 2: Game of Life simulation, initial random layout
ensure that the boids stay close to their initial area. Ini-
of cells in the On state
tially, a set number of boids are randomly assigned posi-
tions and orientations (Figure 4). Even with only these
simple rules applied at the individual agent level and only
to the agents in its “neighborhood”, the agents’ behaviors
begin to appear coordinated, and a leaderless flock
emerges (Figure 5).
Two observations are important about the Boids
rules: (1) the rules are simple, and (2) the rules use only
local information. We can make some observations from
the Boids model that have implications for practical
ABMS. First, sustainable patterns can emerge in systems
that are completely described by simple deterministic
rules based on only local information. Second, repeated
experiments (not shown here) demonstrate that the pat-
terns that develop can be extremely sensitive to the initial
conditions - in this case, the initial random positions and
orientations of the boids. .
Figure 3: Game of Life simulation, after all cells have Based on simple rules of behavior and agent interac-
been updated 30 times tion, natural systems seemingly exhibit collective intelli-
gence, or swarm intelligence, even without the existence
Two observations are important about the GOL rules: of or the direction provided by a central authority. How is
(1) The rules are simple, and (2) the rules use only local it that an ant colony can organize itself to carry out the
information. The state of each cell is based only on the complex tasks of food gathering and nest building and at
current state of the cell and the cells touching it in its im- the same time exhibit an enormous degree of resilience if
mediate neighborhood. Although these are interesting the colony is seriously disrupted? Natural systems are
findings, and observing the patterns created by repeated able to not only survive, but also to adapt and become bet-
simulations of the GOL reveals a world of endless crea- ter suited to their environment, effectively optimizing
tions, other observations have implications for practical their behavior over time. Swarm intelligence has inspired
ABMS: practical optimization techniques, such as ant colony op-
timization that have been used to solve practical schedul-

104
Authorized licensed use limited to: Universidade Federal de Vicosa. Downloaded on March 12,2024 at 23:23:01 UTC from IEEE Xplore. Restrictions apply.
Macal and North

ing and routing problems (Bonabeau, Dorigo and Therau- Sakoda (1971) formulated one of the first social
laz, 1999). agent-based models, the Checkerboard Model, which had
some of the key features of a cellular automaton. Schel-
ling applied cellular automata to study housing segrega-
tion patterns and posed the question, “is it possible to get
highly segregated settlement patterns even if most indi-
viduals are, in fact, color-blind?” (Schelling 1978). The
Schelling model demonstrated that ghettos can develop
spontaneously in the sense that system-level patterns can
emerge that are not necessarily implied or even consistent
with the objectives of the individual agents.
Extending the notion of modeling people to growing
entire artificial societies through agent simulation was
taken up by Epstein and Axtell in their groundbreaking
Sugarscape model (Epstein and Axtell 1996). In numer-
ous computational experiments, Sugarscape agents
Figure 4: Boids simulation, initial random configura- emerged with a variety of characteristics and behaviors,
tion highly suggestive of a realistic, although rudimentary and
abstract, society. Emergent processes were observed that
Epstein and Axtell interpreted as death, disease, trade,
wealth, sex and reproduction, culture, conflict and war,
and externalities such as pollution.
Economics is adopting agent-based modeling to an
extent. Some of the classical assumptions of standard mi-
cro-economic theory are: (1) economic agents are ra-
tional, which implies that agents have well-defined objec-
tives and are able to optimize their behavior (the basis for
the “rational agent” model used in economics and many
other social science disciplines), (2) agents are homoge-
neous, having identical characteristics and rules of behav-
ior, (3) there are decreasing returns to scale from eco-
nomic processes, decreasing marginal utility, decreasing
Figure 5: Boids simulation, after 500 updates showing marginal productivity, etc., and (4) the long-run equilib-
two apparent clusters of agents rium state of the system is the primary information of in-
terest. Each of these assumptions can be relaxed in ABMS
2.3.2 Agent-Based Modeling in the Sciences applications to economic systems. First, do organizations
and individuals really optimize? Herbert Simon, a Nobel
In applications of ABMS to social processes, agents rep- Laureate who pioneered the field of AI, developed the no-
resent people or groups of people, and agent relationships tion of “satisficing” to describe what he observed people
represent processes of social interaction (Gilbert and and organizations actually do in the real world (Simon
Troitzsch 1999). The fundamental assumption is that peo- 2001). Behavioral economics is a relatively new field that
ple and their social interactions can be credibly modeled incorporates experimental findings on psychology and
at some reasonable level of abstraction for at least specific cognitive aspects of agent decision making to determine
and well-defined purposes, if not in general. This limited people’s actual economic and decision making behavior.
scope for representing agent behaviors in ABMS contrasts Second, that diversity among individuals universally oc-
with the more general goals of AI. From an ABMS per- curs in the real-world is a key observation of complexity
spective, some important questions become immediately science. Many natural organizations from ecologies to in-
apparent: (1) how much do we know about credibly mod- dustries are characterized by populations whose diversity
eling people’s behavior? and (2) do we know enough gives rise to its stability and robustness. Third, “positive
about human social interaction to credibly model it? feedback loops” and “increasing returns” have been iden-
These two questions have spawned and to some extent re- tified as underlying dynamic processes of rapid exponen-
invigorated basic research programs in the social sciences tial growth in economic systems (Arthur, Durlauf and
that have the promise of informing ABMS on theory and Lane, 1997). Positive feedback can create self-sustaining
methods for agent representation and behavior. processes that quickly take a system away from its start-
ing point to a faraway state. Fourth, long-run equilibrium

105
Authorized licensed use limited to: Universidade Federal de Vicosa. Downloaded on March 12,2024 at 23:23:01 UTC from IEEE Xplore. Restrictions apply.
Macal and North

states are not the only results of interest. The transient tionships that networks embody are important aspects of
states that are encountered along the way to a long-run “network ABMS.”
state are often of interest. Furthermore, not all systems
come to an equilibrium (Axtell 2000). The field of Agent- 2.3.4 Modeling Agent Processes
based Computational Economics (ACE) has grown up
around the application of ABMS to economic systems Identifying the social interaction mechanisms for how co-
(Tesfatsion 2002, 2005). operative behavior emerges among individuals and groups
Archaeologists and anthropologists are developing is an interesting question with practical implications. Evo-
large-scale agent-based simulations of ancient civiliza- lutionary Game Theory is related to traditional game the-
tions to help explain their growth and decline, based on ory and takes into account the repeated interactions of the
archaeological data. ABMS has been applied to explain players and their effect on strategies. Axelrod has shown
the prosperity of ancient cities in Mesopotamia and un- that a simple Tit-For-Tat strategy of reciprocal behavior
derstand the social and environmental factors responsible toward individuals is enough to establish sustainable co-
for the disappearance of the Anasazi in the southwestern operative behavior (Axelrod 1997). The broader need is
U.S. (Koehler, Gumerman and Reynolds, 2005). for a generative type of social science in which the proc-
Sociologists are doing agent-based modeling as well. esses from which social structure emerges can be under-
Macy and Willer (2002) consider agent-based modeling stood as the necessary result of social interactions (Ep-
as an approach to modeling the social life of interacting, stein 2007).
adaptive social agents. Cognitive science has had its own
notion of agency, and social cognitive science is extend- 3 HOW TO DO ABMS
ing these ideas to social settings (Bedau 2003). Synthetic
social agents that include models of the influence of emo- 3.1 Agent-based Modeling Areas
tion and cognition on social behavior are being developed
by cognitive scientists and others (Gratch and Marsella Table 1 lists practical agent-based modeling and simula-
2001). Computational social science is becoming a sub- tion applications in many areas. ABS applications range
field in the social sciences (Sallach and Macal 2001). from modeling agent behavior in the stock market (LeBa-
ron 2002) and supply chains (Fang et al. 2002, Macal
2.3.3 Topologies as a Basis for Social Interaction 2004a), to predicting the spread of epidemics (Huang et
al. 2004) and the threat of bio-warfare (Carley 2006),
As much as modeling agent behaviors, agent modeling from modeling the growth and decline of ancient civiliza-
also concerns itself with modeling agent interactions. The tions (Kohler, Gumerman and Reynolds, 2005) to model-
primary issues of modeling agent interaction are (1) who ing the complexities of the human immune system (Folcik
is connected to who and, (2) the mechanisms governing and Orosz 2006) and the deregulation of electric power
the nature of the interactions. Cellular automata represent markets (Cirillo 2006), just to name a few.
agent interaction patterns and available local information ABMS applications range across a continuum, from
by using a grid or lattice, and the cells immediately sur- small, elegant, minimalist models to large-scale decision
rounding an agent are its neighborhood. Other agent in- support systems. Minimalist models are based on a set of
teraction topologies, such as networks, allow an agent’s idealized assumptions, designed to capture only the most
neighborhood to be defined more generally and may more salient features of a system. These are exploratory elec-
accurately describe social agents’ interaction patterns. tronic laboratories in which a wide range of assumptions
Social Network Analysis (SNA) is a field with a long can be varied over a large number of simulations. Deci-
history that studies the characterization and analysis of sion support models tend to be large-scale applications,
social structure and interaction through network represen- designed to answer a broad range of real-world policy
tations. Traditionally, SNA has focused on static net- questions. These models are distinguished by including
works, i.e., networks that do not change their structure real data and having passed some degree of validation
over time or as a result of agent behavior. Recently, much testing to establish credibility in their results.
progress has been made in understanding the processes of
growth and change of real-world networks (Barabási
2002). Dynamic network analysis (DNA) is a new field 3.2 A Detailed Agent-based Simulation Example
that incorporates the mechanisms of network growth and
change based on agent interaction processes (NRC 2003). We next describe a hypothetical simulation example pro-
Understanding the agent rules that govern how networks vided by Law (2007a). We will implement the example as
are structured and grow, how quickly information is a simple agent-based model using a fixed-time step ap-
communicated through networks, and the kinds of rela- proach, noting it has also been programmed as a discrete
event simulation (DES) as well (Law, 2007b). The exam-

106
Authorized licensed use limited to: Universidade Federal de Vicosa. Downloaded on March 12,2024 at 23:23:01 UTC from IEEE Xplore. Restrictions apply.
Macal and North

ple illustrates some of the similarities and differences be- is green. If the next cell is red, the agent stops
tween agent-based simulation and DES. and waits until the next cell is green.
4. If an agent is traveling through a cell when it
Table 1: Agent-based modeling application areas turns red, then it will stop immediately. It will
not start moving again until the cell turns green.
Business and Organizations Society and Culture 5. When an agent reaches one of the edges of the
• Manufacturing Operations • Ancient civilizations grid, it exits the system, and its total time spent
• Supply chains • Civil disobedience in the simulation is recorded.
• Consumer markets • Social determinants of
The simulation is run until all agents have exited and the
• Insurance industry terrorism
• Organizational networks statistics for the time spent in the system for all agents is
Economics then computed.
An agent’s attributes consist of its (x, y) coordinates (in
• Artificial financial markets Military continuous space) and its heading. An agent also “knows”
• Trade networks • Command and control the cell in which it is located. A formal agent attribute
• Force-on-force specification is as follows:
Infrastructure
• aid: Unique agent identifier (integer)
• Transportation/traffic Biology
• aloc, {x, y}: Agent location in two dimensional con-
• Electric power markets • Population dynamics tinuous space.
• Hydrogen infrastructure • Ecological networks • vel, {vx, vy}: Current velocity (= {0,0} if agent has
• Animal group behavior exited or is located on a red cel
Crowds • Cell behavior and sub • vel0, {vx0, vy0}: Persistent velocity. An agent al-
cellular processes ways assumes this velocity when moving. Note per-
• Pedestrian movement sistent velocity implies an orientation.
• Evacuation modeling • alive: Status indicator (-1 indicates the agent is alive.
A value greater than 0 indicates the time t at which
Consider an environment consisting of a 12 x 12 grid the agent exited the system).
of cells. Each cell is 100 feet on each side. Initially, each
cell is colored green with a probability of 0.8 and red with The other important data structure is the grid cell. A
a probability of 0.2. A cell’s state is independent of all formal cell attribute specification is as follows:
other cells. In our ABMS terminology, the grid is the en-
vironment. The amount of time that a cell is green before
• cid: Unique cell identifier.
turning red is uniform on the set {70, 71, …, 90} minutes,
• cloc, {u, v}: Cell location where u and v are integers.
with mean 80 minutes. The amount of time that a cell is
red before turning green is uniform on the set {10, 11,…, • switchTime: The next time at which the cell status
30} minutes, with mean 20 minutes. will be updated.
Suppose that 100 agents live on the grid. When the • agentL: A list of agents that are located in the cell.
agents move, they move at a speed of 60 feet per minute.
Initially, each agent is randomly placed on the grid and The simulation setup is as follows. Initially, 80%of the
has a heading that is uniformly distributed on the discrete grid is seeded with green cells and 20% with red cells.
set of {0, 90, 180, 270} degrees, with zero degrees being The amount of time that a cell is green before turning red
north and degrees increasing in the clockwise direction. is uniformly distributed, U[70, 90]. The amount of time
More than one agent can coexist on a particular cell. An that a cell is red before turning green is uniformly distrib-
agent can observe the colors of its current cell and its im- uted, U[10, 30]. A fixed set of agents is initially distrib-
mediately adjacent neighbor cells. uted with random orientations (four discrete choices) to
Agents use the following movement rules: random locations on the grid.
In summary, the agent aspects of the simulation are as
1. An agent will begin moving at its specified head- follows:
ing if, and only if, it starts on a green cell.
2. If an agent starts on a red cell, it will wait until • Agents are described as discrete and modular entities
the cell turns green to begin moving. in the (object-oriented) model implementation (as
3. If an agent is moving through a cell and reaches shown above)
the edge, then it will only enter the next cell if it • Agents are autonomous in that they determine wheth-
er or not they can move. Individual agents have asso-
ciated methods that they execute to perform various

107
Authorized licensed use limited to: Universidade Federal de Vicosa. Downloaded on March 12,2024 at 23:23:01 UTC from IEEE Xplore. Restrictions apply.
Macal and North

functions. For example, getAgentNeighbors is a func-


tion that an agent uses to find the agents in its current
cell, and getCellStatus is a function that an agent uses
to find out the status of its current cell (red or green).
• An agent’s external environment is the grid, from
which it extracts information on its cell state.

Some aspects of this example problem do not emphasize


the capabilities of ABS because they include the defining
characteristics of agents in trivial ways. For example, an
agent’s goal is simply to keep moving until it has reached
the edge of the grid. An agent is social in the sense that it
is aware of and recognizes individual agents that are its
neighbors in the cell in which it is located, but agent in-
teraction rules are not implemented. Finally, agents are
not adaptive. This agent framework does allow the agents
to have much more complex behaviors. Modeling each of
these aspects of agents could easily be added to the exam-
ple within the framework described above by adding addi-
tional functions that act on the agents.
Figure 6 shows the agent-based simulation logic. The
simulation is implemented as a set of two nested loops,
one for time, the other for agents. All of the agent behav- Figure 6: Logic for agent-based simulation example
iors are executed each time period. Agents update their
position each time step according to {x, y}new = {x, y} +
{velx, vely}. In this example, the order in which the agents Generation: 1
update their state does not matter, so the agents are up- Agents remaining: 100
Moving: 87 Stopped: 13
dated in a fixed sequence. If the order of updating the
agents did matter, it would be customary practice to either
randomize the order of the agent updating or else imple-
ment a sequencing procedure that has some rational basis
as to why one agent updates itself before the others. This
scheduling process could be event-based or even adaptive
depending on conditions during the simulation.
The time increment, ∆t, is arbitrary and constant
throughout the simulation. A value of ∆t as small as pos-
sible is desirable (constrained by computational re-
sources) to capture the accurate movement of agents as
they cross cell and grid boundaries. This example, as im-
plemented, is more like a combined continuous-discrete
event simulation than a DES. In effect, with the selection
of a small value for ∆t, time progresses continuously
tracking agent movement over the grid, with discrete
events being inserting as cells are updated at specific
times.
Snapshots from the simulation are shown in Figures 7
and 8, and recorded exit times are shown in Figure 9. Figure 7: Example agent-based simulation, initial agent
states (lightly shaded cells are green, dark cells are red)

108
Authorized licensed use limited to: Universidade Federal de Vicosa. Downloaded on March 12,2024 at 23:23:01 UTC from IEEE Xplore. Restrictions apply.
Macal and North

Generation: 108 We distinguish several approaches to building ABMS


Agents remaining: 9 applications in terms of the scale of the software that one
Moving: 8 Stopped: 1
can apply according to the following continuum:

Desktop Computing for ABMS Application Develop-


ment:
• Spreadsheets: Excel using the macro programming
language VBA
• Dedicated Agent-based Prototyping Environments:
Repast Simphony, NetLogo, StarLogo
• General Computational Mathematics Systems:
MATLAB, Mathematica

Large-Scale (Scalable) Agent Development Environ-


ments:
• Repast
• Swarm
• MASON
• AnyLogic

General Programming Languages:


Figure 8: Example agent-based simulation, at time 108 • Python
(lightly shaded cells are green, dark cells are red) • Java
• C++
7
Desktop ABMS can be used to learn agent modeling,
6
prototype basic agent behaviors, and perform limited ana-
5 lyses. Desktop agent-based models can be simple, de-
signed and developed in a period of a few days by a single
4
computer-literate modeler using tools learned in a few
3 days or weeks. Desktop agent modeling can be used to
explore the potential of ABMS with relatively minor time
2 and training investments, especially if one is already fa-
1
miliar with the tool.
Spreadsheets, such as Microsoft Excel, are in many
ways the simplest approach to modeling. It is easier to
0 50 100 150
develop models with spreadsheets than with many of the
Figure 9: Exit times in agent-based simulation example other tools, but the resulting models generally allow lim-
ited agent diversity, restrict agent behaviors, and have
3.3 ABMS Software and Toolkits poor scalability compared to the other approaches. Some
useful agent models have been developed using spread-
Agent-based modeling can be done using general, all- sheet models (Bower and Bunn 2000). In previous WSC
purpose software or programming languages, or it can be papers, we described an spreadsheet implementation of a
done using specially designed software and toolkits that spatial agent-based shopper model (Macal and North
address the special requirements of modeling agents. 2007).
Agent modeling can be done in the small, on the desktop, Special-purpose agent tools, such as NetLogo, and
or in the large, using large-scale computing clusters, or it StarLogo, provide special facilities focused on agent
can be done at any scale in-between these extremes. Pro- modeling. The most directly visible common trait shared
jects often begin small, using one of the desktop ABMS by the various prototyping environments is that they are
tools, and then grow in stages into the larger-scale ABMS designed to get first-time users started as quickly as pos-
toolkits. Often one begins developing their first agent sible. NetLogo is a free ABMS environment (Wilensky
model using the approach that one is most familiar with, 1999) developed at Northwestern University’s Center for
or the approach that one finds easiest to learn given their Connected Learning and Computer-Based Modeling
background and experience. (http://ccl.northwestern.edu/netlogo/). The NetLogo lan-
guage uses a modified version of the Logo programming

109
Authorized licensed use limited to: Universidade Federal de Vicosa. Downloaded on March 12,2024 at 23:23:01 UTC from IEEE Xplore. Restrictions apply.
Macal and North

language (Harvey 1997). NetLogo is designed to provide has been used extensively in social simulation applica-
a basic computational laboratory for teaching complex tions (North and Macal 2005). Repast is a widely used
adaptive systems concepts. NetLogo was originally de- free and open source agent-based modeling and simula-
veloped to support teaching, but it can be used to develop tion toolkit (ROAD 2007). Repast Simphony (Repast S) is
a wide range of applications. NetLogo provides a graphi- the latest version of Repast, designed to provide visual
cal environment to create programs that control graphic point-and-click tools for agent model design, agent behav-
“turtles” that reside in a world of “patches” that is moni- ior specification, model execution, and results examina-
tored by an “observer.” NetLogo includes an innovative tion. The Repast S agent model designer is being devel-
participatory ABMS feature called HubNet (Wilensky and oped to allow users to visually specify the logical
Stroup 1999), which allows groups of people to interac- structure of their models, the spatial (e.g., geographic
tively engage in simulation runs alongside of computa- maps and networks) structure of their models, the kinds of
tional agents. agents in their models, and the behaviors of the agents
General-purpose desktop computational mathematics themselves. Once their models are specified, users can use
system (CMS) with an integrated development environ- the point-and-click Repast S runtime environment to exe-
ment, such as MATLAB and Mathematica, can be used to cute model runs as well as visualize and store results. In
develop agent models, although the agent-specific func- addition, the Repast S runtime environment includes au-
tionality has to be written by the developer from scratch tomated results analysis connections to a variety of
(Macal 2004b). The basic requirements are a full scripting spreadsheet, visualization, data mining, and statistical
language capability combined with array or list- analysis tools, virtually all of which are free and open
processing capabilities for efficiency. Computational ma- source.
thematics systems are structured in two main parts: (1) the
user interface that allows dynamic user interaction, and 3.4 Why and When ABMS
(2) the underlying computational engine, or kernel, that
performs the computations according to the user’s instruc- We conclude by offering some ideas on the situations for
tions. The underlying computational engine is written in which agent-based modeling can offer distinct advantages
the C programming language for these systems, but C to conventional simulation approaches. When is it benefi-
coding is unseen by the user. The interpreted nature of cial to think in terms of agents? When one or more of the
these systems avoids the compilation and linking steps following criteria are satisfied:
required in traditional programming languages. Computa-
tional mathematics systems have advantages derived from • When there is a natural representation as agents
both the mathematical and interactive orientations of • When there are decisions and behaviors that can
these tools. CMS environments have rich mathematical be defined discretely (with boundaries)
functions, and nearly any mathematical relation or func- • When it is important that agents adapt and
tion that can be numerically calculated is available within change their behaviors
these tools or their add-on libraries. In some cases, the • When it is important that agents learn and en-
tools even support symbolic processing and manipulation, gage in dynamic strategic behaviors
which is useful for systems of equations that can be • When it is important that agents have a dynamic
solved analytically (Macal 2004b). If a CMS environment relationship with other agents, and agent rela-
is already familiar, this can be a good place to start agent- tionships form and dissolve
based modeling.
• When it is important to model the processes by
Many large-scale ABMS software environments are
which agents form emergent organizations, and
now freely available. These include Repast (North, Col-
adaptation and learning are important at the or-
lier and Vos, 2006), Swarm (SDG 2006; Minar et al.
ganization level
1996), NetLogo (NetLogo 2007) and MASON (GMU
• When it is important that agents have a spatial
2006) among many others. Proprietary toolkits are also
component to their behaviors and interactions
available such as AnyLogic (2006). A recent review and
comparison of Java-based agent modeling toolkits is pro- • When the past is no predictor of the future
vided by Tobias and Hoffman (2004). • When scaling-up to arbitrary levels is important
Swarm was the first ABMS software development in terms of the number of agents, agent interac-
environment launched in 1994 at the Santa Fe Institute. tions and agent states
Swarm was originally written in Objective C and was lat- • When process structural change needs to be a re-
er fitted with a Java interface. Following the original sult of the model, rather than a model input
Swarm innovation, the Repast (REcursive Porous Agent
Simulation Toolkit) toolkit was developed as a pure Java
implementation (North, Collier and Vos, 2006). Repast

110
Authorized licensed use limited to: Universidade Federal de Vicosa. Downloaded on March 12,2024 at 23:23:01 UTC from IEEE Xplore. Restrictions apply.
Macal and North

ACKNOWLEDGMENTS <http://www.complexity.org.au/ci/vol08/
casti01/> [accessed September 23, 2008].
This work was supported by the U.S. Department of En- Cirillo, R., P. Thimmapuram, T. Veselka, V. Koritarov,
ergy under contract number DE-AC02-06CH11357. Por- G. Conzelmann, C. Macal, G. Boyd, M. North, T.
tions of this tutorial have appeared in previous tutorial Overbye, and X. Cheng. 2006. Evaluating the poten-
papers presented at the Winter Simulation Conference in tial impact of transmission constraints on the opera-
2007, 2006 and 2005. tion of a competitive electricity market in Illinois,
Argonne National Laboratory, ANL-06/16 (report to
the Illinois Commerce Commission).
REFERENCES Epstein, J. M. 2007. Generative social science: Studies in
agent-based computational modeling, Princeton Uni-
AnyLogic. 2006. <http://www.xjtek.com/>. versity Press:Princeton, NJ.
Arthur, W., S. Durlauf and D. Lane. 1997. The economy Epstein, J. M., and R. Axtell. 1996. Growing artificial so-
as an evolving complex system II, SFI Studies in the cieties: social science from the bottom up, Cam-
Sciences of Complexity, Addison Wesley: Reading, bridge, MA: MIT Press.
MA. Fang, C., S. Kimbrough, S. Pace, A. Valluri and Z.
Axelrod, R. 1997. The complexity of cooperation: agent- Zheng. 2002. On adaptive emergence of trust behav-
based models of competition and collaboration, Prin- ior in the game of stag hunt, Group Decision and Ne-
ceton, NJ: Princeton University Press. gotiation 11(6): 449–467.
Axelrod, R. 1997. Advancing the art of simulation in the Folcik, V., and C. Orosz. 2006. An agent-based model
social sciences, in Conte., R., Hegselmann, R. and demonstrates that the immune system behaves like a
Terna, P., eds. Simulating social phenomena, Berlin: complex system and a scale-free network. SwarmFest
Springer-Verlag: 21-40. 2006, University of Notre Dame, South Bend, IN,
Axtell, R. 2000. Why agents? On the varied motivations June.
for agent computing in the social sciences, Working Gilbert, N., and K. G. Troitzsch. 1999. Simulation for the
Paper 17, Center on Social and Economic Dynamics, social scientist, Buckingham UK: Open University
Brookings Institution, Washington, D.C. Press.
Barabási, A.-L. 2002. Linked: the new science of net- Gardner, M. 1970. The fantastic combinations of John
works. Cambridge, MA: Perseus Pub. Conway's new solitaire game "Life", Scientific
Bedau, M. A. 2003. Artificial Life: Organization, Adapta- American 223:120-123.
tion and Complexity from the Bottom Up, TRENDS GMU (George Mason University). 2006. MASON home
in Cognitive Sciences 7(11):505-512. page. Available via <http://cs.gmu.edu/
Bonabeau, E., M. Dorigo, and G. Theraulaz. 1999. Swarm ~eclab/projects/mason/>.
intelligence: from natural to artificial systems, Ox- Gratch, J., and S. Marsella. 2001. Tears and fears: model-
ford: Oxford University Press. ing emotions and emotional behaviors in synthetic
Bonabeau, E. 2001. Agent-based modeling: methods and agents, In Proceedings of 5th International Confer-
techniques for simulating human systems. In Pro- ence on Autonomous Agents, 278-285.
ceedings of National Academy of Sciences 99(3): Harvey, B. 1997. Computer Science Logo Style, MIT
7280-7287. Press: Boston, Massachusetts USA
Booch, G., J. Rumbaugh, and I. Jacobson. 1998. The uni- Holland, J. H. 1995. Hidden order: how adaptation builds
fied modeling language user guide, Addison- complexity, Addison-Wesley:Reading, Mass.
Wesley:New York. Huang, C.-Y., C.-T. Sun, J.-L. Hsieh and H. Lin. 2004.
Bower, J., and D. Bunn. 2000. Model-based comparisons Simulating SARS: Small-world epidemiological
of pool and bilateral markets for electricity. The En- modeling and public health policy assessments.
ergy Journal 21(3):1–29. JASSS - Journal of Artificial Societies And Social
Carley, K. M., D. B. Fridsma, E. Casman, A. Yahja, N. Simulation 7(4): 100-131.
Altman, L.-C. Chen, B. Kaminsky and D. Nave. Jennings, N. R. 2000. On agent-based software engineer-
2006. BioWar: scalable agent-based model of bioat- ing, Artificial Intelligence 117:277-296.
tacks. IEEE Transactions on Systems, Man, and Cy- Kohler, T., G. Gumerman, and R. Reynolds. 2005. Simu-
bernetics - Part A: Systems and Humans 36(2):252- lating ancient societies, Scientific American.
265. Law, A. M. 2007a. Agent-based simulation: A new ap-
Casti, J. 1997. Would-be worlds: how simulation is proach to systems modeling, presentation, Averill M.
changing the world of science, New York: Wiley. Law & Associates, Tucson, AZ
Casti, J. 2001. Bizsim: the world of business - in a box, Law, A. M. 2007b. Simulation modeling and analysis, 4th
Complexity International, 08:6. Available via ed. New York: McGraw-Hill.

111
Authorized licensed use limited to: Universidade Federal de Vicosa. Downloaded on March 12,2024 at 23:23:01 UTC from IEEE Xplore. Restrictions apply.
Macal and North

LeBaron, B. 2002. Short-memory traders and their impact Sakoda, J. M. 1971. The checkerboard model of social in-
on group learning in financial markets. In Proceed- teraction. Journal of Mathematical Sociology 1:119-
ings of National Academy of Sciences 99(90003): 132.
7201-7206. Sallach, D., and C. Macal. 2001. The simulation of social
Macal, C. 2004a. Emergent structures from trust relation- agents: an introduction, Social Science Computer Re-
ships in supply chains. In Proceedings of Agent 2004: view 19(3):245–248.
Conference on Social Dynamics, eds., C. Macal, D. Schelling, T. C. 1978. Micromotives and macrobehavior,
Sallach and M. North, Chicago, IL, Oct. 7-9, 743- New York: Norton.
760, Argonne National Laboratory. SDG (Swarm Development Group). 2006. Swarm Devel-
Macal, C. M. 2004b. Agent-Based Modeling and Social opment Group home page. Available via
Simulation with Mathematica and MATLAB, In <http://www.swarm.org>.
Proceedings of Agent 2004 Conference on Social Simon, H. 2001. The sciences of the artificial, Cambridge,
Dynamics: Interaction, Reflexivity and Emergence, MA: MIT Press.
Macal, C., D. Sallach, and M. North, eds., 185-204, Simon, J. 2002. Excel programming, Wiley Publishing:
Chicago, IL, Oct. 7-9. Available via Hoboken, NJ.
<http://www.agent2004.anl.gov>. Tesfatsion, L. 2002. Agent-based computational econom-
Macal, C. M., and M. J. North. 2007. Agent-based Model- ics: growing economies from the bottom up, Artifi-
ing and Simulation: Desktop ABMS. Proceedings of cial Life 8(1):55-82.
the 2007 Winter Simulation Conference. Eds. S. G. Tesfatsion, L. 2005. Agent-based Computational Eco-
Henderson, B. Biller, M.-H. Hsieh, J. Shortle, J. D. nomics (ACE) home page. Available via
Tew, and R. R. Barton, 95-106. Washington, DC. <http://<www.econ.iastate.edu/tesfatsi/
Macy, M., and R. Willer. 2002. From factors to actors: ace.htm>.
computational sociology and agent-based modeling, Tobias, R., and C. Hofmann. 2004. Evaluation of free
Annual Review of Sociology 28:143-166. Java-libraries for social-scientific agent based simula-
Minar, N., R. Burkhart, C. Langton, and M. Askenazi. tion. Journal of Artificial Societies and Social Simu-
1996. The Swarm simulation system, a toolkit for lation 7(1).
building multi-agent simulations. Available via Wilensky, U. 1999. Netlogo, Center for Connected Learn-
<http://www.santafe.edu/projects/swarm/ ing and Computer-Based Modeling, Northwestern
overview/overview.html>. University:Evanston, IL USA. Available via
NetLogo. 2007. NetLogo home page. Available via <http://ccl.northwestern.edu/netlogo/>.
<http://http://ccl.northwestern.edu/net Wilensky, U., and W. Stroup. 1999. Hubnet, Center for
logo>. Connected Learning and Computer-Based Modeling,
North, M. J., and C. M. Macal. 2007. Managing business Northwestern University: Evanston, IL USA. Avail-
complexity: discovering strategic solutions with able via <http://ccl.northwestern.edu/ps/>.
agent-based modeling and simulation, Oxford Uni-
versity Press: Oxford, U.K.
AUTHOR BIOGRAPHIES
North, M., N. Collier, and J. Vos. 2006. Experiences in
creating three implementations of the repast agent
CHARLES M. MACAL, Ph.D., P.E., is the Director,
modeling toolkit, ACM Transactions on Modeling
Center for Complex Adaptive Agent Systems Simulation
and Computer Simulation, 16(1):1-25.
(CAS2), Argonne National Laboratory. He is a member of
North, M. J., and C. M. Macal. 2005. Escaping the acci-
the INFORMS-Simulation Society, Society for Computer
dents of history: an overview of artificial life model-
Simulation International, the Systems Dynamics Society
ing with Repast. In Artificial Life Models in Software,
and a founding member of NAACSOS. Charles has a
eds. A. Adamatzky and M. Komosinski, Springer-
Ph.D. in Industrial Engineering & Management Sciences
Verlag: Dordrecht, Netherlands.
from Northwestern University. Contact:
NRC (National Research Council). 2003. Dynamic social
<[email protected]>.
network modeling and analysis: workshop summary
and papers, R. Brieger, K. Carley, and P. Pattison,
MICHAEL J. NORTH, M.B.A., Ph.D., is the Deputy
Committee on Human Factors, Washington, DC: Na-
Director of CAS2 at Argonne. Michael has over 15 years
tional Academies Press.
of experience developing advanced modeling and simula-
ROAD (Repast Organization for Architecture and De-
tion applications for the federal government, international
sign). 2007. Repast Home Page, Available via
agencies, private industry, and academia. Michael has a
<http://repast.sourceforge.net/>.
Ph.D. in Computer Science from the Illinois Institute of
Reynolds, C. 2006. Boids. Available via
Technology. Contact: <[email protected]>.
<http://www.red3d.com/cwr/boids/>.

112
Authorized licensed use limited to: Universidade Federal de Vicosa. Downloaded on March 12,2024 at 23:23:01 UTC from IEEE Xplore. Restrictions apply.

You might also like