SkillAgentSearch skills...

QueueSim

QueueSim is a Python package for discrete event stochastic simulation of queueing networks. For Kendall models the performance indicators can also be computed using Erlang and Allen Cunneen approximation formulas.

Install / Use

/learn @A-Herzog/QueueSim

README

QueueSim

QueueSim is a Python package for discrete event stochastic simulation of queueing networks. For Kendall models the performance indicators can also be computed using Erlang and Allen Cunneen approximation formulas.

Installation

A PyPI package is not yet available. Just download and extract the zip package offered here.

The zip package also includes some example files (as plain Python files and as Jupyter notebooks) describing the base functions.

  • If you are using a Python environment which can show Jupyter notebooks, open and run any from the example_*.ipynb files in this directory.
  • If you are using plain Python, open and run any from the example_*.py files in this directory.
  • If you want to use a virtual environment just run init_venv_1.bat (Windows) or init_venv_1.sh (Linux) to create the environment and then run init_venv_2.bat (Windows) or init_venv_2.sh (Linux) from within the virtual environment to install all required modules.

Requirements

  • Python 3.9 or higher is needed to execute QueueSim.
  • scipy is used to generate pseudo-random numbers of some probability distributions
  • numpy is used by queuesim.statistics and in several example files.
  • pandas and scipy are used in queuesim.analytic.
  • The visualizations in the example Jupyter notebooks use matplotlib and seaborn.
  • The graphical network builder (see queuesim.graph.build_graph) uses networkx.

As long a you are not using the function for calculating analytic results, not using the Jupyter notebooks and not using the graph builder you will not need pandas, mathplotlib, seaborn and networkx.

You can install all required module by running pip install -r requirements.txt (or use a virtual environment, see installation notes above).

Main features of QueueSim

  • Building queueing networks on source code base (not only Kendall models)
  • Option to use any lambda expressions for inter-arrival and service times (lambda expression generators for the most common distributions are included)
  • Batch arrival and service is possible
  • Option to model impatience of the clients
  • Branching clients by conditions or by chance
  • Different service disciplines are available (FIFO, LIFO or user-defined priority formulas)
  • Automatic statistic recording
  • Erlang and Allen Cunneen classes for comparison of simulation and analytic results
  • Helper classes for parallel multi-process simulation
  • Can be compiled using Cython (pyx classes with type annotations for speed-up are included)

Usage examples

Example files

There is a number of py files and Jupyter notebooks that illustrate various functions of QueueSim:

Analytical calculations

Simulation

Very simple simulation models not using QueueSim

Simulation models

Complex simulation models

Queueing disciplines

Optimization

Overview of the main classes

The Simulator

class queuesim.Simulator

The Simulator class contains the code for event management and for running simulations. There is only one relevant method in this class: run()

import queuesim

simulator = queuesim.Simulator()
# Define stations here, link stations to each other and to the simulator
simulator.run()
# Process statistic results here

Stations

QueueSim offers 7 station types from which many types of queueing networks can be built: Source, Process, Delay, Decide, DecideCondition, DecideClientType and Dispose. While most stations have input and output connections, the Source station has only an output and the Dispose station only an input. All station types are defined in module queuesim.stations.

Source

Each model starts with one or more Source stations. At these stations clients enter the system.

import queuesim
import queuesim.stations

simulator = queuesim.Simulator()

count = 100_000  # Number of arrivals to be simulated
get_i = ... # string (to be evaluated) or lambda expression to generate inter-arrival times
source = queuesim.stations.Source(simulator, count, get_i)

next_station_in_queueing_network = ...

source.set_next(next_station_in_queueing_network)

(For helper functions to generate pseudo random number generators for the inter-arrival times see description of module queuesim.random_dist below.) Additionally there is an optional parameter getIB= in the constructor of the Source object by which variable arrival batch sizes can be defined.

Process

The Process station is the main component of every queueing model. Here is the queue and the

View on GitHub
GitHub Stars6
CategoryDevelopment
Updated4mo ago
Forks2

Languages

Jupyter Notebook

Security Score

87/100

Audited on Nov 26, 2025

No findings