LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
qsys_gm1.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2012-2026, QORE Lab, Imperial College London
3 * All rights reserved.
4 */
5#ifndef LINE_API_QSYS_GM1_H
6#define LINE_API_QSYS_GM1_H
7
8/**
9 * @file
10 * @ingroup api_qsys
11 * Exact mean response time of the G/M/1 queue.
12 *
13 * Templated port of matlab/src/api/qsys/qsys_gm1.m, cross-checked against
14 * jar/src/main/java/jline/api/qsys/Qsys_gm1.java. The two agree on W; the JAR
15 * additionally reports rhohat = 0, whereas MATLAB returns W alone. The port
16 * follows MATLAB and returns the single value.
17 *
18 * W = 1/(1-sigma)/mu
19 *
20 * sigma is the load seen at arrival instants, i.e. the root in (0,1) of
21 * sigma = A*(mu(1-sigma)) with A* the Laplace transform of the interarrival
22 * time. It is an input here, so the function itself is pure field arithmetic
23 * and exact for T = Rational.
24 */
25
27#include "line/num/number.h"
28
29namespace line {
30namespace qsys {
31
32/**
33 * @brief Exact mean response time of the G/M/1 queue.
34 *
35 * @param sigma load at arrival instants, 0 <= sigma < 1
36 * @param mu service rate
37 * @return mean response time W
38 */
39template <class T>
40T qsys_gm1(const T& sigma, const T& mu) {
41 const T one = num_traits<T>::from_int(1);
42 detail::require_no_pole(T(one - sigma), "qsys_gm1");
43 return one / (one - sigma) / mu;
44}
45
46} // namespace qsys
47} // namespace line
48
49#endif // LINE_API_QSYS_GM1_H
T qsys_gm1(const T &sigma, const T &mu)
Exact mean response time of the G/M/1 queue.
Definition qsys_gm1.h:40
Number-type abstraction for the templated API port.
Shared return type and arithmetic helpers for the templated qsys port.