agent-based modeling, system dynamics, python, bptk, bptk-py, sddsl, rust, pyodide, browser, xmile, smile, stella, ithink
Business Prototyping Toolkit
System Dynamics and Agent-based Modeling In Python
The Business Prototyping Toolkit for Python (BPTK-Py) is a computational modeling framework that enables you to build simulation models using System Dynamics (SD) and/or agent-based modeling (ABM) natively in Python and manage simulation scenarios with ease.
The objective of the framework is to let the modeller concentrate on building simulation models, by providing a seamless interface for managing model settings and scenarios and for plotting simulation results.
Models run on a compiled Rust engine where speed matters, and on pure Python everywhere else — including inside a browser. Many pages of this documentation run that way: where a page offers a slider or a dropdown, the plots recompute in front of you, with nothing installed.
Main Features
- System Dynamics in Python. Build stocks, flows and converters directly in Python with the SD DSL — including multidimensional models.
- Agent-based and hybrid models. Write agent-based models natively, or combine both techniques in a single hybrid model.
- A compiled Rust engine. SD models run on a Rust engine that ships pre-compiled inside the wheel — nothing to install, nothing to configure. Choose it per run, per session or per server; anything it cannot express falls back to the Python engine automatically. See Execution Backends.
- Runs in a browser. BPTK installs into Pyodide and runs on WebAssembly, so a model can be published as a page rather than as a notebook someone has to install first. The Python engine is the one that runs there — see Installation and Limitations.
- XMILE models become Python. The framework includes a compiler for transpiling System Dynamics models conforming to the XMILE standard into Python code, so a model built in a visual environment such as iseesystems Stella can be used independently in Python.
- Results are ordinary data. Simulations return Pandas dataframes, plotting is Matplotlib, and model settings and scenarios live in JSON files that the framework loads for you — which makes interactive modeling, coding and testing painless, especially in a reactive notebook environment such as marimo.
Getting Started
The best way to get started with BPTK is to read our Quickstart. You might also like the System Dynamics Tutorial
BPTK was also used to build our implementation of the infamous Beer Distribution Game. Our model library contains simulation models of the Beergame in both System Dynamics and Agent-based versions. It also contains an illustration of how to train reinforcement-learning algorithms to play the Beer Distribution Game.
You can play the game online at beergame.transentis.com
Currently we are working on an Enterprise Digital Twin for transentis. You can find the simulation part of the digital twin in our model library
Getting Help
BPTK-Py is developed and maintained by transentis labs. Currently the main developers are Dr. Oliver Grasl and Markus Bähring, former contributors include Dionysios Basdanis, Ahmed Eldably, Jeremy Funk, David Granzin and Dominik Schröck.
transentis runs online events and trainings on business prototyping throughout the year — the current programme is at academy.transentis.com.
The best place to ask questions about the framework is support@transentis.com, we are always happy to help.
Contents
- Architecture of the BPTK Framework
- Scenarios in Depth
- Accessing Raw Simulation Results
- Advanced Plotting Features
- Configuration of a BPTK Instance
- Execution Backends
- A Simple Python Library For System Dynamics
- SD DSL Functions
- Creating User-defined Functions in SD Models
- SD DSL: Under The Hood
- Multidimensional SD DSL
- The Mathematics of the SD DSL
- Working with XMILE Models
- Bass Diffusion Model. The classic Bass Diffusion Model that is used to explain the dynamics of introductiong a new product or service into a market.
- Beer Distribution Game. Computational notebooks, simulation models and AI training algorithms that explore the beer distribution game in depth.
- Competitive Pricing Dynamics A neat little model that can be used to understand pricing dynamics.
- Customer Acquisition. A model that analyses the effects of referral marketing on customer acquisition.
- Enterprise Digital Twin. A simulation of a professional service firm that forms part of the transentis Enterprise Digital Twin. This is work in progress.
- Make Your Professional Service Firm Grow. A model that analyses growth strategies in professional service firms.
- SD DSL - Introduction
- SD DSL - Part 1: Growth Strategies
- SD DSL - Part 2: A Model To Analyse Game Strategies
- SD DSL - Part 3: Reaching the Easy Cash Target
- SD DSL - Part 4: Reaching the Expert Cash Target
- SD DSL - Try It Yourself – the finished model with two sliders, the one page of this chapter that runs in your browser
- XMILE - Introduction
- XMILE - Part 1: Growth Strategies
- XMILE - Part 2: A Model To Analyse Game Strategies
- XMILE - Part 3: Reaching the Easy Cash Target
- XMILE - Part 4: Reaching the Expert Cash Target
- System Archetypes. System archetypes are basic patterns of behaviour of a system. The model library provides System Dynamics models and dashboards to gain a deeper understanding of the archetypes and of how to model them.