Agents.jl

This is an examples-only repository!

Please notice that this repository holds only examples of various models implemented in Agents.jl. To actually learn how to use Agents.jl please visit the online documentation first!

The examples here were built with versions

using Pkg
Pkg.status(["Agents", "InteractiveDynamics", "CairoMakie"];
    mode = PKGMODE_MANIFEST, io=stdout
)
Status `~/work/AgentsExampleZoo.jl/AgentsExampleZoo.jl/docs/Manifest.toml`
  [46ada45e] Agents v6.0.1
  [13f3f980] CairoMakie v0.11.9

Overview of Examples

Our ever growing list of examples are designed to showcase what is possible with Agents.jl. Here, we outline a number of topics that new and advanced users alike can quickly reference to find exactly what they're looking for.

Discrete spaces

Making a discrete grid is perhaps the easiest way to conceptualise space in a model. That is why the main example of Agents.jl documentation is the Schelling model on a discrete space. Sugarscape is one of our more complex examples, but gives you a good overview of what is possible on a grid. If you're looking for something simpler, then the Forest fire would be a good start, which is also an example of a cellular automaton. Daisyworld is a famous ABM example which has both agent and model dynamics, similarly with Sugarscape. Ants is based on an ABM model from NetLogo that shows the behavior of colonies.

Continuous spaces

In this space, agents generally move with a given velocity and interact in a far smoother manner than grid based models. The Flocking model is perhaps the most famous example of bottom-up emergent phenomena and is hosted in the main Agents.jl documentation. Something quite topical at present is our Continuous space social distancing example. Finally, an excellent and complex example of what can be done in a continuous space: Bacterial Growth.

Higher dimensional spaces

Battle Royale is an advanced example which leverages a 3-dimensional grid space, but only uses 2 of those dimensions for space. The third represents an agent category. Here, we can leverage Agents.jl's sophisticated neighbor searches to find closely related agents not just in space, but also in property.

Agent Path-finding

Besides the main (and most complex) example we have in the docs with Rabbit, Fox, Hawk, here are two more models showcasing the possibilities of pathfinding: Maze Solver and Mountain Runners.

Synchronous agent updates

Most of the time, using the agent_step! loop then the model_step! is sufficient to evolve a model. What if there's a more complicated set of dynamics you need to employ? Take a look at the Hegselmann-Krause opinion dynamics: it shows us how to make a second agent loop within model_step! to synchronise changes across all agents after agent_step! dynamics have completed.

Agent sampling

The Wright-Fisher model of evolution shows us how we can sample a population of agents based on certain model properties. This is quite helpful in genetic and biology studies where agents are cell analogues.

Cellular Automata

A subset of ABMs, these models have individual agents with a set of behaviors, interacting with neighboring cells and the world around them, but never moving. Some examples of this model type are Conway's game of life, Forest fire and Daisyworld.

Mixed Models

In the real world, groups of people interact differently with people they know vs people they don't know. In ABM worlds, that's no different. Predator-prey dynamics (or more colloquially: Wolf-Sheep) implements interactions between a pack of Wolves, a heard of Sheep and meadows of Grass. Daisyworld is an example of how a model property (in this case temperature) can be elevated to an agent type.

Advanced visualization

The Sugarscape example shows how to animate, in parallel, one plot that shows the ABM evolution, and another plot that shows any quantity a user is interested in.

The Bacterial Growth example shows how to make customized shapes for your agents that change over time as the agents evolve.