LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
solver_mam_passage_time.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_SOLVERS_MAM_SOLVER_MAM_PASSAGE_TIME_H
6#define LINE_SOLVERS_MAM_SOLVER_MAM_PASSAGE_TIME_H
7
8/**
9 * @file
10 * @ingroup line_solvers
11 * Port of `solver_mam_passage_time.m`: the response-time (sojourn-time)
12 * distribution of a single open queue, which is what `getCdfRespT`,
13 * `getSjrnT` / `sjrnT` and the CDF path of `getPerctRespT` return.
14 *
15 * THE REGIME IS NARROW AND THE REFERENCE SAYS SO. The whole analyzer is inside
16 * `if M == 2 && all(isinf(N))`: exactly two stations, a Source and one queue,
17 * every class open. Anything else makes MATLAB warn and return with NO result
18 * at all -- an empty `RD` that then surfaces as a confusing failure further up.
19 * The port refuses by name instead, which is the same information delivered
20 * where it can be acted on.
21 *
22 * TWO ENGINES, chosen by the queue's discipline:
23 *
24 * - FCFS / HOL: the sojourn time is a phase-type law read straight out of the
25 * age process (`mmapph1fcfs_stdistr_ph`). The evaluation grid is the
26 * reference's: start at mean + 5 sigma and widen until the CDF is within
27 * FineTol of one, then lay down `num_cdf_pts` points from zero.
28 * - PS with POISSON arrivals and any phase-type service (or class-dependent
29 * exponential rates): the station is one M/G/1-PS queue whose requirement
30 * is the rate-weighted mix of the class laws, and class k's law is Ott's
31 * V(x) averaged over its own requirement (`qsys_mg1_ps` with `tagAlpha`),
32 * exact by PASTA. The grid ends at the first mean + n sigma (n = 10, 20,
33 * ..., 1280) holding 1 - FineTol, linear over the bulk and logarithmic
34 * over the tail beyond mean + 10 sigma.
35 * - PS otherwise: the MAP/M/1-PS sojourn law of `map_m1ps_cdfrespt`, which
36 * returns the COMPLEMENTARY CDF, so the port takes 1 - W_bar as the
37 * reference does. The grid there is 10x the M/M/1-PS mean, and that law
38 * needs exponential service (order-1 subgenerator) and, for several
39 * classes, identical service rates -- both refused by name here.
40 * - A PS station with more than one server is refused: both laws are those
41 * of a single egalitarian server.
42 *
43 * PRIORITIES: distinct class priorities under HOL reach BUTools'
44 * `MMAPPH1NPPR`, and under FCFSPRPRIO `MMAPPH1PRPR` (`mmapph1prio.h`). Neither
45 * exports a PH form, so the law is TABULATED as the reference does: one solve
46 * for two sojourn moments sizes a shared grid (max over classes of mean +
47 * 10 sigma), a second evaluates the CDF on it, with F(0) = 0 prepended since
48 * the Erlangization cannot be evaluated at t = 0.
49 */
50
51#include <algorithm>
52#include <cmath>
53#include <cstddef>
54#include <iostream>
55#include <string>
56#include <vector>
57
69#include "line/util/error.h"
70#include "line/util/matrix.h"
71
72namespace line {
73namespace mam {
74
75/** One class's response-time CDF, the reference's `RD{station, class} = [F, X]`. */
76template <class T>
77struct RespTCdf {
78 std::vector<T> F; ///< CDF values
79 std::vector<T> X; ///< the points they are evaluated at
80};
81
82/**
83 * Port of `solver_mam_passage_time.m`.
84 *
85 * @return one entry per class, in class order; the Source contributes none
86 * (the reference leaves `RD{idx_arv,k}` empty)
87 */
88template <class T>
89std::vector<RespTCdf<T>> solver_mam_passage_time(const qn::NetworkStruct<T>& L,
90 const MamOptions& opt) {
91 if constexpr (!num_traits<T>::has_transcendental) {
92 throw UnsupportedError(ErrorKind{"Arithmetic"},
93 "solver_mam_passage_time: the sojourn-time law comes from the age process, whose "
94 "first-return matrix is a tolerance-terminated Riccati doubling; rerun with "
95 "--arith double or --arith real");
96 } else {
99 const T zero = num_traits<T>::from_int(0), one = num_traits<T>::from_int(1);
100 const std::size_t M = L.nstations, K = L.nclasses;
101
102 bool allopen = true;
103 for (const qn::JobClass& c : L.classes)
104 if (!std::isinf(c.population)) allopen = false;
105 if (M != 2 || !allopen)
106 throw UnsupportedError(ErrorKind{"Topology"},
107 "solver_mam_passage_time: the MAM response-time distribution covers a single open "
108 "queue only (exactly two stations, a Source and one queue, every class open); this "
109 "model has " + std::to_string(M) + " stations" + (allopen ? "" : " and a closed class") +
110 ". The reference warns and returns no result at all for it");
111
112 std::size_t src = 0, q = 0;
113 for (std::size_t i = 1; i <= M; ++i) {
114 if (L.stations[i - 1].sched == SchedStrategy::EXT) src = i;
115 else q = i;
116 }
117 if (src == 0 || q == 0)
118 throw UnsupportedError(ErrorKind{"Topology"},
119 "solver_mam_passage_time: the model must have a Source and one queueing station");
120
121 const SchedStrategy qs = L.stations[q - 1].sched;
122 if (!(qs == SchedStrategy::FCFS || qs == SchedStrategy::HOL ||
123 qs == SchedStrategy::FCFSPRPRIO || qs == SchedStrategy::PS))
124 throw UnsupportedError(ErrorKind{"SchedStrategy"}, std::string("solver_mam_passage_time: the ") +
126 " discipline is not covered; the reference supports FCFS, HOL, "
127 "FCFSPRPRIO and PS only");
128 // Priorities select the law only under a priority DISCIPLINE -- a plain
129 // FCFS or PS queue serves in arrival or processor order whatever the prio
130 // column says, exactly as the other three codebases gate it
131 bool prio_distinct = false;
132 if (qs == SchedStrategy::HOL || qs == SchedStrategy::FCFSPRPRIO)
133 for (std::size_t r = 1; r < K; ++r)
134 if (L.classes[r].prio != L.classes[0].prio) prio_distinct = true;
135
136 const std::size_t npts =
137 opt.num_cdf_pts > 0 ? opt.num_cdf_pts : static_cast<std::size_t>(100);
138
139 // The arrival MMAP: each class's source process marked as its own class.
140 Mmap<T> A;
141 {
142 std::vector<Mmap<T>> parts;
143 for (std::size_t r = 0; r < K; ++r) {
144 Mmap<T> m;
145 const Map<T> s = lang::dist_to_map(L.service[src - 1][r]);
146 m.D0 = s.D0;
147 m.D1 = s.D1;
148 m.Dc.assign(1, s.D1);
149 parts.push_back(m);
150 }
151 A = parts[0];
152 for (std::size_t p = 1; p < parts.size(); ++p)
153 A = mmap_super(A, parts[p]);
154 }
155
156 std::vector<RespTCdf<T>> out(K);
157
158 if (qs == SchedStrategy::PS && L.stations[q - 1].nservers != 1.0)
159 throw UnsupportedError(ErrorKind{"Structure"},
160 "solver_mam_passage_time: getCdfRespT on a PS queue needs a single server; this "
161 "station has " + std::to_string(static_cast<long long>(L.stations[q - 1].nservers)) + ".");
162
163 if (qs == SchedStrategy::PS) {
164 // Route choice: Poisson arrivals (an order-one arrival MMAP) take the
165 // exact M/PH/1-PS law whenever MAP/M/1-PS does not already cover the
166 // service mix, i.e. a non-exponential class or class-dependent rates.
167 std::vector<Map<T>> svk(K);
168 bool allexp = true;
169 for (std::size_t r = 0; r < K; ++r) {
170 svk[r] = lang::dist_to_map(L.service[q - 1][r]);
171 if (svk[r].D0.rows() != 1) allexp = false;
172 }
173 if (allexp)
174 for (std::size_t r = 1; r < K; ++r)
175 if (std::fabs(num_traits<T>::to_double(svk[r].D0(0, 0)) -
177 allexp = false;
178 if (A.order() == 1 && !allexp) {
179 // One M/G/1-PS queue whose requirement is the rate-weighted mix of
180 // the class laws. A job of requirement x has the sojourn V(x) of
181 // Ott (1984) whatever its class, and by PASTA its class is
182 // independent of the state it finds, so class k's law is V(x)
183 // averaged over its OWN requirement law.
184 std::vector<double> lamk(K, 0.0);
185 double lam = 0.0;
186 for (std::size_t r = 0; r < K; ++r) {
187 lamk[r] = num_traits<T>::to_double(A.Dc[r](0, 0));
188 lam += lamk[r];
189 }
190 std::vector<std::size_t> off(K + 1, 0);
191 std::size_t n = 0;
192 std::vector<std::vector<double>> pie(K);
193 for (std::size_t r = 0; r < K; ++r) {
194 off[r] = n;
195 if (lamk[r] > 0.0) {
196 const std::vector<T> pr = map_pie(svk[r]);
197 for (const T& v : pr) pie[r].push_back(num_traits<T>::to_double(v));
198 n += svk[r].D0.rows();
199 }
200 }
201 off[K] = n;
202 std::vector<double> amix(n, 0.0);
203 Matrix<double> Tmix(n, n, 0.0);
204 for (std::size_t r = 0; r < K; ++r) {
205 if (!(lamk[r] > 0.0)) continue;
206 const std::size_t nk = svk[r].D0.rows();
207 for (std::size_t i = 0; i < nk; ++i) {
208 amix[off[r] + i] = (lamk[r] / lam) * pie[r][i];
209 for (std::size_t j = 0; j < nk; ++j)
210 Tmix(off[r] + i, off[r] + j) = num_traits<T>::to_double(svk[r].D0(i, j));
211 }
212 }
213 if (npts < 2)
214 throw InputError("solver_mam_passage_time: the PS CDF grid needs at least two "
215 "points, since F(0) = 0 is prepended rather than evaluated");
216 for (std::size_t r = 0; r < K; ++r) {
217 if (!(lamk[r] > 0.0)) continue; // no traffic: left empty, as the reference
219 mo.tagAlpha.assign(n, 0.0);
220 for (std::size_t i = 0; i < pie[r].size(); ++i) mo.tagAlpha[off[r] + i] = pie[r][i];
221 const qsys::Mg1PsResult mom = qsys::qsys_mg1_ps(lam, amix, Tmix, mo);
222 // A PS sojourn is far from Gaussian when a service phase is
223 // slow, so the support grows until it holds 1 - FineTol, from
224 // candidate ends mean + n sigma tabulated in one call.
225 const double sd = std::sqrt(std::max(mom.varUncond, 0.0));
226 qsys::Mg1PsOptions to = mo;
227 for (int j = 0; j < 8; ++j)
228 to.t.push_back(mom.meanUncond + 10.0 * std::pow(2.0, j) * sd);
229 const qsys::Mg1PsResult tail = qsys::qsys_mg1_ps(lam, amix, Tmix, to);
230 std::size_t ipos = 8;
231 for (std::size_t j = 0; j < 8; ++j)
232 if (1.0 - tail.cdfUncond[j] <= GlobalConstants::FineTol) { ipos = j; break; }
233 if (ipos == 8) {
234 ipos = 7;
235 std::cerr << "[LINE] Warning: the PS response time CDF of class " << (r + 1)
236 << " holds only " << tail.cdfUncond[7]
237 << " of its mass on the computed support.\n";
238 }
239 const double xmax = to.t[ipos];
240 std::vector<double> x(npts, 0.0);
241 if (ipos == 0) {
242 for (std::size_t i = 0; i < npts; ++i)
243 x[i] = xmax * static_cast<double>(i) / static_cast<double>(npts - 1);
244 } else {
245 // linear over the bulk, logarithmic over the slow tail
246 const std::size_t nlin = (npts + 1) / 2;
247 const double x0 = to.t[0];
248 for (std::size_t i = 0; i < nlin; ++i)
249 x[i] = x0 * static_cast<double>(i) / static_cast<double>(nlin - 1);
250 const std::size_t nlog = npts - nlin + 1;
251 const double l0 = std::log10(x0), l1 = std::log10(xmax);
252 for (std::size_t i = 1; i < nlog; ++i)
253 x[nlin - 1 + i] = std::pow(10.0, l0 + (l1 - l0) * static_cast<double>(i) /
254 static_cast<double>(nlog - 1));
255 }
256 qsys::Mg1PsOptions go = mo;
257 go.t.assign(x.begin() + 1, x.end());
258 const qsys::Mg1PsResult res = qsys::qsys_mg1_ps(lam, amix, Tmix, go);
259 out[r].X.resize(npts);
260 out[r].F.resize(npts);
261 for (std::size_t i = 0; i < npts; ++i) {
262 out[r].X[i] = num_traits<T>::from_double(x[i]);
263 out[r].F[i] = i == 0 ? zero : num_traits<T>::from_double(res.cdfUncond[i - 1]);
264 }
265 }
266 return out;
267 }
268 // MAP/M/1-PS: exponential service and, with several classes, one
269 // shared rate.
270 std::vector<T> mu(K, zero);
271 for (std::size_t r = 0; r < K; ++r) {
272 const Map<T> sv = lang::dist_to_map(L.service[q - 1][r]);
273 if (sv.D0.rows() != 1)
274 throw UnsupportedError(ErrorKind{"NonExponential"},
275 "solver_mam_passage_time: a PS queue fed by a non-Poisson MAP requires "
276 "exponential (order-1) service times; with Poisson arrivals any phase-type "
277 "service is solved exactly");
278 mu[r] = T(-sv.D0(0, 0));
279 }
280 for (std::size_t r = 1; r < K; ++r)
281 if (std::fabs(num_traits<T>::to_double(mu[r]) - num_traits<T>::to_double(mu[0])) >
283 throw UnsupportedError(ErrorKind{"MultiClass"},
284 "solver_mam_passage_time: a multiclass PS queue fed by a non-Poisson MAP "
285 "requires identical exponential service rates; with Poisson arrivals "
286 "class-dependent rates are solved exactly");
287
288 Matrix<T> Dagg(A.order(), A.order(), zero);
289 for (std::size_t c = 0; c < A.classes(); ++c)
290 for (std::size_t i = 0; i < Dagg.rows(); ++i)
291 for (std::size_t j = 0; j < Dagg.cols(); ++j) Dagg(i, j) += A.Dc[c](i, j);
292 const T lambda = map_lambda(Map<T>{A.D0, Dagg});
293 const T rho = T(lambda / mu[0]);
294 if (!(num_traits<T>::to_double(rho) < 1.0))
295 throw NumericError(ErrorKind{"Instability"},
296 "solver_mam_passage_time: the PS queue is unstable, so it has no sojourn-time "
297 "distribution");
298 const T mean = T(one / T(mu[0] * T(one - rho)));
299 const T xmax = T(mean * num_traits<T>::from_int(10));
300 std::vector<T> x(npts, zero);
301 for (std::size_t i = 0; i < npts; ++i)
302 x[i] = (npts == 1) ? xmax
304 static_cast<double>(i) /
305 static_cast<double>(npts - 1)));
306 const MapM1psResult<T> res = map_m1ps_cdfrespt(A.D0, Dagg, mu[0], x);
307 for (std::size_t r = 0; r < K; ++r) {
308 out[r].X = x;
309 out[r].F.resize(npts);
310 for (std::size_t i = 0; i < npts; ++i) out[r].F[i] = T(one - res.w_bar[i]);
311 }
312 return out;
313 }
314
315 // FCFS / HOL: the sojourn law is phase-type, straight out of the age process.
316 std::vector<PhService<T>> svc(K);
317 for (std::size_t r = 0; r < K; ++r) {
318 const double ns = L.stations[q - 1].nservers;
319 const Map<T> raw = lang::dist_to_map(L.service[q - 1][r]);
320 const T target = std::isfinite(ns)
322 : map_mean(raw);
323 const Map<T> sc = map_scale(raw, target);
324 svc[r].sigma = map_pie(sc);
325 svc[r].S = sc.D0;
326 }
327
328 if (prio_distinct) {
329 // BUTools orders the marks LOWEST priority first and LINE's lower prio
330 // is the higher priority, so the classes go in descending prio; output
331 // j belongs to class iK[j].
332 std::vector<std::size_t> iK(K);
333 for (std::size_t r = 0; r < K; ++r) iK[r] = r;
334 std::stable_sort(iK.begin(), iK.end(), [&L](std::size_t a, std::size_t b) {
335 return L.classes[a].prio > L.classes[b].prio;
336 });
337 for (std::size_t j = 1; j < K; ++j)
338 if (L.classes[iK[j]].prio == L.classes[iK[j - 1]].prio)
339 throw UnsupportedError(ErrorKind{"Priority"},
340 "solver_mam_passage_time: SolverMAM requires either identical priorities or "
341 "all distinct priorities");
342 Mmap<T> pa;
343 pa.D0 = A.D0;
344 pa.D1 = A.D1;
345 std::vector<PhService<T>> sl;
346 for (std::size_t j = 0; j < K; ++j) {
347 pa.Dc.push_back(A.Dc[iK[j]]);
348 sl.push_back(svc[iK[j]]);
349 }
350 const bool pr = (qs == SchedStrategy::FCFSPRPRIO);
351 const std::vector<std::vector<T>> moms =
352 pr ? mmapph1prpr_stmoms(pa, sl, 2) : mmapph1nppr_stmoms(pa, sl, 2);
353 double xmax = 0.0;
354 for (std::size_t j = 0; j < K; ++j) {
355 const double m1 = num_traits<T>::to_double(moms[j][0]);
356 const double m2 = num_traits<T>::to_double(moms[j][1]);
357 xmax = std::max(xmax, m1 + 10.0 * std::sqrt(std::max(m2 - m1 * m1, 0.0)));
358 }
359 std::vector<T> x(npts, zero);
360 for (std::size_t i = 0; i < npts; ++i)
361 x[i] = (npts == 1) ? num_traits<T>::from_double(xmax)
362 : num_traits<T>::from_double(xmax * static_cast<double>(i) /
363 static_cast<double>(npts - 1));
364 if (npts < 2)
365 throw InputError("solver_mam_passage_time: the priority CDF grid needs at least two "
366 "points, since F(0) = 0 is prepended rather than evaluated");
367 const std::vector<T> pts(x.begin() + 1, x.end());
368 const std::vector<std::vector<T>> dist =
369 pr ? mmapph1prpr_stdistr(pa, sl, pts) : mmapph1nppr_stdistr(pa, sl, pts);
370 for (std::size_t j = 0; j < K; ++j) {
371 RespTCdf<T>& o = out[iK[j]];
372 o.X = x;
373 o.F.assign(1, zero);
374 o.F.insert(o.F.end(), dist[j].begin(), dist[j].end());
375 }
376 return out;
377 }
378
379 const std::vector<StDistrPh<T>> ph = mmapph1fcfs_stdistr_ph(A, svc);
380
381 for (std::size_t r = 0; r < K; ++r) {
382 // Read the PH pair back as the MAP {A, (-A e) alpha} the moment and CDF
383 // routines take.
384 const std::size_t n = ph[r].A.rows();
385 Matrix<T> D1(n, n, zero);
386 for (std::size_t i = 0; i < n; ++i) {
387 T s = zero;
388 for (std::size_t j = 0; j < n; ++j) s += ph[r].A(i, j);
389 for (std::size_t j = 0; j < n; ++j) D1(i, j) = T(-s * ph[r].alpha[j]);
390 }
391 const Map<T> RDph{ph[r].A, D1};
392 const T mean = map_mean(RDph);
393 const T sigma = num_traits<T>::from_double(
394 std::sqrt(num_traits<T>::to_double(map_var(RDph))));
395 // Widen until the tail beyond the grid is negligible, as the reference does.
396 int nsig = 5;
397 for (;;) {
398 const T probe = T(mean + num_traits<T>::from_int(nsig) * sigma);
399 const std::vector<T> c = map_cdf(RDph, std::vector<T>{probe});
400 if (num_traits<T>::to_double(c[0]) >= 1.0 - GlobalConstants::FineTol) break;
401 if (++nsig > 1000)
402 throw NumericError(ErrorKind{"NonConvergence"},
403 "solver_mam_passage_time: the sojourn-time CDF did not reach one within 1000 "
404 "standard deviations");
405 }
406 const T xmax = T(mean + num_traits<T>::from_int(nsig) * sigma);
407 std::vector<T> x(npts, zero);
408 for (std::size_t i = 0; i < npts; ++i)
409 x[i] = (npts == 1) ? xmax
411 static_cast<double>(i) /
412 static_cast<double>(npts - 1)));
413 out[r].X = x;
414 out[r].F = map_cdf(RDph, x);
415 }
416 return out;
417 } // if constexpr has_transcendental
418}
419
420/**
421 * Port of the CDF path of `@@SolverMAM/getPerctRespT.m`: linear interpolation of
422 * the response-time CDF at the requested percentile levels.
423 *
424 * Duplicate CDF values are collapsed keeping the LAST, as MATLAB's
425 * `unique(probs,'last')` does, so a flat tail interpolates from the largest
426 * time carrying that probability rather than the smallest.
427 *
428 * The FJ_codes branch of the reference is not taken here: it lives in
429 * `solver_mam_get_perct_respt`, which reads `solver_mam_fj_percentiles` for a
430 * homogeneous fork-join and refuses any other fork-join before calling this.
431 */
432template <class T>
433std::vector<T> mam_percentiles_from_cdf(const RespTCdf<T>& cdf, const std::vector<double>& pcts) {
434 const T zero = num_traits<T>::from_int(0);
435 if (cdf.F.empty()) throw InputError("mam_percentiles_from_cdf: the CDF is empty");
436 std::vector<double> p, t;
437 for (std::size_t i = 0; i < cdf.F.size(); ++i) {
438 const double fi = num_traits<T>::to_double(cdf.F[i]);
439 if (!p.empty() && std::fabs(fi - p.back()) < 1e-15) {
440 t.back() = num_traits<T>::to_double(cdf.X[i]); // keep the LAST
441 continue;
442 }
443 p.push_back(fi);
444 t.push_back(num_traits<T>::to_double(cdf.X[i]));
445 }
446 std::vector<T> out(pcts.size(), zero);
447 for (std::size_t k = 0; k < pcts.size(); ++k) {
448 // Percentiles above 1 are read as percentages, as the reference does.
449 const double want = pcts[k] > 1.0 ? pcts[k] / 100.0 : pcts[k];
450 if (p.size() == 1) {
451 out[k] = num_traits<T>::from_double(t[0]);
452 continue;
453 }
454 std::size_t lo = 0;
455 while (lo + 2 < p.size() && p[lo + 1] < want) ++lo;
456 const double denom = p[lo + 1] - p[lo];
457 const double frac = (std::fabs(denom) < 1e-300) ? 0.0 : (want - p[lo]) / denom;
458 out[k] = num_traits<T>::from_double(t[lo] + frac * (t[lo + 1] - t[lo]));
459 }
460 return out;
461}
462
463} // namespace mam
464} // namespace line
465
466#endif // LINE_SOLVERS_MAM_SOLVER_MAM_PASSAGE_TIME_H
InputError(const std::string &what)
Definition error.h:105
NumericError(const std::string &what)
Definition error.h:112
UnsupportedError(const std::string &what)
Definition error.h:119
A network plus its refreshed NetworkStruct.
std::vector< std::vector< Distrib< T > > > service
service[i][r], 0-based station and class; a disabled entry marks a pair never visited.
std::vector< JobClass > classes
std::vector< Station< T > > stations
stations[k-1] is the k-th station
What refreshProcessRepresentations and refreshLST compute FROM a distribution: the (D0,...
The exception types the port throws.
The option and result types SolverMAM shares with its analyzers.
Cumulative distribution of the inter-arrival time of a MAP.
Sojourn time distribution in a MAP/M/1 processor-sharing queue.
Markovian arrival process descriptors: stationary vectors, rate, moments, autocorrelation and the ind...
MAP constructors and structural transformations.
Dense matrix and non-owning view.
The MMAP assembly primitives solver_mam_basic.m builds its per-station arrival stream from: mmap_expo...
The MMAP[K]/PH[K]/1 FCFS queue: per-class mean number in system and per-class queue-length distributi...
The MMAP[K]/PH[K]/1 priority queue, preemptive resume (mmapph1prpr_*) and non-preemptive (mmapph1nppr...
mam::Map< T > dist_to_map(const Distrib< T > &d)
The (D0,D1) pair that reaches sn.proc.
SchedStrategy
Scheduling disciplines, with the values of MATLAB SchedStrategy.
Definition lang_types.h:194
const char * sched_to_text(SchedStrategy s)
Definition lang_types.h:248
std::vector< T > mam_percentiles_from_cdf(const RespTCdf< T > &cdf, const std::vector< double > &pcts)
Port of the CDF path of @@SolverMAM/getPerctRespT.m: linear interpolation of the response-time CDF at...
T map_mean(const Map< T > &m)
Mean inter-arrival time, 1/lambda.
Definition map_moment.h:101
T map_var(const Map< T > &m)
Variance of the inter-arrival time.
Definition map_moment.h:133
std::vector< RespTCdf< T > > solver_mam_passage_time(const qn::NetworkStruct< T > &L, const MamOptions &opt)
Port of solver_mam_passage_time.m.
std::vector< std::vector< T > > mmapph1prpr_stdistr(const Mmap< T > &arrival, const std::vector< PhService< T > > &svc, const std::vector< T > &points, const PrioQueueOptions &opt=PrioQueueOptions())
Per-class sojourn-time CDF at the (strictly positive) points, preemptive resume priority.
std::vector< T > map_cdf(const Map< T > &m, const std::vector< T > &points)
Cumulative distribution of the inter-arrival time at the given points.
Definition map_cdf.h:63
std::vector< std::vector< T > > mmapph1nppr_stdistr(const Mmap< T > &arrival, const std::vector< PhService< T > > &svc, const std::vector< T > &points, const PrioQueueOptions &opt=PrioQueueOptions())
Per-class sojourn-time CDF at the (strictly positive) points, non-preemptive priority.
Map< T > map_scale(const Map< T > &in, const T &new_mean)
Rescale time so that the mean inter-arrival time becomes new_mean.
std::vector< T > map_pie(const Map< T > &m)
Phase distribution seen by an arriving job, pie = pi D1 / (pi D1 e).
Definition map_moment.h:89
std::vector< std::vector< T > > mmapph1prpr_stmoms(const Mmap< T > &arrival, const std::vector< PhService< T > > &svc, std::size_t n, const PrioQueueOptions &opt=PrioQueueOptions())
Per-class sojourn-time moments 1..n, preemptive resume priority.
std::vector< StDistrPh< T > > mmapph1fcfs_stdistr_ph(const Mmap< T > &arrival, const std::vector< PhService< T > > &svc, double precision=1e-14)
Per-class SOJOURN TIME as a continuous phase-type law, BUTools' 'stDistrPH'.
Mmap< T > mmap_super(const Mmap< T > &a, const Mmap< T > &b)
Superposition of two MMAPs: the phase process is the product chain, and the class list of the result ...
Definition mmap_lambda.h:88
std::vector< std::vector< T > > mmapph1nppr_stmoms(const Mmap< T > &arrival, const std::vector< PhService< T > > &svc, std::size_t n, const PrioQueueOptions &opt=PrioQueueOptions())
Per-class sojourn-time moments 1..n, non-preemptive priority.
T map_lambda(const Map< T > &m)
Stationary arrival rate, lambda = pi D1 e.
Definition map_moment.h:79
MapM1psResult< T > map_m1ps_cdfrespt(const Matrix< T > &C, const Matrix< T > &D, const T &mu, const std::vector< T > &x, const T &epsilon, const T &epsilon_prime)
Complementary sojourn time distribution of a MAP/M/1-PS queue by the spectral-radius truncation (map_...
Definition map_m1ps.h:494
Mg1PsResult qsys_mg1_ps(double lambda, const std::vector< double > &alpha, const Matrix< double > &Tmat, const Mg1PsOptions &opt)
Sojourn-time distribution of the M/G/1 processor-sharing queue.
Conservation laws of a layered queueing network, enumerated from its structure.
Definition aoi_dist2ph.h:51
A queueing network and its refreshed NetworkStruct.
Sojourn-time distribution of the M/G/1 processor-sharing queue.
The <kind> part of a LINE:<category>:<kind> identifier (see _kb/17-error-vocabulary....
Definition error.h:37
The MATLAB GlobalConstants, as reported by lineStart at its defaults.
Definition lang_types.h:822
static constexpr double FineTol
Definition lang_types.h:823
The options SolverMAM reads.
Definition mam_types.h:30
What the two MAP/M/1-PS sojourn entry points return.
Definition map_m1ps.h:300
std::vector< T > w_bar
Pr[W > x] at each requested point.
Definition map_m1ps.h:301
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
An MMAP: the underlying MAP plus the per-class arrival matrices.
Definition mmap_lambda.h:45
std::size_t classes() const
Definition mmap_lambda.h:51
Matrix< T > D0
Definition mmap_lambda.h:46
Matrix< T > D1
Definition mmap_lambda.h:47
std::vector< Matrix< T > > Dc
per-class matrices, sum_c Dc = D1
Definition mmap_lambda.h:48
std::size_t order() const
Definition mmap_lambda.h:50
One class's response-time CDF, the reference's RD{station, class} = [F, X].
std::vector< T > X
the points they are evaluated at
std::vector< T > F
CDF values.
One job class of the network.
double population
infinite for an open class
Options of qsys_mg1_ps, mirroring the reference's name-value pairs.
Definition qsys_mg1_ps.h:93
std::vector< double > tagAlpha
Initial vector of the TAGGED job's requirement, PH(tagAlpha, T), on the phase-type path only (empty: ...
std::vector< double > t
times to evaluate the sojourn distribution at
Definition qsys_mg1_ps.h:96
Everything qsys_mg1_ps returns.
std::vector< double > cdfUncond