LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Toggle main menu visibility
Loading...
Searching...
No Matches
qsys_gigk_approx_kingman.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_GIGK_APPROX_KINGMAN_H
6
#define LINE_API_QSYS_GIGK_APPROX_KINGMAN_H
7
8
/**
9
* @file
10
* @ingroup api_qsys
11
* Kingman (Lee-Longton) scaling of the exact M/M/k waiting time.
12
*
13
* Templated port of matlab/src/api/qsys/qsys_gigk_approx_kingman.m,
14
* cross-checked against
15
* jar/src/main/java/jline/api/qsys/Qsys_gigk_approx_kingman.java. The numbers
16
* agree; the JAR reads the M/M/k answer back out of the static fields of
17
* Ret.qsys, which this port replaces by a plain return value (the port has no
18
* global mutable state).
19
*
20
* W = (ca^2+cs^2)/2 * (W_MMk - 1/mu) + 1/mu
21
*
22
* The M/M/k baseline is Erlang-C, all integer powers, so the whole function
23
* is pure field arithmetic and exact for T = Rational. At k = 1 it reduces
24
* exactly to the Allen-Cunneen / Heyman G/I/G/1 formula.
25
*/
26
27
#include "
line/api/qsys/qsys_mmk.h
"
28
#include "
line/api/qsys/qsys_types.h
"
29
#include "
line/num/number.h
"
30
31
namespace
line
{
32
namespace
qsys
{
33
34
/**
35
* @brief Kingman (Lee-Longton) scaling of the exact M/M/k waiting time.
36
*
37
* @param lambda arrival rate
38
* @param mu service rate of a single server
39
* @param ca coefficient of variation of the interarrival time
40
* @param cs coefficient of variation of the service time
41
* @param k number of servers, k >= 1
42
*/
43
template
<
class
T>
44
QsysResult<T>
qsys_gigk_approx_kingman
(
const
T& lambda,
const
T& mu,
const
T& ca,
const
T& cs,
45
unsigned
k) {
46
const
T one =
num_traits<T>::from_int
(1);
47
const
T two =
num_traits<T>::from_int
(2);
48
const
T W_mmk =
qsys_mmk
(lambda, mu, k).W;
49
const
T W = (
num_pow_int
(ca, 2) +
num_pow_int
(cs, 2)) / two * (W_mmk - one / mu) + one / mu;
50
return
{W, detail::rhohat_from_W(W, lambda)};
51
}
52
53
}
// namespace qsys
54
}
// namespace line
55
56
#endif
// LINE_API_QSYS_GIGK_APPROX_KINGMAN_H
line::qsys
Definition
qsys_bmapm1.h:58
line::qsys::qsys_gigk_approx_kingman
QsysResult< T > qsys_gigk_approx_kingman(const T &lambda, const T &mu, const T &ca, const T &cs, unsigned k)
Kingman (Lee-Longton) scaling of the exact M/M/k waiting time.
Definition
qsys_gigk_approx_kingman.h:44
line::qsys::qsys_mmk
QsysResult< T > qsys_mmk(const T &lambda, const T &mu, unsigned k)
Exact mean response time of the M/M/k queue (Erlang-C).
Definition
qsys_mmk.h:60
line
Definition
aoi_dist2ph.h:52
line::num_pow_int
T num_pow_int(const T &base, unsigned e)
Integer power, valid in any field (no transcendental requirement).
Definition
number.h:192
number.h
Number-type abstraction for the templated API port.
qsys_mmk.h
Exact mean response time of the M/M/k queue (Erlang-C).
qsys_types.h
Shared return type and arithmetic helpers for the templated qsys port.
line::num_traits
Definition
number.h:111
line::qsys::QsysResult
Return value of the qsys family, mirroring MATLAB's [W,rhohat] and the JAR's Ret.qsys.
Definition
qsys_types.h:37
include
line
api
qsys
qsys_gigk_approx_kingman.h
Generated by
1.18.0