CppyABM: An open-source agent-based modeling library to integrate C++ and Python


Agent-based modeling (ABM) has been extensively used to study the collective behavior of systems emerging from the interaction of numerous independent individuals called agents. Python and C++ are commonly used for ABM thanks to their unique features; the latter offers superior performance while the former provides ease-of-use and rich libraries in data science, visualization, and machine learning. We present the framework CppyABM that unifies these features by providing identical ABM semantic and development styles in both C++ and Python as well as the essential binding tools to expose a certain functionality from C++ to Python. The binding feature allows users to tailor and further extend a type or function within Python while it is originally defined in C++. Using CppyABM, users can choose either C++ or Python depending on their expertise and the specialty of the model or combine them to benefit from the advantages of both languages simultaneously. We provide showcases of CppyABM capabilities using several examples in computational biology, ecology, and virology. These examples are implemented in different formats using either C++ or Python or a combination of both to provide a comparison between the performance of implementation scenarios. The results of the example show a clear performance advantage of the models entirely or partly implemented in C++ compared to purely Python-based implementations.
QR Code: Link to publication