LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Toggle main menu visibility
Loading...
Searching...
No Matches
qsys_gig1_approx_myskja.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_GIG1_APPROX_MYSKJA_H
6
#define LINE_API_QSYS_QSYS_GIG1_APPROX_MYSKJA_H
7
8
/**
9
* @file
10
* @ingroup api_qsys
11
* Myskja's third-moment approximation of the mean response time of a G/I/G/1
12
* queue.
13
*
14
* Templated port of matlab/src/api/qsys/qsys_gig1_approx_myskja.m.
15
*
16
* Wq = rho/(2 mu (1-rho)) [ (1+cs^2) + (q0/qa)^(1/rho-rho) (1/rho) (ca^2-1) ]
17
* W = Wq + 1/mu
18
*
19
* exact for M/G/1 (ca = 1), where the bracket collapses to 1 + cs^2. Here qa
20
* is the third relative moment E[A^3]/(6 E[A]^3) of the interarrival time and
21
* q0 its smallest value for the given mean and SCV, so q0/qa <= 1 and the
22
* correction term is a genuine interpolation in the third moment.
23
*
24
* ARITHMETIC. The exponent 1/rho - rho is a real number, so (q0/qa)^(1/rho-rho)
25
* is a transcendental evaluation and the function is gated accordingly.
26
*
27
* MATLAB-vs-JAR. jline.api.qsys.Qsys_gig1_approx_myskja writes (1+cs) and
28
* (ca-1) where MATLAB writes (1+cs^2) and (ca^2-1), i.e. the JAR reads its
29
* ca/cs arguments as squared coefficients of variation while MATLAB reads them
30
* as coefficients of variation. The two therefore disagree for every input
31
* with ca != 1 or cs != 1. This port follows MATLAB, which is consistent with
32
* the rest of the qsys_gig1_approx_* family and with the documented signature.
33
*/
34
35
#include "
line/api/qsys/qsys_types.h
"
36
#include "
line/num/number.h
"
37
38
namespace
line
{
39
namespace
qsys
{
40
41
/**
42
* @brief Myskja's third-moment approximation of the mean response time of a
43
* G/I/G/1 queue.
44
*
45
* @param lambda arrival rate
46
* @param mu service rate
47
* @param ca coefficient of variation of the interarrival time
48
* @param cs coefficient of variation of the service time
49
* @param q0 smallest third relative moment for the given mean and SCV
50
* @param qa third relative moment E[A^3]/(6 E[A]^3) of the interarrival time
51
*/
52
template
<
class
T>
53
QsysResult<T>
qsys_gig1_approx_myskja
(
const
T& lambda,
const
T& mu,
const
T& ca,
const
T& cs,
54
const
T& q0,
const
T& qa) {
55
static_assert
(
num_traits<T>::has_transcendental
,
56
"qsys_gig1_approx_myskja requires transcendental arithmetic"
);
57
const
T one =
num_traits<T>::from_int
(1);
58
const
T two =
num_traits<T>::from_int
(2);
59
const
T rho = lambda / mu;
60
detail::require_no_pole(T(one - rho),
"qsys_gig1_approx_myskja"
);
61
const
T expo = one / rho - rho;
62
const
T Wq = rho / (two * mu * (one - rho)) *
63
((one + cs * cs) +
64
detail::num_pow(T(q0 / qa), expo) * (one / rho) * (ca * ca - one));
65
const
T W = Wq + one / mu;
66
return
{W, detail::rhohat_from_W(W, lambda)};
67
}
68
69
}
// namespace qsys
70
}
// namespace line
71
72
#endif
// LINE_API_QSYS_QSYS_GIG1_APPROX_MYSKJA_H
line::qsys
Definition
qsys_bmapm1.h:58
line::qsys::qsys_gig1_approx_myskja
QsysResult< T > qsys_gig1_approx_myskja(const T &lambda, const T &mu, const T &ca, const T &cs, const T &q0, const T &qa)
Myskja's third-moment approximation of the mean response time of a G/I/G/1 queue.
Definition
qsys_gig1_approx_myskja.h:53
line
Definition
aoi_dist2ph.h:52
number.h
Number-type abstraction for the templated API port.
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_gig1_approx_myskja.h
Generated by
1.18.0