Agent-based Modeling#

Agent-based Modeling (ABM) is a simulation method where the autonomous agents interacting with the environment (space) and/or each other by a set of rules.

The most obvious example of ABM is to simulate actions of non-player characters (NPCs) in computer games.

ABM is able to model heterogeneously, i.e. it does not require the environment to be well stirred (as opposed to ODEs), continuous (as opposed to to PDEs), nor need the characteristics of each kind of agents to be identical (as opposed to SSAs).

This makes ABM more flexible to model individual behaviors.

  • traffic jam

  • infectious disease spread

  • molecular interactions

Elements of ABM#

To use Agents.jl, we need to define:

  • The space where the agents live

  • The agents with self-defined properties.

  • The model to hold the space, the agents, and other parameters (called properties)

  • The stepping function step!() to tell how the model evolve.

Could I do ABM by myself?#

Yes, you can define the agents, rules and stepping functions from scratch, but it’s more convenient (and perhaps more performant) to use a test package like Agents.jl.

Resources#

Runtime environment#

import InteractiveUtils
InteractiveUtils.versioninfo()
Julia Version 1.11.2
Commit 5e9a32e7af2 (2024-12-01 20:02 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 4 × AMD EPYC 7763 64-Core Processor
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, znver3)
Threads: 2 default, 0 interactive, 1 GC (on 4 virtual cores)
Environment:
  JULIA_CI = true
  LD_LIBRARY_PATH = /opt/hostedtoolcache/Python/3.12.8/x64/lib
  JULIA_PROJECT = /home/runner/work/jl-abm/jl-abm/Project.toml
  JULIA_DEPOT_PATH = /home/runner/.julia:/opt/hostedtoolcache/julia/1.11.2/x64/local/share/julia:/opt/hostedtoolcache/julia/1.11.2/x64/share/julia
  JULIA_CONDAPKG_BACKEND = Null
  JULIA_NUM_THREADS = 2
  JULIA_LOAD_PATH = @:@v#.#:@stdlib
import Pkg
Pkg.status()
Status `~/work/jl-abm/jl-abm/Project.toml`
  [46ada45e] Agents v6.2.1
  [13f3f980] CairoMakie v0.12.18
  [a93c6f00] DataFrames v1.7.0
  [31c24e10] Distributions v0.25.115
  [86223c79] Graphs v1.12.0
  [76b6901f] OSMMakie v0.0.10
  [2913bbd2] StatsBase v0.34.4

This notebook was generated using Literate.jl.