LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
solver_qna.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_MVA_SOLVER_QNA_H
6#define LINE_SOLVERS_MVA_SOLVER_QNA_H
7
8/**
9 * @file
10 * @ingroup line_solvers
11 * QNA, the two-moment open-network decomposition analyzer.
12 *
13 * Templated port of `matlab/src/solvers/MVA/solver_qna.m`, which implements
14 * Section 7.2.3 of N. Gautam, "Analysis of Queues", CRC Press 2012, with
15 * corrections the reference records as agreed with the author.
16 *
17 * The structure is decomposition-aggregation. Each sweep
18 *
19 * 1. SUPERPOSES the flows into every station: a1(i,r) is the arrival rate of
20 * class r at station i and a2(i,r) the squared coefficient of variation of
21 * that superposed stream, both accumulated over the routing;
22 * 2. SOLVES each station in isolation -- an infinite server passes its input
23 * SCV straight through, a PS station takes a geometric-bound queue length,
24 * and an FCFS station takes the multiserver GI/G/c waiting-time
25 * approximation with the Whitt alpha(m) correction;
26 * 3. SPLITS the departure stream along each outgoing arc, `f2 = 1 + p (d2-k)`
27 * with k the round-robin split degree (`npfqn_traffic_split_rr`): at k = 1
28 * this is the exact SCV of a Bernoulli-thinned renewal stream, and at k > 1
29 * that of a one-in-k deterministic dispatch, which is less variable;
30 *
31 * and `da_fpi` drives the sweeps to a fixed point on the queue lengths.
32 *
33 * CLOSED CHAINS. A closed chain's throughput is not an input: each sweep finds
34 * the rate lambda_c at which the stations, solved in isolation with the current
35 * flow SCVs, hold exactly the chain's population N_c. The population is
36 * increasing in the rate and diverges as a station the chain visits saturates,
37 * so it is bracketed by that first saturation (min over FCFS and PS stations of
38 * m / D) and found by bisection; with several closed chains the rates are
39 * solved Gauss-Seidel within a sweep. The PS station takes the
40 * finite-population geometric bound (U - U^(N+1)) / (1 - U). Little's law
41 * Q = X R holds at every station by construction and no column is rescaled
42 * afterwards. `SolverMVA` still advertises `qna` for open models only (its
43 * feature set withdraws ClosedClass), exactly as the reference does, so the
44 * closed path is reached by calling the analyzer directly.
45 *
46 * OPEN CHAINS are never rescaled. The departure SCV of the Source is the
47 * rate-weighted superposition of the open chains' streams, and it seeds the
48 * flow SCVs before the first sweep, so a non-Poisson arrival stream is seen
49 * from the start and the sweeps run to their actual fixed point (Q1 = 0.75 on
50 * the Erlang tandem of the test suite). Before 2026-11-14 every codebase but
51 * the JAR rescaled each chain column by its population, which is Inf * 0 / 0 on
52 * an open chain: the NaN stopped `da_fpi` after one sweep, with every flow SCV
53 * still 1, and on a closed chain the rescale broke Q = X R.
54 *
55 * SELF-LOOPING CLASSES. The reference special-cases `sn.isslc` after the
56 * iteration. This port has no SelfLoopingClass (`JobClassType` is OPEN or
57 * CLOSED only), so that branch is unreachable and is not transcribed.
58 *
59 * Arithmetic: TRANSCENDENTAL. `da_fpi` stops on a tolerance, and the alpha(m)
60 * correction takes a real power of the utilization.
61 */
62
63#include <algorithm>
64#include <cmath>
65#include <limits>
66#include <string>
67#include <vector>
68
69#include "line/api/da/da_fpi.h"
75
76namespace line {
77namespace mva {
78
79/**
80 * Port of `solver_qna.m`.
81 *
82 * @param L the model; open, closed or mixed chains
83 * @param opt tol drives the saturation test, iter_max / iter_tol the sweeps
84 */
85template <class T>
87 using qn::NodeType;
89 if constexpr (!num_traits<T>::has_transcendental) {
90 (void)L;
91 (void)opt;
92 throw UnsupportedError(ErrorKind{"Arithmetic"},
93 "solver_qna: the decomposition sweeps stop on a tolerance and the multiserver "
94 "correction takes a real power, so exact rational arithmetic cannot run it");
95 } else {
96 const T zero = num_traits<T>::from_int(0);
97 const T one = num_traits<T>::from_int(1);
98 const std::size_t M = L.nstations, K = L.nclasses, C = L.nchains;
99
100 // One predicate for the gate and the run: qn::mva_feature_set withholds 'qna'
101 // for a discipline the station update has no arm for, and the update refuses
102 // it by name rather than leaving that station's row of Q, U, R and T at zero
103 // and returning the table as a solution.
104 {
105 const std::string qna_reason = mva_qna_scheduling_reason(L);
106 if (!qna_reason.empty()) throw UnsupportedError(ErrorKind{"Model"}, qna_reason);
107 }
108 for (std::size_t i = 0; i < M; ++i) {
109 const SchedStrategy ss = L.stations[i].sched;
110 if (L.stations[i].nodetype != NodeType::Join && ss != SchedStrategy::EXT &&
111 ss != SchedStrategy::INF && ss != SchedStrategy::PS && ss != SchedStrategy::FCFS)
112 throw UnsupportedError(ErrorKind{"SchedStrategy"},
113 std::string("solver_qna: no isolated-station solution for ") +
114 lang::sched_to_text(ss) + " scheduling");
115 }
116
117 // S = 1/rates, with a NaN scv read as zero, as the reference does
118 Matrix<T> S(M, K, zero), scv(M, K, zero);
119 for (std::size_t i = 0; i < M; ++i)
120 for (std::size_t r = 0; r < K; ++r) {
121 const T mu = L.rates(i, r);
122 S(i, r) = (mu > zero) ? T(one / mu) : zero;
123 const double v = num_traits<T>::to_double(L.scv(i, r));
124 scv(i, r) = std::isnan(v) ? zero : L.scv(i, r);
125 }
126
127 // sn.rt and sn.visits are indexed by stateful node: project them onto stations
129 const Matrix<T>& rt = rts.rtst;
130 const Matrix<T>& V = rts.Vst;
131 auto RT = [&](std::size_t i, std::size_t r, std::size_t j, std::size_t s) -> T {
132 return rt(i * K + r, j * K + s);
133 };
134
135 // chain bookkeeping
136 std::vector<int> chain_of(K, -1);
137 std::vector<double> chain_pop(C, 0.0); // N_c, infinite on an open chain
138 std::vector<std::size_t> closed_idx;
139 for (std::size_t c = 0; c < C; ++c) {
140 for (std::size_t k : L.inchain[c]) {
141 chain_of[k - 1] = static_cast<int>(c);
142 chain_pop[c] += L.classes[k - 1].population;
143 }
144 if (std::isfinite(chain_pop[c])) closed_idx.push_back(c);
145 }
146
147 // The deterministic (round-robin) split degrees, 1 where the split is
148 // Markovian; a flow thinned out of a one-in-k dispatch is the k-fold
149 // convolution, whose SCV at d2 = 1 is 1 + p (1 - k), below the renewal 1.
151 std::vector<bool> is_source(M, false);
152 for (std::size_t i = 0; i < M; ++i)
153 is_source[i] = (L.stations[i].nodetype == NodeType::Source);
154
155 // per-chain arrival rate and the SCV of the superposed source stream of
156 // each open chain
157 std::vector<T> lambda(C, zero), d2c(C, zero);
158 for (std::size_t c = 0; c < C; ++c) {
159 if (std::isfinite(chain_pop[c])) continue;
160 const std::size_t ref = L.classes[L.inchain[c][0] - 1].refstat;
161 std::vector<T> lam_in, scv_in;
162 for (std::size_t k : L.inchain[c]) {
163 lam_in.push_back(L.rates(ref - 1, k - 1));
164 scv_in.push_back(scv(ref - 1, k - 1));
165 }
166 T s = zero;
167 for (const T& x : lam_in)
168 if (std::isfinite(num_traits<T>::to_double(x))) s += x;
169 lambda[c] = s;
170 d2c[c] = da::da_traffic_superpos(lam_in, scv_in);
171 }
172 // d2(i): the SCV of the departure stream of station i, 1 until a sweep
173 // updates it. Each open chain's reference station is seeded with the
174 // rate-weighted mean over the open chains.
175 std::vector<T> d2(M, one);
176 {
177 T num = zero, den = zero;
178 for (std::size_t c = 0; c < C; ++c) {
179 if (std::isfinite(chain_pop[c])) continue;
180 num += T(d2c[c] * lambda[c]);
181 den += lambda[c];
182 }
183 if (den > zero)
184 for (std::size_t c = 0; c < C; ++c)
185 if (!std::isfinite(chain_pop[c]))
186 d2[L.classes[L.inchain[c][0] - 1].refstat - 1] = T(num / den);
187 }
188
189 // f2(i,r -> j,s): the SCV of each flow on every arc that does not end at a
190 // Source, from the departure SCVs, so the Source SCV enters the first sweep
191 Matrix<T> f2(M * K, M * K, zero);
192 auto split = [&]() {
193 for (std::size_t i = 0; i < M; ++i)
194 for (std::size_t j = 0; j < M; ++j) {
195 if (is_source[j]) continue;
196 for (std::size_t r = 0; r < K; ++r)
197 for (std::size_t s = 0; s < K; ++s)
198 if (RT(i, r, j, s) > zero)
199 // k-fold convolution then Bernoulli thinning at
200 // q = k p: C^2 = 1 + p (d2 - k), the Markovian
201 // 1 + p (d2 - 1) at k = 1
202 f2(i * K + r, j * K + s) =
203 T(one + RT(i, r, j, s) * T(d2[i] - kRR(i, r)));
204 }
205 };
206 split();
207
208 const T tol = num_traits<T>::from_double(opt.tol);
209
210 struct Eval {
211 Matrix<T> Q, U, R, Tp;
212 std::vector<T> d2;
213 std::vector<bool> sat;
214 };
215 // One decomposition at chain throughputs lam: superpose the flows into
216 // every station, then solve each station in isolation.
217 auto eval = [&](const std::vector<T>& lam) -> Eval {
218 Eval e{Matrix<T>(M, K, zero), Matrix<T>(M, K, zero), Matrix<T>(M, K, zero),
219 Matrix<T>(M, K, zero), d2, std::vector<bool>(M, false)};
220 for (std::size_t i = 0; i < M; ++i)
221 for (std::size_t k = 0; k < K; ++k)
222 if (chain_of[k] >= 0) e.Tp(i, k) = T(V(i, k) * lam[chain_of[k]]);
223
224 // ---- superposition ------------------------------------------------
225 Matrix<T> a1(M, K, zero), a2(M, K, zero);
226 for (std::size_t j = 0; j < M; ++j)
227 for (std::size_t s = 0; s < K; ++s) {
228 const T tjs = e.Tp(j, s);
229 if (!(tjs > zero)) continue;
230 for (std::size_t i = 0; i < M; ++i)
231 for (std::size_t r = 0; r < K; ++r) {
232 const T p = RT(j, s, i, r);
233 if (!(p > zero)) continue;
234 a1(i, r) = T(a1(i, r) + tjs * p);
235 a2(i, r) = T(a2(i, r) + tjs * f2(j * K + s, i * K + r) * p);
236 }
237 }
238 for (std::size_t i = 0; i < M; ++i) {
239 T lambda_i = zero;
240 for (std::size_t k = 0; k < K; ++k) lambda_i += e.Tp(i, k);
241 for (std::size_t k = 0; k < K; ++k)
242 a2(i, k) = lambda_i > zero ? T(a2(i, k) / lambda_i) : zero;
243 }
244
245 // ---- solve each station in isolation ------------------------------
246 for (std::size_t i = 0; i < M; ++i) {
247 if (L.stations[i].nodetype == NodeType::Join) continue; // no service
248 T a2sum = zero, lambda_i = zero;
249 for (std::size_t k = 0; k < K; ++k) {
250 a2sum += a2(i, k);
251 lambda_i += a1(i, k);
252 }
253 switch (L.stations[i].sched) {
254 case SchedStrategy::INF: {
255 // an infinite server passes its input SCV through
256 e.d2[i] = a2sum;
257 for (std::size_t k = 0; k < K; ++k) {
258 if (a1(i, k) > zero) {
259 e.Tp(i, k) = a1(i, k);
260 e.Q(i, k) = T(e.Tp(i, k) * S(i, k));
261 e.U(i, k) = e.Q(i, k);
262 e.R(i, k) = S(i, k);
263 } else {
264 e.Tp(i, k) = zero;
265 }
266 }
267 break;
268 }
269 case SchedStrategy::PS: {
270 T usum = zero;
271 for (std::size_t k = 0; k < K; ++k) {
272 if (a1(i, k) > zero) {
273 e.Tp(i, k) = a1(i, k);
274 e.U(i, k) = T(S(i, k) * e.Tp(i, k));
275 } else {
276 e.Tp(i, k) = zero;
277 }
278 usum += e.U(i, k);
279 }
280 e.sat[i] = !(usum < T(one - tol));
281 const T uden = usum < T(one - tol) ? usum : T(one - tol);
282 for (std::size_t k = 0; k < K; ++k) {
283 if (!(e.Tp(i, k) > zero)) continue;
284 using std::pow;
285 // the finite-population geometric bound
286 // (U - U^(Nc+1)) / (1 - Uden); on an open chain Nc is
287 // infinite and U^(Nc+1) is 0 below 1 and Inf above it
288 const double Nc = chain_pop[chain_of[k]];
289 const T Uk = e.U(i, k);
290 const T tail = std::isfinite(Nc)
291 ? T(pow(Uk, num_traits<T>::from_double(Nc + 1.0)))
293 std::pow(num_traits<T>::to_double(Uk), Nc));
294 e.Q(i, k) = T(T(Uk - tail) / T(one - uden));
295 e.R(i, k) = T(e.Q(i, k) / e.Tp(i, k));
296 }
297 // PS is quasi-reversible and insensitive to the service
298 // law, so the departure SCV interpolates between the input
299 // SCV and the Poisson value 1
300 e.d2[i] = e.sat[i] ? one : T(one + T(one - usum * usum) * T(a2sum - one));
301 break;
302 }
303 case SchedStrategy::FCFS: {
304 using std::pow;
305 using std::sqrt;
307 std::vector<T> mu(K, zero);
308 T rho = zero;
309 for (std::size_t r = 0; r < K; ++r) {
310 const double m = num_traits<T>::to_double(L.rates(i, r));
311 mu[r] = std::isnan(m) ? zero : L.rates(i, r);
312 const T den = T(ftol + mu[r]);
313 T rc = den > zero ? T(a1(i, r) / den) : zero;
314 if (std::isnan(num_traits<T>::to_double(rc))) rc = zero;
315 rho += rc;
316 }
317 const T mi = num_traits<T>::from_double(L.stations[i].nservers);
318 rho = T(rho / mi);
319 if (!(lambda_i > zero)) {
320 e.d2[i] = one;
321 } else if (rho < T(one - tol)) {
322 // Whitt's alpha(m): the heavier form above rho = 0.7
323 const T alpha = num_traits<T>::to_double(rho) > 0.7
324 ? T(T(pow(rho, mi) + rho) / num_traits<T>::from_int(2))
325 : T(pow(rho, T(T(mi + one) / num_traits<T>::from_int(2))));
326 const T mubar = T(lambda_i / rho);
327 T c2 = T(-one);
328 for (std::size_t r = 0; r < K; ++r) {
329 if (!(mu[r] > zero)) continue;
330 const T q = T(mubar / mi / mu[r]);
331 c2 += T(a1(i, r) / lambda_i * q * q * T(scv(i, r) + one));
332 }
333 const T Wiq = T(T(alpha / mubar) * T(one / T(one - rho)) *
334 T(T(a2sum + c2) / num_traits<T>::from_int(2)));
335 for (std::size_t k = 0; k < K; ++k)
336 if (a1(i, k) > zero && mu[k] > zero)
337 e.Q(i, k) = T(a1(i, k) / mu[k] + a1(i, k) * Wiq);
338 e.d2[i] = T(one + T(rho * rho * T(c2 - one) / sqrt(mi)) +
339 T(T(one - rho * rho) * T(a2sum - one)));
340 } else {
341 // saturated: the queue length is parked at the class
342 // population, which is infinite on an open class
343 e.sat[i] = true;
344 for (std::size_t k = 0; k < K; ++k)
345 e.Q(i, k) = num_traits<T>::from_double(L.classes[k].population);
346 e.d2[i] = one;
347 }
348 for (std::size_t k = 0; k < K; ++k) {
349 e.Tp(i, k) = a1(i, k);
350 if (e.Tp(i, k) > zero) {
351 e.U(i, k) = T(e.Tp(i, k) * S(i, k) / mi);
352 e.R(i, k) = T(e.Q(i, k) / e.Tp(i, k));
353 }
354 }
355 break;
356 }
357 default:
358 // EXT (a Source or a Sink) carries no queue; every other
359 // discipline was refused on entry
360 break;
361 }
362 }
363 return e;
364 };
365
366 // population of closed chain c when its throughput is x, the others fixed;
367 // infinite once a station the chain visits saturates
368 auto chain_pop_at = [&](std::size_t c, const T& x) -> double {
369 std::vector<T> lamtry = lambda;
370 lamtry[c] = x;
371 const Eval e = eval(lamtry);
372 double pop = 0.0;
373 for (std::size_t i = 0; i < M; ++i) {
374 bool visited = false;
375 for (std::size_t k : L.inchain[c]) {
376 visited = visited || V(i, k - 1) > zero;
377 pop += num_traits<T>::to_double(e.Q(i, k - 1));
378 }
379 if (visited && e.sat[i]) return std::numeric_limits<double>::infinity();
380 }
381 return pop;
382 };
383
384 // Throughput of closed chain c at which the stations, solved in isolation
385 // with the current flow SCVs, hold exactly N_c jobs: bisection on the rate,
386 // bracketed above by the first saturation.
387 auto closed_rate = [&](std::size_t c) -> T {
388 const double Nc = chain_pop[c];
389 bool bounded = false;
390 T hi = zero;
391 for (std::size_t j = 0; j < M; ++j) {
392 const SchedStrategy ss = L.stations[j].sched;
393 if (ss != SchedStrategy::FCFS && ss != SchedStrategy::PS) continue;
394 T Dj = zero;
395 for (std::size_t k : L.inchain[c])
396 if (V(j, k - 1) > zero && S(j, k - 1) > zero) Dj += T(V(j, k - 1) * S(j, k - 1));
397 if (!(Dj > zero)) continue;
398 const T cap = ss == SchedStrategy::PS
399 ? T(one / Dj)
400 : T(num_traits<T>::from_double(L.stations[j].nservers) / Dj);
401 if (!bounded || cap < hi) hi = cap;
402 bounded = true;
403 }
404 if (!bounded) { // only infinite servers: the population is linear in the rate
405 hi = one;
406 while (chain_pop_at(c, hi) < Nc) hi = T(hi * num_traits<T>::from_int(2));
407 }
408 T lo = zero;
409 for (int b = 0; b < 200; ++b) {
410 const T mid = T(T(lo + hi) / num_traits<T>::from_int(2));
411 if (chain_pop_at(c, mid) < Nc)
412 lo = mid;
413 else
414 hi = mid;
415 const double hd = num_traits<T>::to_double(hi);
416 if (num_traits<T>::to_double(T(hi - lo)) <=
417 4.0 * (std::nextafter(hd, std::numeric_limits<double>::infinity()) - hd))
418 break;
419 }
420 return lo;
421 };
422
423 Matrix<T> Tp(M, K, zero), Q(M, K, zero), U(M, K, zero), Rt(M, K, zero);
424 // One sweep: solve the closed chains' throughputs, decompose, split.
425 // `da_fpi` iterates it on the flattened queue lengths.
426 auto sweep = [&](const std::vector<T>& qin,
427 std::size_t) -> std::pair<std::vector<T>, std::vector<T>> {
428 if (!closed_idx.empty()) {
429 // Gauss-Seidel over the closed chains, each one's throughput solved
430 // for its population given the others' current throughputs
431 for (int pass = 0; pass < opt.iter_max; ++pass) {
432 for (std::size_t c : closed_idx) lambda[c] = closed_rate(c);
433 const Eval ep = eval(lambda);
434 double poperr = 0.0;
435 for (std::size_t c : closed_idx) {
436 double s = 0.0;
437 for (std::size_t i = 0; i < M; ++i)
438 for (std::size_t k : L.inchain[c])
439 s += num_traits<T>::to_double(ep.Q(i, k - 1));
440 poperr = std::max(poperr, std::fabs(s - chain_pop[c]) / chain_pop[c]);
441 }
442 if (closed_idx.size() == 1 || poperr < GlobalConstants::FineTol) break;
443 }
444 }
445 const Eval e = eval(lambda);
446 Q = e.Q;
447 U = e.U;
448 Rt = e.R;
449 Tp = e.Tp;
450 d2 = e.d2;
451 split();
452 std::vector<T> qnew(M * K, zero);
453 for (std::size_t i = 0; i < M; ++i)
454 for (std::size_t k = 0; k < K; ++k) qnew[i * K + k] = Q(i, k);
455 return std::make_pair(qnew, qin);
456 };
457
459 // the legacy while-loop ran one extra sweep at the cap; a saturated open
460 // station gives an Inf queue, hence a NaN measure that stops the sweeps
461 fo.iter_max = static_cast<std::size_t>(opt.iter_max) + 1;
462 fo.iter_tol = opt.iter_tol;
463 fo.nanstop = true;
464 const da::FpiResult<T> fr = da::da_fpi<T>(sweep, std::vector<T>(M * K, zero), fo);
465
466 MvaSolution<T> out;
467 out.Q = Q;
468 out.U = U;
469 out.R = Rt;
470 out.Tp = Tp;
471 out.C.assign(K, zero);
472 out.X.assign(K, zero);
473 for (std::size_t k = 0; k < K; ++k)
474 for (std::size_t i = 0; i < M; ++i) out.C[k] += Rt(i, k);
475 // the reference takes |Q| and maps every NaN to zero on the way out
476 auto clean = [](Matrix<T>& A) {
477 for (std::size_t i = 0; i < A.rows(); ++i)
478 for (std::size_t j = 0; j < A.cols(); ++j)
479 if (std::isnan(num_traits<T>::to_double(A(i, j))))
480 A(i, j) = num_traits<T>::from_int(0);
481 };
482 for (std::size_t i = 0; i < out.Q.rows(); ++i)
483 for (std::size_t j = 0; j < out.Q.cols(); ++j)
484 if (out.Q(i, j) < zero) out.Q(i, j) = T(-out.Q(i, j));
485 clean(out.Q);
486 clean(out.U);
487 clean(out.R);
488 for (std::size_t k = 0; k < K; ++k)
489 if (std::isnan(num_traits<T>::to_double(out.C[k]))) out.C[k] = zero;
490 out.method = "qna";
491 out.iter = static_cast<int>(fr.iterations);
492 out.lG = 0.0;
493 return out;
494 }
495}
496
497} // namespace mva
498} // namespace line
499
500#endif // LINE_SOLVERS_MVA_SOLVER_QNA_H
UnsupportedError(const std::string &what)
Definition error.h:119
A network plus its refreshed NetworkStruct.
std::vector< JobClass > classes
std::vector< Station< T > > stations
stations[k-1] is the k-th station
Matrix< T > rates
(nstations x nclasses) service rates and SCVs, with a PARALLEL disabled flag instead of MATLAB's NaN ...
std::vector< std::vector< std::size_t > > inchain
1-based class indices per chain
Damped fixed-point iteration, the shared driver of the decomposition algorithms.
Superposition of independent renewal flows (Whitt's QNA stationary-interval method).
The option and result types every MVA analyzer shares.
SnRtStations< T > sn_rt_stations(const qn::NetworkStruct< T > &sn)
T da_traffic_superpos(const std::vector< T > &lambda, const std::vector< T > &a2)
Superposition of independent renewal flows (Whitt's QNA stationary-interval method).
FpiResult< T > da_fpi(const std::function< std::pair< std::vector< T >, std::vector< T > >(const std::vector< T > &, std::size_t)> &iterfun, const std::vector< T > &x0, const FpiOptions &options=FpiOptions())
Damped fixed-point iteration, the shared driver of the decomposition algorithms.
Definition da_fpi.h:102
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
NodeType
Node kinds, with the values of MATLAB NodeType.
Definition lang_types.h:345
MvaSolution< T > solver_qna(const qn::NetworkStruct< T > &L, const MvaOptions &opt)
Port of solver_qna.m.
Definition solver_qna.h:86
std::string mva_qna_scheduling_reason(const qn::NetworkStruct< T > &L)
QNA's station update has an arm for INF, PS and FCFS and none for any other discipline,...
Definition mva_types.h:284
Matrix< T > npfqn_traffic_split_rr(const qn::NetworkStruct< T > &sn)
Port of npfqn_traffic_split_rr.m.
Conservation laws of a layered queueing network, enumerated from its structure.
Definition aoi_dist2ph.h:51
A queueing network and its refreshed NetworkStruct.
Deterministic (round-robin) split degrees of every station-class departure stream.
Port of matlab/src/api/sn/sn_rt_stations.m.
The <kind> part of a LINE:<category>:<kind> identifier (see _kb/17-error-vocabulary....
Definition error.h:37
What sn_rt_stations returns: the complemented routing and the station visits.
Matrix< T > rtst
(nstations*nclasses) square, STATION-major rows
Matrix< T > Vst
(nstations x nclasses), cellsum(sn.visits) by station
Options mirroring the fields MATLAB reads off the options struct.
Definition da_fpi.h:50
std::size_t iter_max
Definition da_fpi.h:51
bool nanstop
stop when the increment norm is NaN (the reference's isnan test)
Definition da_fpi.h:55
std::size_t iterations
Definition da_fpi.h:88
static constexpr double FineTol
Definition lang_types.h:823
The options SolverMVA reads.
Definition mva_types.h:32
Class-level results, the [Q,U,R,T,C,X] of the MATLAB analyzers.
Definition mva_types.h:97
std::vector< T > X
Definition mva_types.h:99
double lG
log of the normalizing constant, the reference's lG.
Definition mva_types.h:119
std::vector< T > C
Definition mva_types.h:99