Agent-Based Modeling

This is an article in our new series exploring and explaining the concepts that underlie our research. Many of our projects integrate highly involved, deeply technical theories and methods, which can be hard to understand without proper training. These posts are intended to break down those abstractions and put them in context.

Many of our projects at CMAC, such as the Modeling Religion Project or Tools Against Child Trafficking, use a methodology called “Agent-based modeling” to study the dynamics of social systems. But what in the world is an agent-based model, and why would anyone want to use them? In this article, we’re going to walk you through an example of a simple agent-based model that seeks to answer the question: how do different levels of individual intolerance result in patterns of segregation between different groups? As you’ll see, sometimes large and systematic divisions can emerge spontaneously based on a simple set of rules.

Okay,  we want to study how segregation between two different ethnic groups occurs in a neighborhood. So, we set up a simulated society of two different groups randomly dispersed in an area, with one group ‘red’ and the other ‘green.’ Members of these groups are happy if a certain percent of their neighbors are from the same group as them. “Unhappy” agents – marked with an X – will try to move in the next turn for a more similar set of neighbors. Each turn is marked by a ‘time step,’ or each instance that the modeler presses ‘go’ on the simulation. In this case, the order of turns is chosen randomly. At each time step, each agent  seeks a pre-programmed number of similar neighbors. Agents will move to a new location if necessary to hit this desired percentage, a process which repeats until all the agents who were unhappy at the beginning of the turn have had a chance to move. Let’s look at what happens after only one time step, with the tolerance set at 30% – meaning each agent wants roughly 30% of their neighbors to be their same.

Here you can see that even after just one turn, the space becomes a little more homogeneous.

Now let’s imagine that the two groups are much more intolerant, to the extent that they want all of their neighbors to be from the same group. Check out what happens:

Even though the individual agents in this simulation want to be away from each other, when they all adopt that strategy, the space remains evenly mixed. Consequently,  the simulation will never be able to end at a point where almost any of the agents are happy.

But all of that is after just one turn, and these types of social processes are most potent in the long-term. So, to get a good sense of what happens in such a situation, we let the model run for longer – say, 100 turns. Let’s look at those long term results when we set the threshold to 33%, 66%, and 100%.

Here we can see that simple adjustments in the agents’ preferences cause different long term results. Look at how both 33% and 66% lead to segregated neighborhoods, but 66% causes a much more dramatic separation between the two groups. And again we see that even in the long term, 100% never stabilizes at all, causing agents to endlessly migrate trying to find a spot that is completely inhabited by their own kind. Even the ones that have this condition temporarily satisfied (as you can see in the image above), will have to move on the next turn, as everyone around them continues to move.

This is a rather famous example of an Agent-Based Model (or ABM) developed by economist Thomas Schelling in the 1970s (you can download and play with this version of the  model yourself at http://ccl.northwestern.edu/netlogo/models/Segregation). Agent-based modeling is a form of computer simulation that programs groups of “agents” with certain behaviors, goals, and ideas and then measures or observes the effects of those particularities at the macro level. In the simulation above, we didn’t ask the model to form segregated or integrated groups. Instead, we gave each agent a limited goal that the modeler could adjust, and then the patterns of separation emerged seemingly all by themselves.

This tendency towards self-organization or the spontaneous emergence of patterns is the fundamental idea that drives research with ABMs, and it applies whether the models are being used to study cellular formation, ecological relationships, rebellion and policing, or the formation of insect hives. This is why ABM is also sometimes called Swarm AI. The “intelligence” or adaptiveness of the simulation is not programmed in from the top-down, but rather emerges from the aggregated effects of interacting parts.

What are the uses of agent-based models? Archaeologist Stephen Mithen has helpfully identified two major functions of this type of research in the social sciences. ABMs can: Test Hypotheses, comparing the outputs of the model against real-world quantitative data and ultimately  supporting or challenging different theories about the underlying causes of different social phenomena; Support Theory Building, transforming an informal or qualitative idea into clear procedures and behaviors that can be programmed into a model, forcing researchers to clarify their assumptions into testable ideas.  

Scholars and researchers in the social sciences and the humanities often balk at the second approach, arguing that the texture of human life is far too complex and qualitative to ever be usefully reduced to a set of simulated procedures. But these objections are often missing the point of modeling altogether.  Joshua Epstein, a key foundational figure in ABM research, has a compelling response to these challenges;

The first question that arises frequently-sometimes innocently and sometimes not-is simply, ‘Why model?”  Imagining a rhetorical inquisitor, my favorite retort is, “You are a modeler.” Anyone who ventures a projection, or imagines how a social dynamic-an epidemic, war, or migration-would unfold is running some model.

But typically, it is an implicit model in which the assumptions are hidden, their internal consistency is untested, their logical consequences are unknown, and their relation to data is unknown. But when you close your eyes and imagine an epidemic spreading, or any other social dynamic, you are running some model or other, it is just an implicit model that you haven’t written down.

The choice, then, is not whether to build models; it’s whether to build explicit ones. In explicit models, assumptions are laid out in detail, so we can study exactly what they entail.

ABMs are not a silver bullet, and they are never intended to fully replicate the tapestry of human experience in all its gloriously messy complexity. But they are a powerful means for testing our assumptions and investigating how the orders and patterns of social life emerge from simple rules and simple goals.They are an invaluable tool for anyone pursuing an empirical and scientific approach to culture and society – and that’s exactly why CMAC uses them.

Works Referenced

Epstein, Joshua M. (2008). Why Model? Journal of Artificial Societies and Social Simulation 11(4).

Mithen, S. J. (1994). Simulating prehistoric hunter-gatherers. in N. Gilbert & J. Doran (eds.), Simulating Societies: The Computer Simulation of Social Phenomena (pp. 165–193). London: UCL Press.

Schelling, Thomas C. (1971) Dynamic models of segregation, The Journal of Mathematical Sociology, 1:2, 143-186.

Wilensky, U. (1997). NetLogo Segregation model. http://ccl.northwestern.edu/netlogo/models/Segregation. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.

For any inquiries or comments, please email admin@mindandculture.org.