A C++ library for simulating stochastic systems using the Doob–Gillespie algorithm.
Note
Developed as an assignment for the Selected Topics in Programming (sP) course at Aalborg University (AAU).
Important
All requirements defined as part of the description of the assignment have been fulfilled! Additionally, the examples
directory provides usage examples of the library using three different models (abc, circadian_rhythm, and seihr).
- C++23-compatible compiler
- CMake ≥ 3.31
- Python 3.10 (with NumPy and matplotlib for plotting with
matplotlib-cpp
)
mkdir build && cd build
cmake ..
cmake --build .
├── cmake/ # cmake files for compiling test libraries
├── examples/ # Demonstration of the simulation library
├── external/ # External libraries
├── include/ # Public headers for the library
├── output/ # Graphs and plots
├── src/ # Simulation library implementation
├── tests/ # Unit tests and benchmarks
The following set of requirements are shortened versions of the requirements provided with the assignment description.
- Overload C++ operators for intuitive reaction rule syntax.
- Support text and DOT-format output for reaction networks.
- Implement a generic symbol table with error handling.
- Simulate reactions using the Doob–Gillespie algorithm.
- Include ABC, circadian rhythm, and SEIHR example models.
- Output time-series data for plotting trajectories.
- Allow custom observer functions or lazy evaluation.
- Enable parallel execution for multiple simulations.
- Provide unit tests for all core components.
- Benchmark performance for different simulation setups.
Peak hospitalization values for populations of sizes NNJ and NDK (recorded through single run of seihr_estimation.cpp
):
- NNJ H-peak: 118
- NDK H-peak: 1221
Average estimated hospitalization peak for running seihr_multiple.cpp
:
- Estimated average H-peak: 3.62