LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
qsys_mg11_retrial_ht.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_QSYS_MG11_RETRIAL_HT_H
6#define LINE_API_QSYS_QSYS_MG11_RETRIAL_HT_H
7
8/**
9 * @file
10 * @ingroup api_qsys
11 * Heavy-traffic gamma approximation of the M/G/1/1 retrial orbit size.
12 *
13 * Port of matlab/src/api/qsys/qsys_mg11_retrial_ht.m. As rho -> 1 the
14 * scaled orbit size of the LINEAR M/G/1/1 retrial queue converges to a gamma
15 * law (Falin and Templeton 1997, Sec. 3.7) with
16 * scale = lambda^2 b2 / (2(1-rho)), shape = 1 + 2 rho / (nu lambda b2),
17 * where b2 = (1+cs^2)/mu^2. Under CONSTANT retrial the orbit is approximately
18 * geometric, returned as a gamma with shape 1 and the exact mean of
19 * qsys_mg11_retrial as scale. meanOrb = shape*scale, varOrb = shape*scale^2.
20 * The function first calls qsys_mg11_retrial, which validates the input and
21 * refuses an unstable queue (LINE:input:Unstable).
22 */
23
26#include "line/num/number.h"
27
28namespace line {
29namespace qsys {
30
31/** The outputs [shape, scale, meanOrb, varOrb] of qsys_mg11_retrial_ht. */
32template <class T>
34 T shape; ///< gamma shape
35 T scale; ///< gamma scale
36 T meanOrb; ///< shape*scale
37 T varOrb; ///< shape*scale^2
38};
39
40/** See the file comment; the arguments are those of qsys_mg11_retrial. */
41template <class T>
42Mg11RetrialHtResult<T> qsys_mg11_retrial_ht(const T& lambda, const T& mu, const T& cs, const T& nu,
44 const Mg11RetrialResult<T> base = qsys_mg11_retrial(lambda, mu, cs, nu, policy);
45 const T one = num_traits<T>::from_int(1);
46 const T two = num_traits<T>::from_int(2);
47 const T rho = lambda / mu;
48 const T b2 = T((one + cs * cs) / (mu * mu));
50 if (policy == RetrialPolicy::LINEAR) {
51 out.scale = T(lambda * lambda * b2 / (two * (one - rho)));
52 out.shape = T(one + two * rho / (nu * lambda * b2));
53 } else {
54 out.shape = one;
55 out.scale = base.Norb;
56 }
57 out.meanOrb = T(out.shape * out.scale);
58 out.varOrb = T(out.shape * out.scale * out.scale);
59 return out;
60}
61
62} // namespace qsys
63} // namespace line
64
65#endif // LINE_API_QSYS_QSYS_MG11_RETRIAL_HT_H
RetrialPolicy
Retrial admission policy (RetrialPolicy in MATLAB).
@ LINEAR
each orbiting customer retries at rate alpha (orbit rate i*alpha)
Mg11RetrialResult< T > qsys_mg11_retrial(const T &lambda, const T &mu, const T &cs, const T &nu, RetrialPolicy policy=RetrialPolicy::LINEAR)
Mg11RetrialHtResult< T > qsys_mg11_retrial_ht(const T &lambda, const T &mu, const T &cs, const T &nu, RetrialPolicy policy=RetrialPolicy::LINEAR)
See the file comment; the arguments are those of qsys_mg11_retrial.
Conservation laws of a layered queueing network, enumerated from its structure.
Definition aoi_dist2ph.h:51
Number-type abstraction for the templated API port.
Exact mean measures of the single-class M/G/1/1 retrial queue.
The retrial policy shared by the qsys retrial functions (MATLAB RetrialPolicy).
The outputs [shape, scale, meanOrb, varOrb] of qsys_mg11_retrial_ht.
The outputs [N, Norb, R, U, res] of qsys_mg11_retrial.