LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
qsys_gig1_approx_heyman.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_GIG1_APPROX_HEYMAN_H
6#define LINE_API_QSYS_GIG1_APPROX_HEYMAN_H
7
8/**
9 * @file
10 * @ingroup api_qsys
11 * Heyman approximation of the mean response time of a G/I/G/1 queue.
12 *
13 * Templated port of matlab/src/api/qsys/qsys_gig1_approx_heyman.m,
14 * cross-checked against
15 * jar/src/main/java/jline/api/qsys/Qsys_gig1_approx_heyman.java (identical).
16 *
17 * W = rho/(1-rho)/mu * (ca^2+cs^2)/2 + 1/mu
18 *
19 * Algebraically the same expression as Allen-Cunneen, kept as a separate entry
20 * point because MATLAB exposes both. Pure field arithmetic, exact for
21 * T = Rational, and it reduces to M/M/1 at ca = cs = 1.
22 */
23
25#include "line/num/number.h"
26
27namespace line {
28namespace qsys {
29
30/**
31 * @brief Heyman approximation of the mean response time of a G/I/G/1 queue.
32 *
33 * @param lambda arrival rate
34 * @param mu service rate
35 * @param ca coefficient of variation of the interarrival time
36 * @param cs coefficient of variation of the service time
37 */
38template <class T>
39QsysResult<T> qsys_gig1_approx_heyman(const T& lambda, const T& mu, const T& ca, const T& cs) {
40 const T one = num_traits<T>::from_int(1);
41 const T two = num_traits<T>::from_int(2);
42 const T rho = lambda / mu;
43 detail::require_no_pole(T(one - rho), "qsys_gig1_approx_heyman");
44 const T W = rho / (one - rho) / mu * (num_pow_int(ca, 2) + num_pow_int(cs, 2)) / two + one / mu;
45 return {W, detail::rhohat_from_W(W, lambda)};
46}
47
48} // namespace qsys
49} // namespace line
50
51#endif // LINE_API_QSYS_GIG1_APPROX_HEYMAN_H
QsysResult< T > qsys_gig1_approx_heyman(const T &lambda, const T &mu, const T &ca, const T &cs)
Heyman approximation of the mean response time of a G/I/G/1 queue.
T num_pow_int(const T &base, unsigned e)
Integer power, valid in any field (no transcendental requirement).
Definition number.h:192
Number-type abstraction for the templated API port.
Shared return type and arithmetic helpers for the templated qsys port.
Return value of the qsys family, mirroring MATLAB's [W,rhohat] and the JAR's Ret.qsys.
Definition qsys_types.h:37