Skip to main content

General purpose agent-based modeling library to integrate C++ and Python

CppyABM is a free open-source header-only library that enables agent-based modeling by providing essential tools in both C++ and Python as well as mixing both in a single model. The modeling in both C++ and Python follows similar semantics and style. Therefore, a model developed in one languages can be conveniently transferred to another. In addition, CppyABM provides binding tools to specifically expose certain parts of a model written in C++ for further development in Python. This enables users to take the advantage of both languages simultaneously. CppyABM uses RTvisualize for browser-based real-time visualization. The link for the complete documentation. See examples folder as showcase of CppyABM utility. Alt Text

Install

For an extended version of the available installation options, see documentation.

For Python development

Using pip manager (in case any error occured, install using the next option):

$ pip install --upgrade cppyabm

Or, download the package and in the root folder, command:

$ python3 setup.py install

For C++ development

The library can be also installed solely for C++ development using, $ git clone https://github.com/janursa/CppyABM $ cd CppyABM && mkdir build && cd build $ cmake .. -DCPP=TRUE $ make install

For Python-C++ development

In order to create a mixed model using both languages of C++ and Python, in addition to CppyABM, pybind11 needs to be installed. It can be either seperately installed according to the instruction given on pybind11-installation, or can be included in a project using Cmake. See documentation.

Docker

The Docker image "janursa/cppyabm" provides an environment where the lastest version of CppyABM, pybind11, and RTvisualize are installed. The following command will land you in a container with all set ready for development.

$ docker run --rm -t -i janursa/cppyabm /bin/bash

To run the examples with visualization, two seperate bash of same container needs to be executed; one for running the model and another for visualization. To do so,

[1]$ docker run -d -p 1818:8050 -t janursa/cppyabm /bin/bash

Runs the image in a detached mode and maps the port number 8050 (container) to 1818 (host). Then,

[2]$ docker ps

Get the CONTAINER ID,

[3]$ docker exec -it container_id bash

Once in the container, navigate to the example folder and run the model. In parallel, open another bash using the exact command as [3]. But, this time run the monitor_script.py for visualization. It will output the graphs to the port http://0.0.0.0:1818.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

To cite

Cite this library using DOI.

Authors

  • Jalil Nourisa

Familiarity with pybind11 is helpful during the Python binding process.

Contributing to CppyABM

In case of encountering a problem, pls report it as an issue or contant the author (jalil.nourisa@gmail.com)

Metadata

Release files for cppyabm 1.0.21

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cppyabm 1.0.21
File Size Uploaded Provenance Actions
cppyabm-1.0.21.tar.gz 4.0 kB Without provenance Details for cppyabm-1.0.21.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cppyabm 1.0.21
File Interpreter ABI Platform Actions
cppyabm-1.0.21-cp37-cp37m-macosx_10_9_x86_64.whl CPython 3.7 CPython 3.7 pymalloc macOS 10.9+ x86-64 Details for cppyabm-1.0.21-cp37-cp37m-macosx_10_9_x86_64.whl

Total release size: 167.7 kB

Release files / cppyabm-1.0.21.tar.gz

Download URL cppyabm-1.0.21.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e171c100104bc14df1df5748a4cc953de45e2713ae199d3c3cab146044dd85c5
BLAKE2b-256 checksum
How to use checksums
e91947027e89b4a0d9d3cb47dede602db83f010c0392131f96c138946b6b6900
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.8.2 requests/2.24.0 setuptools/58.0.4 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.9

Release files / cppyabm-1.0.21-cp37-cp37m-macosx_10_9_x86_64.whl

Download URL cppyabm-1.0.21-cp37-cp37m-macosx_10_9_x86_64.whl
Size 163.7 kB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
7c046a123f7094b857b4e4355b087a24d51a2e3f4d3e35bed07ca24f2b191498
BLAKE2b-256 checksum
How to use checksums
a325c476d23742a9ef1dc976528addad67d52653c1315b03fd2be2aa88d33921
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.8.2 requests/2.24.0 setuptools/58.0.4 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.9

Security for cppyabm 1.0.21

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page