Over a million developers have joined DZone.

Introduction to Agent-Based Modeling

DZone 's Guide to

Introduction to Agent-Based Modeling

Instead of relying on verbal theories, we can now build ABMs of the phenomena that we want to understand and test these models against data.

· AI Zone ·
Free Resource

Among researchers, there is a growing interest in conceptualizing complex problems. It requires using a system framework and using systems modeling tools to explore how components of a complex problem interact. In particular, system simulation approaches are useful tools for understanding the processes and structures involved in complex problems. Also, identifying high-leverage points in the system and evaluating hypothetical interventions becomes easier.

One tool that has extensive usage in among researchers is agent-based modeling (ABM). We define traits and initial behavior rules of an agent that organize their actions and interactions. Stochasticity plays an important part in determining which agents interact and how agents make decisions.

Before going into too much depth, let us first have a look at two basic modeling approaches. After that, we can further delve into the world of agent-based modeling.

Types of Modeling Approaches

Equation-Based Modeling

It builds on the interrelation of a set of equations that captures the variability of a system over time (ordinary differential equations — ODEs) or over time and space (partial differential equations — PDEs). An example would provide the development of pressure in a box. EBM does not aim at representing the micro-level behavior of individual agents in the first place (e.g. the velocity of individual gas particles in the box). Therefore, EBM tends to focus the modeler’s attention on the overall behavior of the system. Its basic constituencies are levels and flow rates, and not so many individual components.

Usually, we validate EBM on the systems level by comparing model output with real system behavior. Since the behavior of individual components is not explicitly in its focus, we do not validate it on this level.

Furthermore, EBM (when restricted to ODE-methods like System Dynamics) has no intrinsic option for representing space (PDEs provide parsimonious options for modeling physical space, but not the interaction space of individual agents).

Several intuitive drag-and-drop tools for constructing and analyzing system dynamics models exist (StellaPowersimSimulink (of Matlab) or VENSIM), which makes EBM relatively easy to use and therefore, extensive usage and deployment.

In sum, EBM seems well-suited to represent physical processes (or processes that can be seen as such without loss). It suggests regarding a system as a whole in the first place and does not support an explicit representation of components (agents). To some extent, EBM is a type of top-down technology. It is most naturally applicable to systems that we can model centrally, and in which physical laws govern dynamics rather than by information processing.

Agent-Based Modeling

It usually starts out with modeling properties and behavior of individual agents and only thereafter considers macro-level effects to emerge from the aggregation of agents’ behavior. In ABM, the individual agent is the explicit subject to the modeling effort.

With this, ABM offers an additional level of validation. Like EBM, it allows comparing model output with observed system behavior. Additionally, however, it can be validated at the individual level by comparing the encoded behavior of each agent with the actual behavior of real agents. This, however, usually requires additional data, hence more efforts in empirical research.

Basically, ABM might seem intuitively more appropriate for modeling social systems since it allows and even necessitates considering individual decisions, dispositions, and inclinations. Its natural modularization follows boundaries among individuals, whereas in EBM, modularization often crosses these boundaries.

What is more, ABM allows representing space, thereby offering possibilities to consider topological particularities of interaction and information transfer. In combination with graph theory and network analysis, it enables precise conceptualizations of differences in frequency, strength, existence, etc. of interactions between agents.

What Is Agent-Based Modeling

Agent-based modeling (ABM) is a style of modeling in which we represent the interaction between individuals and with each other environment in a program. Agents can be, for example, people, animals, groups, or cells. They can model entities that do not have a physical basis but are entities that can perform some tasks such as gathering information or modeling the evolution.

It is a method of modeling complex systems by defining rules and behaviors for individual components (agents) as well as the environment they are present in. Further, we aggregate these rules to see the general behavior of the system. It helps in understanding how simple micro-rules of individual behavior emerge into macro-level behavior of a system. Being able to model these complex systems can lead to a better understanding of them, thereby being able to control the course of events, just by tweaking simple rules at the individual level.

Entities in Agent-Based modeling

ABM contains autonomous models called agents. These agents can be an individual, a group of individuals, or even an organization. Each agent is defined with properties of its own along with relationships with other agents. Apart from agents, ABMs also have environments, which is a set of conditions the agent is exposed to. Once these entities are defined in an ABM, individual behavioral rules of how an agent would behave in a given environment is defined. An aggregate of these simple individual-level behaviors that lead to a complex macro level pattern. A feedback-based learning-model is often used in ABMs to update agent actions based on their changing relationships with other agents and their environment.

