FRAMEWORK.PY, STATS.PY, DATA.PY, and ANIMATION.PY are not available in this open repository anymore. Instead, you can download the updated and professionally maintained repository here: SCDA abm_framework
A framework for agent-based simulation. It covers grid-based simulations. This model is part of SCDA.
The model supports grid-based simulations and includes visualization and animation functionality. The module is continously extended to cover additional functionality. For example, I added the Moore neighbourhood as a neighbourhood option for grid-based ABM simulations. In a second step, the Neumann neighbourhood (easy addition) can be added, and then in addition other neighbourhood types as required.
Database directory contains sqlite3 database file that is meant for storing simulation results into database.
The data.py module provides functionality for executing queries in the database. data.py comprises a Database class and a Manager class. Database class facilitates connection to sqlite3 and potentially also mssql database. Manager class provides methods representing standardized queries for quickly implementing operations on the database that are of relevance to the ABM simulations supported by this package.
framework.py contains classes for modelling e.g. the simulation environment and the agents themselves.
stats.py provides visualization capabilities for visualizing simulation results.
config.py is a configuration file that e.g. allows for path adjustments or input parameter adjustments. It e.g. specifies the filepath of the sqlite3 database used to store simulation results.
animation.py provides animation capabilities for animating simulation results and their trajectory throughout time.
I gave some basic introductions covering the differences between simulation methods as well as basic agent-based simulation modeling in Python - and you can find these introductions on my blog:
- Simulation methods for SCM analysts
- Developing a simple agent-based simulation model in Python
- A simple agent-based simulation run visualized with matplotlib in Python
- Agent-based modeling in Python
Agent-based simulation is a methodology that applies compulation models for simulating interactions between autonomous agents as well as their actions. It can be combined with other simulation methodes, e.g. with monte-carlo simulation methodology for consideration of stochasticity. But it can e.g. also be combined with discrete-event simulation methodology. For example, processes "going on" inside agents can be modelled and simulated with discrete-event simulation. Below is an overview and comparison of the main simulation methodes.
Agent-based simulation models are simulation models that focus that describe microscopic interactions between agents. By adding, removing, and manipulating these microscopic interactions, changes to macroscopic system behaviour are analyzed. ABM is applied to understand the emergence of complex macropic phenomena.
Agents have attributes and the interactions between agents are described by logics and strategies. This framework provides a toolkit for building agent-based models. It also provides pre-defined database structures and visualization as well as animation functionality. You can use this to implment your own agent-based simulation. Demo models are provided in the demos folder.
Agent-based simulation models are applied in many different areas. This includes the domains listed below:
- Biology
- Epidemology
- Business
- Technology
- Network technology
- Social sciences
- Economics
- Autonomous driving
This repository comprises a demos folder. In there you will find, dynamically added over time, a series of simulation examples.
This framework supports standardized agent-based simulation animations and visualizations. The scope of animation and visualization templates is dynamically expanded overtime, but initially comprises at least:
- agent attribute value trajectories for all agents individually, a specific subset of agents, or all agents on average
- average attribute value distribution over time, for a specific population of agents and a list of relevant agent attributes
- grid location plots and animations for all agents or a set of agent population groups
- attribute value density distribution across the grid, in the form of plots and animations, for specified attributes
You can see some exmaples below: