Skip to content

About Agent Based Modeling

David Masad edited this page May 11, 2015 · 6 revisions

The front page says somewhere that

Mesa is an an agent-based modeling framework for Python.

So what does that mean?

An agent-based model (ABM) is a model or simulation of a system which is composed of multiple agents which interact with one another. Agents are the individual actors in the system: they may represent animals, people, robots, organizations, even entire countries. The model encodes certain rules for how agents behave, interact with one another and with their environment, how they make decisions, and how they change over time. We can run a model step by step, examining how the different individual behaviors combine to yield macro-level results; or we can run the model many times, seeing what macro-level results are most likely, and how they are affected by different parameters and rules.

For example, think of modeling the spread of an epidemic. A mathematical model might use a system of differential equations to describe how the percents of the population susceptible to the disease, already infected, and recovered (or removed) vary with time and influence one another. For example, the model might specify how the current fraction of the population that's infected determines the rate of new infections. However, the model can't say anything about a particular individual; only what fraction of the overall population fall into which category at any given time.

In contrast, an agent-based model might consist of individual, simulated agents walking around a landscape, each of whom might be susceptible, infected or recovered at any given time. The model could include rules for the agents' movement, as well as for direct agent-to-agent infection: for example, if an infected agent runs into a susceptible one, the susceptible one has a 50% chance of becoming infected too. A model like this might produce similar behaviors to the mathematical model, but its specifications are much more intuitive: individual behavior instead of overall population dynamics.

But agent-based models let us go further. What would happen, for example, if healthy agents started actively avoiding infected ones? What if infected agents stayed in one place instead of moving around? It can be hard to figure out how to add these additional dynamics to a purely mathematical model, but they're relatively straightforward to program for our individual agents.

And we can go further still. Instead of just walking around an abstract empty space, the agents can live in a simulated cityscape, going back and forth between their homes and jobs. In fact, we could take real urban data, having agents move along real streets (and public transit lines) from residential neighborhoods to business districts. We can add even more behaviors: agents can stay home to care for a sick child, or go to a hospital to seek treatment. Now we don't just have an abstract model of a disease, but a real simulation of a particular outbreak, grounded in real data and plausible, intuitive behavioral rules.