Why Agent-Based Modeling

Conventional models take into consideration only factors externals to their components to decide their actions. This has the drawback of not modeling the “big picture” entirely. An ABM, not only considers the external factors, but also one component’s interaction with other components, to decide their actions. Thus, it includes the possibilities of these interactions impacting the actions as well. Also, as stated by William Rand, Consumers modeled with ABM can be boundedly rational, heterogeneous in their properties and actions, adaptive and sensitive to history in their decisions, and located within social networks or geographical locations. This makes simulations of situations using ABMs more representative of the real world.

An Example of Agent-Based Models

This example simulates the spread of a fire through a forest. It shows that the fire’s chance of reaching the right edge of the forest depends critically on the density of trees. This is an example of a common feature of complex systems, the presence of a non-linear threshold or critical parameter.

Fire Model

The fire starts on the left edge of the forest and spreads to neighboring trees. The fire spreads in four directions: north, east, south, and west.

The model assumes there is no wind. So, the fire must have trees along its path in order to advance. That is, the fire cannot skip over an unwooded area (patch), so such a patch blocks the fire’s motion in that direction.

When you run the model, how much of the forest burns? If you run it again with the same settings, do the same trees burn? How similar is the burn from run to run?

Each turtle that represents a piece of the fire is born and then dies without ever moving. If the fire comprises of turtles but no turtles are moving, what does it mean to say that the fire moves? This is an example of different levels in a system: at the level of the individual turtles, there is no motion, but at the level of the turtles collectively over time, the fire moves.

Tools for Agent-Based modeling

Amp. The AMP project provides extensible frameworks and exemplary tools for representing, editing, generating, executing and visualizing agent-based models (ABMs) and any other domain requiring spatial, behavioral and functional features.

Ascape. An innovative tool for developing and exploring general-purpose agent-based models.

Breve. A free, open-source software package which makes it easy to build 3D simulations of multi-agent systems and artificial life.

GAMA is a simulation platform, which aims at providing field experts, modelers, and computer scientists with a complete modeling and simulation development environment for building spatially explicit multi-agent simulations.

MASON is a fast discrete-event multiagent simulation library core in Java, designed to be the foundation for large custom-purpose Java simulations.

MASS is a Multi-Agent Simulation Suite consists of four major components built around a simulation core.

MetaABM. Supports a high-level architecture for designing, executing and systematically studying ABM models.

NetLogo. A cross-platform multi-agent programmable modeling environment.

Player/Stage. Free Software tools for robot and sensor applications.

PS-I is an environment for running agent-based simulations. It is cross-platform, with binaries available for Win32.

Repast. A free and open source agent-based modeling toolkit that simplifies model creation and use.

Problem Description

The “Heroes and Cowards” game, also called the “Friends and Enemies” game or the “Aggressors and Defenders” game dates back to the Fratelli Theater Group at the 1999 Embracing Complexity conference, or perhaps earlier.

In the human version of this game, each person arbitrarily chooses someone else in the room to be their perceived friend, and someone to be their perceived enemy. They don’t tell anyone who they have chosen, but they all move to position themselves either such that a) they are between their friend and their enemy (BRAVE/DEFENDING), or b) such that they are behind their friend relative to their enemy (COWARDLY/FLEEING).

This simple model demonstrates an idealized form of this game played out by computational agents. Mostly, it demonstrates how rich, complex, and surprising behavior can emerge from simple rules and interactions.

Next Steps

In the next article of this series, we will be implementing the above-mentioned problem. We will use NetLogo for modeling the above problem. Keep watching this space for the next part!


ABM offers the behavioral sciences a computational toolkit for developing precise and specific models. It focuses on how individuals interact and discover patterns of behavior and organization that emerge from these interactions. Instead of relying on verbal theories, we can now build ABMs of the phenomena that we want to understand. We can test these models against data. Depending upon the degree that they successfully agree with the data, we can achieve a deeper understanding of any phenomena.

data science ,data science with python ,artificial intelligence ,agent-based modeling ,abm ,ebm ,equation-based modeling

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}