LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
qsys_mapg1.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_MAPG1_H
6#define LINE_API_QSYS_QSYS_MAPG1_H
7
8/**
9 * @file
10 * @ingroup api_qsys
11 * The MAP/G/1 FCFS queue, by moment-matching the general service time to a
12 * phase-type distribution.
13 *
14 * Templated port of matlab/src/api/qsys/qsys_mapg1.m. The reference has two
15 * parts: a service fit, written in the .m file itself, and the queue solution,
16 * delegated to BUTools' MMAPPH1FCFS. This port transcribes the first and
17 * replaces the second with the port's own QBD route, exactly as
18 * qsys_mapph1.h already does -- MAP/PH/1 is a MAP/MAP/1 queue with a renewal
19 * service process, and qsys_mapph1 reproduces MMAPPH1FCFS to 1e-15 on that
20 * family (see the measured agreement table in qsys_mapph1.h).
21 *
22 * THE SERVICE FIT, branch by branch, is the reference's own fitServiceToPH:
23 *
24 * 3 or more moments : an acyclic PH matching (m1, m2, m3)
25 * exactly 2 moments : cv2 = m2/m1^2 - 1, and then
26 * cv2 <= 0 -> Erlang-k, k = max(1, round(1/max(cv2, 0.01)))
27 * cv2 < 1 -> the Tijms mixture: k = ceil(1/cv2),
28 * Erlang(k-1, a) w.p. p, Erlang(k, a)
29 * otherwise, p = (k cv2 - sqrt(k(1+cv2)
30 * - k^2 cv2))/(1+cv2), a = (k-p)/m1
31 * cv2 == 1 -> exponential
32 * cv2 > 1 -> balanced-means 2-phase hyperexponential,
33 * p = (1 + sqrt((cv2-1)/(cv2+1)))/2,
34 * rates 2p/m1 and 2(1-p)/m1
35 * 1 moment : exponential
36 *
37 * The mixture and the hyperexponential branches match both m1 and cv2
38 * exactly, and they meet the exponential continuously at cv2 = 1 (p -> 1 puts
39 * all the mass on Erlang(1)), so the `cv2 == 1` test is no longer a branch
40 * decision that changes the answer. Until 2026-11 every codebase took a
41 * ROUNDED Erlang-k, k = max(2, round(1/cv2)), there: it matched only m1, so
42 * cv2 = 0.99 became an Erlang-2 (L = 1.667 against the P-K 1.993 at
43 * rho = 2/3), and a cv2 one ulp below 1 at 50 digits moved L from 2 to 5/3.
44 * The cv2 <= 0 branch still matches only m1 (defect 1 below).
45 *
46 * THE 3-MOMENT BRANCH IS THE ONE SUBSTITUTION. The reference calls BUTools'
47 * APHFrom3Moments, which this port does not transcribe (the same position
48 * qsys_mapph1.h takes on MMAPPH1FCFS). It uses line::mam::aph_fit instead, the
49 * m3a implementation of
50 * the same Bobbio-Horvath-Telek canonical APH. MEASURED: on
51 * (m1, m2, m3) = (1/3, 1/6, 1/9), the moments of Erlang(2) with mean 1/3, the
52 * two agree on the order (3), on the sub-generator
53 * ([-12 12 0; 0 -12 12; 0 0 -5]) and on the entry vector ([0.8 0 0.2]) to
54 * 1e-14, so the queue results agree as well. They are not guaranteed to pick
55 * the same representation everywhere -- the order search and the branch
56 * conditions are written differently -- and where they differ the queue
57 * results will differ too, because a queue depends on the whole service
58 * distribution and not on its first three moments. A caller who needs the
59 * reference's exact PH can pass it to qsys_mapph1 directly. The reference's
60 * fallback chain is reproduced: when the APH fit throws, BUTools'
61 * PH2From3Moments (transcribed below, with its feasibility bounds) is tried,
62 * and when that throws too the service is an exponential of mean m1.
63 *
64 * MOMENTS. MMAPPH1FCFS also returns higher queue-length and sojourn-time
65 * moments (ncMoms, stMoms). qsys_mapmap1 now provides both -- the queue-length
66 * moments in closed form from pi_0 and R, the sojourn-time moments from the
67 * phase-type sojourn law of the age process -- and they are passed through
68 * here as queueLengthMoments and sojournTimeMoments under the reference's
69 * numQLMoms / numSTMoms options (default 3 each).
70 *
71 * REFERENCE DEFECTS in qsys_mapg1.m:
72 *
73 * 1. THE cv2 <= 0 BRANCH SILENTLY BUILDS AN ERLANG-100. Line 128 computes
74 * k = max(1, round(1/max(cv2, 0.01))), and for any cv2 <= 0 the max pins
75 * the denominator at 0.01, so k = 100 whatever the moments were. Nothing
76 * warns. Deterministic service therefore enters the QBD with a 100-phase
77 * service process (cv2 = 0.01, not 0), which is both expensive and a
78 * silent modelling decision. MATLAB reproduction, from matlab/:
79 * r = qsys_mapg1(-2, 2, [1/3, (1/3)^2]) % cv2 = 0 exactly
80 * r.meanQueueLength -> 1.33999999999909
81 * against the exact M/D/1 value 4/3 + ... (the Erlang-100 answer is
82 * 1.3399999999 rather than the M/D/1 1.3333...). Reproduced here, since
83 * it is the reference's model choice, and pinned by a test that asserts
84 * the phase count is 100.
85 * 2. m2 and m3 are read without any feasibility check: a moment set that is
86 * not PH-representable reaches the fit and fails there.
87 * 3. The reference computes rho from the INPUT mean 1/serviceMoments(1) and
88 * not from the fitted PH, so a branch whose fit does not preserve m1 would
89 * report a utilization inconsistent with its own service process. Every
90 * branch does preserve m1, so this is latent rather than active; the port
91 * reproduces the reference's formula.
92 *
93 * ARITHMETIC. Gated on num_traits<T>::has_transcendental, inherited from
94 * qsys_mapmap1 (the cyclic reduction behind R) and from aph_fit.
95 */
96
97#include <cmath>
98#include <cstddef>
99#include <limits>
100#include <string>
101#include <vector>
102
103#include "line/api/mam/aph_fit.h"
107#include "line/num/number.h"
108#include "line/util/error.h"
109#include "line/util/matrix.h"
110
111namespace line {
112namespace qsys {
113
114/** Which branch of fitServiceToPH was taken, for the caller and for tests. */
115enum class MapG1ServiceFit {
116 Exponential, ///< one moment, or cv2 exactly 1
117 Erlang, ///< the cv2 <= 0 branch (Erlang-100)
118 ErlangMixture, ///< 0 < cv2 < 1, the moment-exact Tijms mixture
119 Hyperexponential, ///< cv2 > 1
120 Acyclic ///< three or more moments
121};
122
123/** Result of qsys_mapg1. */
124template <class T>
126 T meanQueueLength; ///< E[N], number in system
127 T meanWaitingTime; ///< max(0, E[W] - m1), as in the reference
128 T meanSojournTime; ///< E[W]
129 T utilization; ///< lambda m1
130 std::vector<T> queueLengthDist; ///< P(N = n), n = 0, 1, ...
131 std::vector<T> queueLengthMoments; ///< raw moments E[N^k], k = 1..numQLMoms
132 std::vector<T> sojournTimeMoments; ///< raw moments E[W^k], k = 1..numSTMoms
133 mam::Map<T> serviceFit; ///< the fitted PH as its renewal MAP
134 MapG1ServiceFit fitKind; ///< which branch produced it
135 std::size_t servicePhases; ///< order of the fitted PH
136 /** The reference's analyzer label ('BUTools:MMAPPH1FCFS'), kept for parity; the port computes the same quantities by the QBD route. */
137 std::string analyzer;
138};
139
140namespace detail {
141
142/** Exponential PH of the given mean, as its renewal MAP. */
143template <class T>
144mam::Map<T> mapg1_exponential(const T& mean) {
145 if (!(mean > num_traits<T>::from_int(0)))
146 throw InputError("qsys_mapg1: the mean service time must be positive");
147 mam::Map<T> m;
148 m.D0 = Matrix<T>(1, 1, T(-num_traits<T>::from_int(1) / mean));
149 m.D1 = Matrix<T>(1, 1, T(num_traits<T>::from_int(1) / mean));
150 return m;
151}
152
153/** Erlang-k PH of the given mean, as its renewal MAP (entry in phase 1). */
154template <class T>
155mam::Map<T> mapg1_erlang(const T& mean, std::size_t k) {
156 if (k == 0) throw InputError("qsys_mapg1: an Erlang fit needs at least one phase");
157 const T zero = num_traits<T>::from_int(0);
158 const T mu = T(num_traits<T>::from_int(static_cast<long>(k)) / mean);
159 mam::Map<T> m;
160 m.D0 = Matrix<T>(k, k, zero);
161 m.D1 = Matrix<T>(k, k, zero);
162 for (std::size_t i = 0; i < k; ++i) {
163 m.D0(i, i) = -mu;
164 if (i + 1 < k) m.D0(i, i + 1) = mu;
165 }
166 m.D1(k - 1, 0) = mu; // completion restarts in phase 1
167 return m;
168}
169
170/**
171 * Moment-exact PH for 0 < cv2 < 1 (Tijms, A First Course in Stochastic
172 * Models, 2003, Sec. 2.4), as its renewal MAP: k phases in series at a common
173 * rate a, entered in phase 2 with probability p (Erlang(k-1, a)) and in phase
174 * 1 otherwise (Erlang(k, a)). k is the least integer with k cv2 >= 1, decided
175 * in T so that a cv2 a hair below 1 at high precision gives k = 2, p -> 1.
176 */
177template <class T>
178mam::Map<T> mapg1_erlang_mixture(const T& mean, const T& cv2) {
179 using std::sqrt;
180 const T zero = num_traits<T>::from_int(0), one = num_traits<T>::from_int(1);
181 double kd = std::ceil(1.0 / num_traits<T>::to_double(cv2));
182 std::size_t k = kd < 2.0 ? 2u : static_cast<std::size_t>(kd);
183 auto kT = [](std::size_t n) { return num_traits<T>::from_int(static_cast<long>(n)); };
184 while (T(kT(k) * cv2) < one) ++k;
185 while (k > 2 && !(T(kT(k - 1) * cv2) < one)) --k;
186 const T K = kT(k);
187 T p = T(T(K * cv2 - sqrt(T(K * T(one + cv2) - T(K * K) * cv2))) / T(one + cv2));
188 if (p < zero) p = zero;
189 if (p > one) p = one;
190 const T a = T(T(K - p) / mean);
191 mam::Map<T> m;
192 m.D0 = Matrix<T>(k, k, zero);
193 m.D1 = Matrix<T>(k, k, zero);
194 for (std::size_t i = 0; i < k; ++i) {
195 m.D0(i, i) = -a;
196 if (i + 1 < k) m.D0(i, i + 1) = a;
197 }
198 m.D1(k - 1, 0) = T(a * T(one - p)); // restart in phase 1 -> Erlang-k
199 m.D1(k - 1, 1) = T(a * p); // restart in phase 2 -> Erlang-(k-1)
200 return m;
201}
202
203/**
204 * Balanced-means two-phase hyperexponential with the given mean and squared
205 * coefficient of variation, as its renewal MAP.
206 */
207template <class T>
208mam::Map<T> mapg1_hyperexp2(const T& mean, const T& cv2) {
209 using std::sqrt;
210 const T zero = num_traits<T>::from_int(0), one = num_traits<T>::from_int(1);
211 const T two = num_traits<T>::from_int(2);
212 const T p = T(T(one + sqrt(T(T(cv2 - one) / T(cv2 + one)))) / two);
213 const T l1 = T(two * p / mean), l2 = T(two * T(one - p) / mean);
214 mam::Map<T> m;
215 m.D0 = Matrix<T>(2, 2, zero);
216 m.D1 = Matrix<T>(2, 2, zero);
217 m.D0(0, 0) = -l1;
218 m.D0(1, 1) = -l2;
219 m.D1(0, 0) = l1 * p;
220 m.D1(0, 1) = l1 * T(one - p);
221 m.D1(1, 0) = l2 * p;
222 m.D1(1, 1) = l2 * T(one - p);
223 return m;
224}
225
226/** BUTools APH2ndMomentLowerBound(m1, n). */
227inline double mapg1_aph_m2_lower(double m1, double n) { return m1 * m1 * (n + 1.0) / n; }
228
229/** BUTools APH3rdMomentLowerBound(m1, m2, n). */
230inline double mapg1_aph_m3_lower(double m1, double m2, double n) {
231 const double n2 = m2 / m1 / m1;
232 if (n2 < (n + 1.0) / n) return std::numeric_limits<double>::infinity();
233 if (n2 < (n + 4.0) / (n + 1.0)) {
234 const double p = ((n + 1.0) * (n2 - 2.0)) / (3.0 * n2 * (n - 1.0)) *
235 ((-2.0 * std::sqrt(n + 1.0)) / std::sqrt(-3.0 * n * n2 + 4.0 * n + 4.0) - 1.0);
236 const double a = (n2 - 2.0) / (p * (1.0 - n2) + std::sqrt(p * p + p * n * (n2 - 2.0) / (n - 1.0)));
237 const double l = ((3.0 + a) * (n - 1.0) + 2.0 * a) / ((n - 1.0) * (1.0 + a * p)) -
238 (2.0 * a * (n + 1.0)) / (2.0 * (n - 1.0) + a * p * (n * a + 2.0 * n - 2.0));
239 return l * m1 * m2;
240 }
241 return (n + 1.0) / n * n2 * m1 * m2;
242}
243
244/** BUTools APH3rdMomentUpperBound(m1, m2, n). */
245inline double mapg1_aph_m3_upper(double m1, double m2, double n) {
246 const double n2 = m2 / m1 / m1;
247 if (n2 < (n + 1.0) / n) return -std::numeric_limits<double>::infinity();
248 if (n2 <= n / (n - 1.0))
249 return m1 * m2 *
250 (2.0 * (n - 2.0) * (n * n2 - n - 1.0) * std::sqrt(1.0 + (n * (n2 - 2.0)) / (n - 1.0)) +
251 (n + 2.0) * (3.0 * n * n2 - 2.0 * n - 2.0)) /
252 (n * n * n2);
253 return std::numeric_limits<double>::infinity();
254}
255
256/**
257 * BUTools PH2From3Moments(moms, prec = 1e-14): the two-phase PH matching three
258 * moments, as its renewal MAP. Throws NumericError where BUTools errors (an
259 * infeasible moment set), which is what the reference's fallback chain catches.
260 */
261template <class T>
262mam::Map<T> mapg1_ph2_from_3moments(const T& m1T, const T& m2T, const T& m3T) {
263 using std::sqrt;
264 const double prec = 1e-14;
265 const double m1 = num_traits<T>::to_double(m1T), m2 = num_traits<T>::to_double(m2T),
266 m3 = num_traits<T>::to_double(m3T);
267 if (m2 < mapg1_aph_m2_lower(m1, 2.0))
268 throw NumericError(ErrorKind{"Infeasible"}, "PH2From3Moments: The given second moment is not feasible!");
269 if (m3 < mapg1_aph_m3_lower(m1, m2, 2.0))
270 throw NumericError(ErrorKind{"Infeasible"}, "PH2From3Moments: The given third moment is not feasible (too small)!");
271 if (m3 > mapg1_aph_m3_upper(m1, m2, 2.0))
272 throw NumericError(ErrorKind{"Infeasible"}, "PH2From3Moments: The given third moment is not feasible (too large)!");
273 if (std::fabs(m2 / m1 / m1 - 2.0) < prec) return mapg1_exponential(m1T);
274
275 const T zero = num_traits<T>::from_int(0), one = num_traits<T>::from_int(1);
276 const T two = num_traits<T>::from_int(2), three = num_traits<T>::from_int(3), six = num_traits<T>::from_int(6);
277 const T b = T(three * m1T * m2T - m3T);
278 const T c = T(three * m2T * m2T - two * m1T * m3T);
279 const T e = T(m2T - two * m1T * m1T);
280 T a = T(b * b + six * c * e);
281 if (a < zero) a = zero;
282 a = sqrt(a);
283 T lambda1, lambda2, p;
284 if (c > zero) {
285 lambda1 = T(T(b - a) / c);
286 lambda2 = T(T(b + a) / c);
287 p = T(T(-b - six * m1T * e + a) / T(b + a));
288 } else if (c < zero) {
289 lambda1 = T(T(b + a) / c);
290 lambda2 = T(T(b - a) / c);
291 p = T(T(b + six * m1T * e + a) / T(-b + a));
292 } else {
293 lambda1 = zero;
294 lambda2 = T(one / m1T);
295 p = zero;
296 }
297 // alpha = [p, 1-p], A = [-l1 l1; 0 -l2]; as a renewal MAP D1 = (-A e) alpha
298 mam::Map<T> m;
299 m.D0 = Matrix<T>(2, 2, zero);
300 m.D1 = Matrix<T>(2, 2, zero);
301 m.D0(0, 0) = -lambda1;
302 m.D0(0, 1) = lambda1;
303 m.D0(1, 1) = -lambda2;
304 m.D1(1, 0) = lambda2 * p;
305 m.D1(1, 1) = lambda2 * T(one - p);
306 return m;
307}
308
309} // namespace detail
310
311/**
312 * Fit a general service time to a PH, following qsys_mapg1.m's
313 * fitServiceToPH. Exposed separately because the branch selection is the part
314 * of the reference that is transcribed verbatim, and a caller may want the
315 * fitted process without solving a queue.
316 *
317 * @param moments the first one, two or three raw moments of the service time
318 * @param kind out: which branch was taken
319 */
320template <class T>
321mam::Map<T> qsys_mapg1_service_fit(const std::vector<T>& moments, MapG1ServiceFit& kind) {
323 "qsys_mapg1_service_fit requires transcendental arithmetic");
324 if (moments.empty()) throw InputError("qsys_mapg1: no service moments given");
325 const T one = num_traits<T>::from_int(1);
326 const T m1 = moments[0];
327
328 if (moments.size() >= 3) {
329 // APHFrom3Moments, then PH2From3Moments, then an exponential: the
330 // reference's try/catch chain.
331 try {
333 return mam::aph_fit(moments[0], moments[1], moments[2]).aph;
334 } catch (const Error&) {
335 }
336 try {
338 return detail::mapg1_ph2_from_3moments(moments[0], moments[1], moments[2]);
339 } catch (const Error&) {
340 }
342 return detail::mapg1_exponential(m1);
343 }
344 if (moments.size() == 2) {
345 const T cv2 = T(T(moments[1] / T(m1 * m1)) - one);
346 const T zero = num_traits<T>::from_int(0);
347 if (cv2 <= zero) {
348 // REFERENCE DEFECT 1: the floor at 0.01 makes this Erlang-100.
349 const T floored = num_traits<T>::from_double(0.01);
350 const T den = cv2 > floored ? cv2 : floored; // max(cv2, 0.01)
351 const double kd = std::round(1.0 / num_traits<T>::to_double(den));
352 const std::size_t k = kd < 1.0 ? 1u : static_cast<std::size_t>(kd);
354 return detail::mapg1_erlang(m1, k);
355 }
356 if (cv2 < one) {
358 return detail::mapg1_erlang_mixture(m1, cv2);
359 }
360 if (cv2 == one) {
362 return detail::mapg1_exponential(m1);
363 }
365 return detail::mapg1_hyperexp2(m1, cv2);
366 }
368 return detail::mapg1_exponential(m1);
369}
370
371/**
372 * The MAP/G/1 FCFS queue.
373 *
374 * @param arrival arrival MAP (D0, D1)
375 * @param moments the first one, two or three raw moments of the service time
376 * @param dist_size how many entries of queueLengthDist to materialize
377 * (the reference's numQLProbs, default 100)
378 * @param numQLMoms how many raw queue-length moments to return (numQLMoms)
379 * @param numSTMoms how many raw sojourn-time moments to return (numSTMoms)
380 */
381template <class T>
382MapG1Result<T> qsys_mapg1(const mam::Map<T>& arrival, const std::vector<T>& moments,
383 std::size_t dist_size, std::size_t numQLMoms, std::size_t numSTMoms) {
385 "qsys_mapg1 requires transcendental arithmetic");
388 r.servicePhases = r.serviceFit.order();
389
390 const MapMap1Result<T> q = qsys_mapmap1(arrival, r.serviceFit, dist_size, numQLMoms, numSTMoms);
396 r.analyzer = "BUTools:MMAPPH1FCFS";
397
398 // The reference recomputes both of these from the INPUT mean rather than
399 // from the fitted process; see reference defect 3.
400 const T zero = num_traits<T>::from_int(0);
401 const T lambda = mam::map_lambda(arrival);
402 r.utilization = T(lambda * moments[0]);
403 const T wait = T(q.meanSojournTime - moments[0]);
404 r.meanWaitingTime = wait < zero ? zero : wait;
405 return r;
406}
407
408/** qsys_mapg1 with the reference's defaults numQLMoms = 3, numSTMoms = 3. */
409template <class T>
410MapG1Result<T> qsys_mapg1(const mam::Map<T>& arrival, const std::vector<T>& moments,
411 std::size_t dist_size) {
412 return qsys_mapg1(arrival, moments, dist_size, static_cast<std::size_t>(3),
413 static_cast<std::size_t>(3));
414}
415
416/** qsys_mapg1 with the reference's default of 100 materialized levels. */
417template <class T>
418MapG1Result<T> qsys_mapg1(const mam::Map<T>& arrival, const std::vector<T>& moments) {
419 return qsys_mapg1(arrival, moments, static_cast<std::size_t>(100));
420}
421
422} // namespace qsys
423} // namespace line
424
425#endif // LINE_API_QSYS_QSYS_MAPG1_H
Minimal-order acyclic phase-type fit of the first three moments (matlab/lib/kpctoolbox/aph/aph_fit....
Base error for the multiprecision C++ port.
Definition error.h:73
InputError(const std::string &what)
Definition error.h:105
NumericError(const std::string &what)
Definition error.h:112
The exception types the port throws.
Markovian arrival process descriptors: stationary vectors, rate, moments, autocorrelation and the ind...
Dense matrix and non-owning view.
AphFitResult< T > aph_fit(const T &e1, const T &e2, const T &e3, unsigned nmax, const T &tol)
Fit an APH(n) with n <= nmax to the raw moments e1, e2, e3.
Definition aph_fit.h:176
T map_lambda(const Map< T > &m)
Stationary arrival rate, lambda = pi D1 e.
Definition map_moment.h:79
mam::Map< T > qsys_mapg1_service_fit(const std::vector< T > &moments, MapG1ServiceFit &kind)
Fit a general service time to a PH, following qsys_mapg1.m's fitServiceToPH.
Definition qsys_mapg1.h:321
MapG1ServiceFit
Which branch of fitServiceToPH was taken, for the caller and for tests.
Definition qsys_mapg1.h:115
@ Acyclic
three or more moments
Definition qsys_mapg1.h:120
@ ErlangMixture
0 < cv2 < 1, the moment-exact Tijms mixture
Definition qsys_mapg1.h:118
@ Exponential
one moment, or cv2 exactly 1
Definition qsys_mapg1.h:116
@ Erlang
the cv2 <= 0 branch (Erlang-100)
Definition qsys_mapg1.h:117
MapG1Result< T > qsys_mapg1(const mam::Map< T > &arrival, const std::vector< T > &moments, std::size_t dist_size, std::size_t numQLMoms, std::size_t numSTMoms)
The MAP/G/1 FCFS queue.
Definition qsys_mapg1.h:382
MapMap1Result< T > qsys_mapmap1(const mam::Map< T > &arrival, const mam::Map< T > &service, std::size_t dist_size, std::size_t numQLMoms, std::size_t numSTMoms)
MAP/MAP/1 FCFS queue with the service MAP honoured, correlation included.
Conservation laws of a layered queueing network, enumerated from its structure.
Definition aoi_dist2ph.h:51
Number-type abstraction for the templated API port.
The MAP/MAP/1 FCFS queue: mean number in system, waiting time, sojourn time, utilization and the queu...
The MAP/PH/1 FCFS queue.
A MAP as the pair of matrices (D0, D1).
Definition map_moment.h:53
Matrix< T > D1
Definition map_moment.h:55
Matrix< T > D0
Definition map_moment.h:54
Result of qsys_mapg1.
Definition qsys_mapg1.h:125
std::string analyzer
The reference's analyzer label ('BUTools:MMAPPH1FCFS'), kept for parity; the port computes the same q...
Definition qsys_mapg1.h:137
MapG1ServiceFit fitKind
which branch produced it
Definition qsys_mapg1.h:134
T meanWaitingTime
max(0, E[W] - m1), as in the reference
Definition qsys_mapg1.h:127
T meanQueueLength
E[N], number in system.
Definition qsys_mapg1.h:126
std::vector< T > sojournTimeMoments
raw moments E[W^k], k = 1..numSTMoms
Definition qsys_mapg1.h:132
std::size_t servicePhases
order of the fitted PH
Definition qsys_mapg1.h:135
std::vector< T > queueLengthMoments
raw moments E[N^k], k = 1..numQLMoms
Definition qsys_mapg1.h:131
mam::Map< T > serviceFit
the fitted PH as its renewal MAP
Definition qsys_mapg1.h:133
std::vector< T > queueLengthDist
P(N = n), n = 0, 1, ...
Definition qsys_mapg1.h:130
Return value of the MAP/MAP/1 family (qsys_mapmap1, qsys_mapph1, qsys_phph1), carrying the same quant...
std::vector< T > sojournTimeMoments
raw moments E[W^k], k = 1..numSTMoms
std::vector< T > queueLengthMoments
raw moments E[N^k], k = 1..numQLMoms
T meanQueueLength
E[N], number in system.
T meanSojournTime
E[W] = E[Wq] + E[S].
std::vector< T > queueLengthDist
P(N = n), n = 0, 1, ...