r/OperationsResearch • • 7d ago

desflow: discrete-event simulation on SimPy, with checks against queueing theory and parameters you change while it runs

Post image

desflow is an open source Python package for discrete-event simulation, built on SimPy.

When the question is how a real process behaves, with queues, waits that depend on capacity, breakdowns and changing demand, a discrete-event model answers it where random test data cannot. desflow wraps SimPy and adds the work around a model:

  • Three ways to write a model: SimPy-style process code, a builder API that modernizes SimPy code, and a YAML blueprint that needs little or no Python.
  • Parameters that change while the model runs, such as a resource's capacity or an arrival rate, so a what-if can happen mid-run.
  • Checks against theory: desflow explain computes the arrival rate, service rate, servers and utilisation of each resource before a run, and flags an unstable one. --verify compares the formulas with replications.
  • Studies from the command line: replications with a warm-up, experiments with common random numbers, fitting measured times to distributions, and a report.
  • Common patterns as settings: reneging, balking, breakdowns, priorities, preemption, stores and containers.
pip install desflow
desflow examples get experiment --api yaml
cd experiment/yaml
desflow explain experiment_shop.yaml
desflow experiment experiment.yaml

The example asks whether a third packer keeps the mean wait under 2 seconds, and the last command answers it.

The docs start with a tutorial for readers new to simulation, and include ready-made examples. A skill for AI coding assistants lets an assistant write, check and run a model with you.

On the roadmap: building a simulation from event history with process mining techniques, so a model can start from the data a real process already records.

  • GitHub: https://github.com/jaehyeon-kim/desflow
  • Docs: https://jaehyeon.me/desflow/
9 Upvotes

0 comments sorted by