LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
qsys_gig1_approx_allencunneen.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_ALLENCUNNEEN_H
6#define LINE_API_QSYS_GIG1_APPROX_ALLENCUNNEEN_H
7
8/**
9 * @file
10 * @ingroup api_qsys
11 * Allen-Cunneen 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_allencunneen.m,
14 * cross-checked against
15 * jar/src/main/java/jline/api/qsys/Qsys_gig1_approx_allencunneen.java
16 * (identical).
17 *
18 * W = (rho/(1-rho))/mu * (cs^2+ca^2)/2 + 1/mu
19 *
20 * Only squares of the coefficients of variation appear, so this is pure field
21 * arithmetic and exact for T = Rational. 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 Allen-Cunneen approximation of the mean response time of a G/I/G/1
32 * queue.
33 *
34 * @param lambda arrival rate
35 * @param mu service rate
36 * @param ca coefficient of variation of the interarrival time
37 * @param cs coefficient of variation of the service time
38 */
39template <class T>
40QsysResult<T> qsys_gig1_approx_allencunneen(const T& lambda, const T& mu, const T& ca,
41 const T& cs) {
42 const T one = num_traits<T>::from_int(1);
43 const T two = num_traits<T>::from_int(2);
44 const T rho = lambda / mu;
45 detail::require_no_pole(T(one - rho), "qsys_gig1_approx_allencunneen");
46 const T W = (rho / (one - rho)) / mu * ((num_pow_int(cs, 2) + num_pow_int(ca, 2)) / two) +
47 one / mu;
48 return {W, detail::rhohat_from_W(W, lambda)};
49}
50
51} // namespace qsys
52} // namespace line
53
54#endif // LINE_API_QSYS_GIG1_APPROX_ALLENCUNNEEN_H
QsysResult< T > qsys_gig1_approx_allencunneen(const T &lambda, const T &mu, const T &ca, const T &cs)
Allen-Cunneen 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