Hi everyone,
we are happy to announce v6 of Agents.jl. This could well be the most major-est of Agents.jl major changes. We also hope that this will be last major increment of Agents.jl version, or at least, the last one in the foreseeable future.
We will also be using this Discourse post to post further useful update messages for Agents.jl, so feel free to subscribe here for future updates (we are stopping the REPL messages!).
This new release futures a true plethora of improvements, bugfixes, performance enhancements, and more, a summary of which you can find in the changelog. In this post I will only summarize the most noteworthy features!
Major player in making this release possible is @Tortar who contributed lot’s of new features and performance improvements! Thanks @Tortar!
AgentBasedModel
API
Agents.jl now defines a standard interface for what quantifies as an “agent based model” (ABM). Other developers may hook up into the interface to create new model types. A model type only governs how the time evolution of the ABM takes place. Hence, the time evolution “functions” (the stepping functions) are now part of the model struct, and are not given as arguments to step!
. This change was made to 1) be more harmonious with the rest of dynamic modelling packages of Julia such as DifferentialEquations.jl or DynamicalSystems.jl (in fact, the AgentBasedModel
API was designed to be nearly identical to the DynamicalSystem
API). But also 2) to orthogonalize the time evolution with all other Agents.jl features, such as e.g., data collection or movement of agents in a space or searching for nearby agents, etc. Hence, all of these orthogonal features can be used out of the box for a new type of agent based model.
This is particularly useful for developers of other agent based models such as Vanaha.jl (@sfuerst) or CellBasedModels.jl (@gatocor). We believe that it is possible now to integrate these packages directly with the rest of Agents.jl (should the developers wish so), taking advantage of performance enhancements that have been put in place over the years in Agents.jl for e.g., filtering or neighborhood searches, or taking advantage of the flexible Agents.jl data collection, or the existing plotting and GUI infrastructure (all of these things are orthogonal to the AgentBasedModel
API).
Generic event queue ABM
To test drive this new API we developed a completely different ABM than the “standard” one that has been the only option in Agents.jl in all previous versions. This new “event queue” ABM operates in continuous time, in contrast to the “standard” ABM that operates in discrete time (or steps).
The event queue ABM is similar to what most people think as “Gillespie ABM”
but much more general. We considered several options for the backend of this
model, such as JumpProcesses.jl or other similar packages, but in the end
we decided to opt for generality of modelling possibilities and implemented
a simple event queue system, where events representing possible agent actions
are pushed into a continuous time queue and triggered when their time comes.
Currently the exact configuration for this event queue abm is in experimental status. We want to first see how the users interact with it to finalize its interface in the next minor release 6.1.
Multi-agent models: incredible inheritance logic and 0 performance downside
Arguably the strongest enhancement of existing features is at multi-agent
models which have multiple different types of agents.
Two highlights there are:
- The
@agent
macro now has incredible “inheritance” logic parallelizing
as much as possible object oriented inheritance when creating custom
structs representing user-defined agent types. The macro supports
all features of Julia’s nativestruct
definition. It supports inheritance
from another type, and subtyping of any supertype. - The new
@multiagent
macro allows defining multiple agent “types”.
These are not true individual Julia structs, but instead “shadow” a
single Julia struct. Yet, from the user’s side, they look identical to
how one would handle multi different structs. These “shadow types”
have 0 performance drops versus using a single agent type (in their
most optimal performance configuration). This is absolutely major,
as type instability was the main performance
hit we had at multi-agent models. The new comparison of performance differences
in multi-agent models can be found in the new docs.
Brand new Tutorial and updated documentation
To reflect the new features such as different types of ABMs or the new handling of multi-agent models we have fully revamped the tutorial and re-written it almost from scratch! We believe the new tutorial makes a better job of guiding a newcomer through all major Agents.jl features. The rest of the documentation has also been updated accordingly to reflect v6.
For more see the changelog!