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.
The simplest, and most thoroughly discussed example we have is Schelling's segregation model. Here, you will learn how to create an agent, define its actions, collect data from an experiment, plot results, save the model to a file and even how to set up multiple experiments in parallel.
Opinion spread is another all-round showcase of these topics, with some interesting, yet more complicated dynamics.
There are many things to learn in the ABM space. Here are some of the more common ones Agents.jl covers.
Choosing what kind of space your agents occupy is a fundamental aspect of model creation. Agents.jl provides a number of solutions, and the ability to create your own.
Maybe you don't need a space? The Wright-Fisher model of evolution is a good example to take a look at first to see if you can solve your problem without one.
Making a discrete grid is perhaps the easiest way to conceptualise space in a model. 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.
A more complex, but far more powerful space type is something we call
ContinuousSpace. In this space, agents generally move with a given velocity and interact in a far smoother manner than grid based models. The Flock model is perhaps the most famous example of bottom-up emergent phenomena. Something quite topical at present is our Continuous space social distancing for COVID-19 example. Finally, an excellent example of what can be done in a continuous space: Bacterial Growth.
Perhaps geographical space is not so important for your model, but connections between agents in some other manner is. A
GraphSpace may be the answer. SIR model for the spread of COVID-19 showcases how viral spread may occur in populations.
Using graphs in conjunction with grid spaces is also possible, we discuss this in one of our integration pages: Social networks with LightGraphs.jl.
Finally, 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.
Pathfinding.Pathfinder system (using the A* algorithm) provides automatic path-finding for agents with a variety of options and metrics to choose from. We have two models showcasing the possibilities of this method: Maze Solver and Mountain Runners.
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 HK (Hegselmann and Krause) opinion dynamics model: 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.
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.
The lower portion of the Schelling's segregation model page deals with some advanced topics like how one can run many examples in parallel to get ensemble averages of many similar model runs. In addition to this, it explores ways of searching parameter ranges of your model to fine-tune inputs.
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. Two famous examples of this model type are Conway's game of life and Daisyworld.
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.
One of the later sections of the Schelling's segregation model page gives an example of how models can be saved to/loaded from files and a possible use case for the same.
One major difference between Agents.jl and other ABM frameworks is how integrated it is to the greater ecosystem of the Julia language and by extension the tools one can apply in their models. Take a look at some of the more advanced walkthroughs in the Ecosystem Integration page of this documentation for details.