Skip to content

haolamnm/ssir-module

Repository files navigation

The SSIR Module

Simulation Demo

You are viewing a simulation where 3 cases initiate an outbreak across a population of 90.000 people.

Overview

I started this side project to explore the potential of using C++17 code as the foundation for a Python module. The idea is to develop a simulation program that requires high performance.

The model simulates a grid where individuals move between different states: Susceptible, Incubated (exposed), Infected, Recovered, and Dead. You can use matplotlib in Python to visualize the statistics over time. See examples/visualize.py.

I've learned how to combine C++17 code with Python using pybind11. This setup provides the efficiency of C++ and the flexibility of Python. I also gained experience organizing a project with bindings, stub files, and writing basic CMake configurations to build and expose C++ modules to Python.

This model is mainly inspired by Outbreak.

How to Run

After building the project with CMake, you can try it out using the Python scripts in the examples/ folder. The module is compiled into a .pyd file (on Windows), which you can import in Python using the helper file examples/windows.py.

Notes

This project is still in progress. I'm mainly using it as a learning tool to understand how C++ and Python can work together, how bindings are written, and how to structure a small cross-language codebase.

Have a nice day!

About

[3004] A C++17-powered Python module for simulating the spread of disease in a grid-based population. Built with pybind11 and CMake.

Topics

Resources

Stars

Watchers

Forks

Contributors