Agents.jl: agent-based modeling framework in Julia

Agent-based modeling involves designing a system of autonomous agents that interact based on a set of given rules (Grimm et al., 2006). It is used for studying complex systems whose behavior cannot be easily identified using classical mathematical approaches. Agent-based modeling provides a bottom-up approach for studying complex systems, whereas analytical models have a top-down one (Bonabeau, 2002). The two approaches are complementary and they both can benefit from insights that the other approach contributes. Analytical models make many simplifying assumptions about the systems they study. This results in systems that are tractable and lead to clear conclusions. Agent-based models, on the other hand, are more difficult to make sense of because they relax many assumptions of equation-based approaches. This is at the same time an advantage of agent-based models because it allows observing the effect of agent and environment heterogeneity and stochasticity, which can change a model’s behavior (Farmer & Foley, 2009). Agent-based modeling is a particularly important tool for studying complex systems where a system’s behavior cannot be predicted and has to be explored.

Agent-based modeling provides a bottom-up approach for studying complex systems, whereas analytical models have a top-down one (Bonabeau, 2002).The two approaches are complementary and they both can benefit from insights that the other approach contributes.Analytical models make many simplifying assumptions about the systems they study.This results in systems that are tractable and lead to clear conclusions.Agent-based models, on the other hand, are more difficult to make sense of because they relax many assumptions of equation-based approaches.This is at the same time an advantage of agent-based models because it allows observing the effect of agent and environment heterogeneity and stochasticity, which can change a model's behavior (Farmer & Foley, 2009).Agent-based modeling is a particularly important tool for studying complex systems where a system's behavior cannot be predicted and has to be explored.
There are currently several agent-based modeling frameworks available (notable examples are NetLogo (Wilensky, 1999), Repast (North et al., 2013), MASON (Luke, Cioffi-Revilla, Panait, Sullivan, & Balan, 2005), and Mesa (Masad & Kazil, 2015)), but not for the Julia language, a new language designed with the needs of scientific computing in mind.Julia provides a combination of features that have historically been mutually exclusive.Specifically, languages that were fast to write, such as Python, were slow to run.And languages that were fast to run, such as C/C++, were slow to write.The combination of speed, expressiveness, and support for interactive computing makes Julia a desirable choice for scientific purposes.Agent-based models can involve hundreds of thousands of agents, each performing certain computations at each time step, thus speed is essential.Agents.jl is the first high-performance agentbased modeling framework to be written in Julia, and offers key advantages relative to the existing frameworks in other languages.First, unlike NetLogo, Agents.jluses a general-purpose language rather than custom one, which reduces the learning curve and unifies the modeling and analysis language.Second, Julia is an easy to learn and easy to write language, unlike Java that is used for Repast and MASON, and provides a REPL (Read-Eval-Print-Loop) to build and analyze models interactively.Third, Julia is fast to run, unlike Python, which is used for Mesa (see Figure 1).This can be important in large agent-based models.

Features
• Built-in 2D and 3D regular grids with Moore and von Neumann neighborhoods and periodic edges.• Automatic data collection into a "DataFrame".
• Automatic aggregation of collected data with user defined functions.
• Automatic aggregation of raw outputs with user-defined summary statistics.
• Running and aggregating simulation replicates.
• Parallel computation of simulation replicates.

Figure 1 :
Figure 1: Speed comparison of a version of the "forest fire" model in Agents.jlvs Mesa.The same implementation of the model in Agents.jl(originally taken from Mesa's example and then reimplemented in Agents.jl)shows more than 8x speed gain.See the documentation for more details.The comparison was performed on a Windows machine with a i7-6500U CPU and 16 GB of RAM.
Agents.jl allows users to only think about what needs to happen during each step of their model, and the rest will be managed by the framework.Future development can include building a GUI to help users with less programming knowledge, and implementing real-time visualization of simulations.The documentation contains a tutorial and several example agentbased models to demonstrate the features and workflows supported by the package.