LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Toggle main menu visibility
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
24
#include "
line/api/qsys/qsys_mg11_retrial.h
"
25
#include "
line/api/qsys/qsys_retrial_policy.h
"
26
#include "
line/num/number.h
"
27
28
namespace
line
{
29
namespace
qsys
{
30
31
/** The outputs [shape, scale, meanOrb, varOrb] of qsys_mg11_retrial_ht. */
32
template
<
class
T>
33
struct
Mg11RetrialHtResult
{
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. */
41
template
<
class
T>
42
Mg11RetrialHtResult<T>
qsys_mg11_retrial_ht
(
const
T& lambda,
const
T& mu,
const
T& cs,
const
T& nu,
43
RetrialPolicy
policy =
RetrialPolicy::LINEAR
) {
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));
49
Mg11RetrialHtResult<T>
out;
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
line::qsys
Definition
qsys_bmapm1.h:58
line::qsys::RetrialPolicy
RetrialPolicy
Retrial admission policy (RetrialPolicy in MATLAB).
Definition
qsys_retrial_policy.h:18
line::qsys::RetrialPolicy::LINEAR
@ LINEAR
each orbiting customer retries at rate alpha (orbit rate i*alpha)
Definition
qsys_retrial_policy.h:19
line::qsys::qsys_mg11_retrial
Mg11RetrialResult< T > qsys_mg11_retrial(const T &lambda, const T &mu, const T &cs, const T &nu, RetrialPolicy policy=RetrialPolicy::LINEAR)
Definition
qsys_mg11_retrial.h:76
line::qsys::qsys_mg11_retrial_ht
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.
Definition
qsys_mg11_retrial_ht.h:42
line
Conservation laws of a layered queueing network, enumerated from its structure.
Definition
aoi_dist2ph.h:51
number.h
Number-type abstraction for the templated API port.
qsys_mg11_retrial.h
Exact mean measures of the single-class M/G/1/1 retrial queue.
qsys_retrial_policy.h
The retrial policy shared by the qsys retrial functions (MATLAB RetrialPolicy).
line::num_traits
Definition
number.h:123
line::qsys::Mg11RetrialHtResult
The outputs [shape, scale, meanOrb, varOrb] of qsys_mg11_retrial_ht.
Definition
qsys_mg11_retrial_ht.h:33
line::qsys::Mg11RetrialHtResult::scale
T scale
gamma scale
Definition
qsys_mg11_retrial_ht.h:35
line::qsys::Mg11RetrialHtResult::meanOrb
T meanOrb
shape*scale
Definition
qsys_mg11_retrial_ht.h:36
line::qsys::Mg11RetrialHtResult::varOrb
T varOrb
shape*scale^2
Definition
qsys_mg11_retrial_ht.h:37
line::qsys::Mg11RetrialHtResult::shape
T shape
gamma shape
Definition
qsys_mg11_retrial_ht.h:34
line::qsys::Mg11RetrialResult
The outputs [N, Norb, R, U, res] of qsys_mg11_retrial.
Definition
qsys_mg11_retrial.h:60
line::qsys::Mg11RetrialResult::Norb
T Norb
mean orbit size
Definition
qsys_mg11_retrial.h:62
include
line
api
qsys
qsys_mg11_retrial_ht.h
Generated by
1.18.0