Skip to main content

A python simulation engine for System Dynamics & Agent based models

Project description

Business Prototyping Toolkit for Python

System Dynamics and Agent-based Modeling in Python

The Business Prototyping Toolkit for Python (BPTK_Py) provides you with a computational modeling framework that allows you to build and run simulation models using System Dynamics and/or agent-based modeling and manage simulation scenarios with ease.

It gives you the power to quickly build simulation models in Python. If you use the framework with Jupyter Notebooks, you to create beautiful plots of the simulation results - or just run the simulation in Python and use the results however you wish.

The framework also includes our sdcc parser for transpiling System Dynamics models conforming to the XMILE standard into Python code. This means you can build models using your favorite XMILE environment (such as iseesystems Stella and then experiment with them in Juypter.

Main Features

  • The BPTK_Py framework supports System Dynamics models in XMILE Format, native SD models, Agent-based models and hybrid SD-ABM-Models
  • The objective of the framework is to provide the infrastructure for managing model settings and scenarios and for running and plotting simulation results, so that the modeller can concentrate on modelling.
  • The framework automatically collect statistics on agents, their states and their properties, which makes plotting simulation results very easy.
  • All plotting is done using Matplotlib.
  • Simulation results can also be returned as Pandas dataframes.
  • The framework uses some advanced Python metaprogramming techniques to ensure the amount of boilerplate code the modeler has to write is kept to a minimum.
  • Model settings and scenarios are kept in JSON files. These settings are automatically loaded by the framework upon initialization, as are the model classes themselves. This makes interactive modeling, coding and testing very painless, especially if using the Jupyter notebook environment.

Getting Help

The first place to go to for help and installation instructions is the online documentation.

You should also download the BPTK_Py tutorial, which contains the sample models and Jupyter notebooks referenced in the online documentation. You can download the tutorial from our website.

BPTK_Py is developed and maintained by transentis Labs GmbH.

For questions regarding installation, usage and other help please contact us at: support@transentis.com.

Changelog

0.6.4

  • New methods model.begin_round and model.end_round. Model.act is now obsolete
  • Added a bptk.train_simulation method which runs simulation in episodes to allow training
  • Small changes to the scenario definition syntax (JSON) for agent-based models
  • Renamed the progressBar attribute of bptk.plot_simulation to progress_bar

0.6.3

  • Bug fix to bptk.run_simulations: the parameter AgentPropertyTypes was not handled correctly

0.6.2

  • Bug fix: all agents were receiving the same properties object on initialization. Fixed by using Python's copy module. Each agent now receives a deep copy. Changes on one agent's properties do not interfere with changes on other agents' properties anymore.

0.6.1

  • Bug fix: valuate_function was renamed to evaluate_equation in 0.6.0 , but not everywhere

0.6.0

  • New functionality: you can now define a function in Python and use it within an SD model.

0.5.3

  • First Release of documentation for Readthedocs. Check it out at: http://bptk.transentis.com
  • You can now run AB models with a custom data_collector without plotting using "run_simulations()". This allows you to create custom data collectors that do not emit data back to BPTK, e.g. a streaming data collector
  • Fixed an issue regarding absolute and relative imports in the Model class
  • Various improvements to ABM module

0.5.2

  • Models now have their own act method, to allow updating of dynamic properties.
  • Internal changes to event handling in agents
  • Fixed a bug regarding lookup handling.

0.5.1

  • Bugfix for ABM module

0.5

  • Large improvements for the Agent Based Modeling component! Main changes:
  • Agents can now have properties.
  • Agent properties can be set via the JSON config file. Properties can be accessed using dot-notation, i.e. agent.property
  • The necessary property get/set methods are added automatically using Python metaprogramming facilities - this keeps the code that needs to implemented by the modeler to a mimimum.The same is true of model properties - these can now also be accessed using dot-notation.
  • Statistics for properties are automatically collected and can be plotted using the plot_scenarios method. Currently the following statistics are collected: total, min, max, mean.

0.4.1

  • Bugfix in Model class: dt param was not properly instantiated

0.4.0

  • Framework for Agent Based models
  • Framework for defining System Dynamics models in code with less effort. No need for complex recursive calls anymore. Simply define your equations as easy as element.equation = element * anotherElement. Example in the tutorial!
  • Simplify API: use comma-seperated values to specify scenarios/scenario managers or equations, no need for Python lists anymore!
  • Many more internal improvements under the hood.

0.3.7

  • PULSE functions can now be defined within Jupyter environment. Just use the new pulse_function_create(scenarios,scenario_managers) method and be surprised.
  • Cleaner method for strategy simulation. Now running stepwise, not using a complex while loop anymore. Improves readability tremendously!
  • Optimize imports using init.py properly.
  • Correct handling of decimal dt values within simulator.

0.3.6.1

  • Bugfix to reduce size of the package

0.3.6

  • Now interpreting strategies that modify at '0' as constants values and overwrite the constants
  • Use DT of simulation model

0.3.5.5

  • Fixed a bug that prevented from plotting properly when giving multiple scenario managers where one of them did not store the given scenario name

0.3.5.4

  • Monitoring of Scenario JSON files:
  • Reload scenarios upon change (also works if Scenario manager spreads over multiple files)
  • Find added scenarios
  • Merge base values spread over multiple files

0.3.5.3

  • horizontal lines in graphs to improve readability
  • Improvements to readme file
  • Small bug fixes

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

BPTK_Py-0.6.5.tar.gz (376.9 kB view details)

Uploaded Source

Built Distribution

BPTK_Py-0.6.5-py3-none-any.whl (421.2 kB view details)

Uploaded Python 3

File details

Details for the file BPTK_Py-0.6.5.tar.gz.

File metadata

  • Download URL: BPTK_Py-0.6.5.tar.gz
  • Upload date:
  • Size: 376.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.20.1 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.7.0

File hashes

Hashes for BPTK_Py-0.6.5.tar.gz
Algorithm Hash digest
SHA256 36b6899c8471b600d1066bfd11ef7d4f756a6dcf087cbaab18e0a5e547636988
MD5 115399b54d6dd2a3b7577579e97c6c0b
BLAKE2b-256 98a6b13ebfa000f4b5ac0c79b3b7bedb09d5e99639cfa917baeb7db90600179f

See more details on using hashes here.

File details

Details for the file BPTK_Py-0.6.5-py3-none-any.whl.

File metadata

  • Download URL: BPTK_Py-0.6.5-py3-none-any.whl
  • Upload date:
  • Size: 421.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.20.1 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.7.0

File hashes

Hashes for BPTK_Py-0.6.5-py3-none-any.whl
Algorithm Hash digest
SHA256 b2df9097815d7e5e63f06da0cdc1aa8a2b59095828253e676d2c7c334798f0fd
MD5 dabe6f08a67945af0902e9b22e9d4ab5
BLAKE2b-256 1c9e903cf707e92c5e937a1cbe619871e44bb67e47d9f084b8e5279f0e287e3e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page