Skip to main content

A Python package for PH/PH/c queueing systems

Project description

PhPh: A Python package for PH/PH/c queueing systems

PhPh is a Python package for evaluating PH/PH/c queueing systems.

Features

  • Available on PyPI.
  • Allows for evaluation of multiserver models containing any Phase-type (PH) inter-arrival and service-time distribution.
  • Returns fundamental performance metrics such as the expected waiting time, expected occupancy, and the probability of waiting longer than t units of time.
  • Users can choose to view the metrics observed by actual arriving customers or virtual Poisson arrivals.

Quick start guide

The following shows how to get quickly started with PhPh.

Installation

Download and install PhPh directly from PyPI.

pip install phph

Usage

Start by specifying the inter-arrival and service-time distributions.

#Import packages
import phph
import numpy as np

#Set the server capacity
servers = 5

#ARRIVAL PARAMETERS - Example of Erlang distribution

#Initial distribution
arrivalInitDistribution = np.matrix([[1,0]])

#Phase-type generator
arrivalGenerator = np.matrix([[-12,12],
                              [0,-12]])

#SERVICE PARAMETERS - Example of hyper-exponential distribution

#Initial distribution
serviceInitDistribution = np.matrix([[(1/3),(1/2),(1/6)]])

#Phase-type generator
serviceGenerator = np.matrix([[-2,0,0],
                              [0,-1,0],
                              [0,0,-6]])

Now, create the model object.

mdl = phph.model(arrivalInitDistribution,arrivalGenerator,
                 serviceInitDistribution,serviceGenerator,
                 servers)

We can now use the object mdl to return various performance metrics. In the following, we calculate the expected waiting time, the expected occupancy, and the probability of waiting.

#Expected waiting time 
print(mdl.meanWaitingTime())
#0.455024

#Expected occupancy
print(mdl.meanOccupancy())
#6.896811

#Probability of waiting
print(mdl.probWait())
#0.562802

Classes and methods

The following shows how to create the model and provides a list of all available performance metrics.

Model class

Create the model object with:

mdl = phph.model(arrivalInitDistribution,arrivalGenerator,
                 serviceInitDistribution,serviceGenerator,
                 servers)
  • arrivalInitDistribution is a NumPy row vector defining the initial distribution of the PH distribution associated with arrivals.
  • arrivalGenerator is a NumPy matrix defining the PH generator of the distribution associated with arrivals.
  • serviceInitDistribution is a NumPy row vector defining the initial distribution of the PH distribution associated with services.
  • serviceGenerator is a NumPy matrix defining the PH generator of the distribution associated with services.
  • servers is a non-zero positive integer and defines the number of servers in the queueing system.

Performance metrics

  • mdl.meanWaitingTime(). Returns the actual (i.e. observed by arriving customers) expected waiting time.
  • mdl.meanResponse(). Returns the actual expected total time in the system.
  • mdl.probWait(type="actual"). Returns the probability of waiting. Choose between "actual" (default) and "virtual" using the argument type.
  • mdl.probEmpty(type="actual"). Returns the probability that the system is empty. Choose between "actual" (default) and "virtual" using the argument type.
  • mdl.probK(k,type="actual"). Returns the probability of observing k customers in the system on arrival. Choose between "actual" (default) and "virtual" using the argument type.
  • mdl.waitDist(t,type="actual"). Returns the probability of waiting more than t time units. Choose between "actual" (default) and "virtual" using the argument type.
  • mdl.meanQueueLength(). Returns the expected length of the queue.
  • mdl.meanOccupancy(). Returns the expected occupancy.

Other output

  • mdl.localStateDist(k). Returns the local state distribution of level k.
  • mdl.localState(k). Returns the definition of the local state space of level k.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

phph-0.1.1.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

phph-0.1.1-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file phph-0.1.1.tar.gz.

File metadata

  • Download URL: phph-0.1.1.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for phph-0.1.1.tar.gz
Algorithm Hash digest
SHA256 503ba9dee282872348eff8963478366921ef016068f34d98a62fe82def54c345
MD5 bd6181966b60ca46f97802eeb09a3a86
BLAKE2b-256 b3a3b49e0f96aaf5a1c006d8e03c3cbf9a4cacb0605b3a70bc8e2d6ba42b38cb

See more details on using hashes here.

File details

Details for the file phph-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: phph-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 14.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for phph-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2a72e13fc062c6a7d332a0246e14e7c0c967f58fc11642fd28c479d451004a59
MD5 103242851cd39643da7dd3583723f640
BLAKE2b-256 869757581f6c7d851bfec6f23ecda32765c1a18ad2febdcd4fee123eb645db1a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page