intro-open-sim

An introduction to building open Descrete-Event Simulation (DES) in Python

https://github.com/pythonhealthdatascience/intro-open-sim

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 15 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.0%) to scientific vocabulary
Last synced: 4 months ago · JSON representation ·

Repository

An introduction to building open Descrete-Event Simulation (DES) in Python

Basic Info
Statistics
  • Stars: 7
  • Watchers: 2
  • Forks: 2
  • Open Issues: 0
  • Releases: 2
Created about 1 year ago · Last pushed 6 months ago
Metadata Files
Readme Changelog License Citation

README.md

lite-badge Binder License: MIT Python 3.11+ ORCID: Alison Harper ORCID: Tom Monks ORCID: Amy Heather DOI

An introduction to Discrete-Event Simulation (DES) using Free and Open Source Software

Work in progress. This is tutorial was initially prepared for the Operational Research Society 12th Simulation Workshop in 2025 (SW25). It has been adapted from our template repository for sharing simpy models with JupyterLite. The SW25 tutorial paper is now open access CC-BY 4.0: https://doi.org/10.36819/SW25.004

🧑‍💻 1. Tutorial

We begin with two notebooks that introduce some basic concepts for creating DES in python:

  • 01_sampling.ipynb: Sampling from statistical distributions using numpy
  • 02_basic_simpy.ipynb: Creating simple simpy DES models that make use of numpy sampling

Your understanding of these is then tested in:

  • 03a_exercise1.ipynb: Exercise to testing understanding of the basics of simpy and numpy
  • 03b_exercise1_solutions.ipynb: Example solutions for the exercise

We then move on to some more advanced concepts, and create a full process model:

  • 04_111_model.ipynb: Full simpy process model, creating a model for a 111 call centre
  • 05_basic_results.ipynb: Collecting results from a single run by storing process metrics during a run and performing calculations at the end
  • 06a_basic_results_exercise.ipynb: An exercise to practice collecting results from a simpy model.
  • 07_experiments.ipynb: our approach to setting up a model for multiple replications, experimentation, and common random numbers
  • 07a_exercise.ipynb: An exercise to practice using an Experiment class with a model
  • 07b_solutions.ipynb Solutions to the Experiment exercises.
  • 08_full_model.ipynb: an extended version of the 111 call centre process. We also introduce a warm-up period
  • 09_time_weighted_calcs.ipynb: An alternative approach to collects results for queue length and resource utilisation.

🔧 2. Set-up

To run the notebooks in this tutorial, you can either run via your browser or locally...

2.1 Running notebooks within your browser

This tutorial has been set up to run on your browser without the need to install any components. This is achieved using Web Assembly technology i.e. JupterLite and xeus-python. A model notebook is downloaded to your local machine and all dependencies are pre-installed via conda-forge. The model then lives in the browsers cache. You can make changes to the model or create new files and these are persisted (until the browser cache is cleared).

To access this tutorial in your browser: https://pythonhealthdatascience.github.io/intro-open-sim/.

2.2 Running notebooks locally on your machine

2.2.1 Downloading the code

Either clone the repository using git or click on the green "code" button and select "Download Zip".

bash git clone https://github.com/pythonhealthdatascience/intro-open-sim.git

2.2.2 Installing dependencies and running JupyterLab

All dependencies can be found in binder/environment.yml and are pulled from conda-forge. To run the code locally, we recommend installing miniforge;

miniforge is FOSS alternative to Anaconda and miniconda that uses conda-forge as the default channel for packages. It installs both conda and mamba (a drop in replacement for conda) package managers. We recommend mamba for faster resolving of dependencies and installation of packages.

navigating your terminal (or cmd prompt) to the directory containing the repo and issuing the following command:

mamba env create -f binder/environment.yml

Activate the mamba environment using the following command:

mamba activate simpy_tutorial

You can then run the notebooks in content/ locally on your machine using JupyterLab. Issue the following command and JupyterLab will open in your browser. Notebooks are in the content/ directory.

jupyter-lab

📝 3. Citation

If the work is of use to you we would value a citation! Please cite the SW25 tutorial paper and the code repository.

bibtex @inproceedings{monks2025building, title={Building Healthcare Discrete-Event Simulation Models in Free and Open Source Software: An Introductory Tutorial}, author={Monks, Thomas and Harper, Alison and Heather, Amy and Mayne, Andrew and Mustafee, Navonil}, booktitle={Proceedings of the Operational Research Society Simulation Workshop 2025 (SW25)}, editor={Luis, M. and Harper, A. and Monks, T. and Mustafee, N.}, year={2025}, doi={10.36819/SW25.004}, url={https://doi.org/10.36819/SW25.004}, organization={Operational Research Society} }

bibtex @software{open_sim_tutorial, author = {Monks, Thomas and Harper, Alison and Heather, Amy}, title = {An introduction to Discrete-Event Simulation using Free and Open Source Software. }, month = oct, year = 2024, publisher = {Zenodo}, version = {v0.2.0}, doi = {10.5281/zenodo.13971859}, url = {https://doi.org/10.5281/zenodo.13971859}, }

🤝 4. Acknowledgements

We would like to thank the JupterLite and xeus-python developers for making this work possible. This discrete-event simulation focussed tutorial was based on the learning materials and template provided by Jupyterlite xeus-python demo and tutorial given at PyData 2023 by Jeremy Tuloup.

💰 5. Funding

STARS is supported by the Medical Research Council [grant number MR/Z503915/1].

Owner

  • Name: pythonhealthdatascience
  • Login: pythonhealthdatascience
  • Kind: organization

Citation (CITATION.cff)

# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: An introduction to Discrete-Event Simulation using Free and Open Source Software
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - given-names: Thomas
    family-names: Monks
    affiliation: University of Exeter
    orcid: 'https://orcid.org/0000-0003-2631-4481'
  - given-names: Alison
    family-names: Harper
    affiliation: University of Exeter
    orcid: 'https://orcid.org/0000-0001-5274-5037'
  - given-names: Amy
    family-names: Heather
    affiliation: University of Exeter
    orcid: 'https://orcid.org/0000-0002-6596-3479'
repository-code: >-
  https://github.com/pythonhealthdatascience/intro-open-sim
abstract: >-
  This is a STARS project being prepared for the Operational Research Society
  12th Simulation Workshop in 2025 (SW25).
keywords:
  - simpy
  - jupyterlite
  - python
  - discrete-event simulation
  - open science
  - reproducibility
  - deployment
  - model reuse
license: MIT

GitHub Events

Total
  • Watch event: 3
  • Delete event: 4
  • Push event: 32
  • Pull request event: 12
  • Fork event: 2
  • Create event: 7
Last Year
  • Watch event: 3
  • Delete event: 4
  • Push event: 32
  • Pull request event: 12
  • Fork event: 2
  • Create event: 7

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 0
  • Total pull requests: 14
  • Average time to close issues: N/A
  • Average time to close pull requests: less than a minute
  • Total issue authors: 0
  • Total pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 13
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 14
  • Average time to close issues: N/A
  • Average time to close pull requests: less than a minute
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 13
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
  • TomMonks (19)
Top Labels
Issue Labels
Pull Request Labels

Dependencies

.github/workflows/deploy.yml actions
  • actions/checkout v3 composite
  • actions/deploy-pages v4 composite
  • actions/setup-python v5 composite
  • actions/upload-pages-artifact v3 composite
  • mamba-org/setup-micromamba v1 composite
binder/environment.yml pypi
environment.yml pypi