LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
npfqn_sqd.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_NPFQN_SQD_H
6#define LINE_API_NPFQN_SQD_H
7
8/**
9 * @file
10 * @ingroup api_npfqn
11 * Smith Queue Decomposition (SQD): approximate MVA for closed networks under
12 * Blocking-After-Service (manufacturing / transfer blocking).
13 *
14 * Templated port of matlab/src/api/npfqn/npfqn_sqd.m. Each finite-buffer
15 * station is described by a load-dependent EFFECTIVE service rate calibrated
16 * from an M/M/1/K blocking probability, and downstream blocking is propagated
17 * through the effective routing between service stations. The recursion is an
18 * AMVA-style sweep over the population 1..N:
19 *
20 * mu_i(n) = n V1_i exp( -[ max(0, (n-1)/beta_i) ]^{gamma_i} ) (13)
21 * W^buf_i = (1 + n) / mu_i(n) (18)
22 * W^svr_i = ST_i (1 + L^svr_i) + (server blocking time) (17)
23 * X = pop / sum_i V_i (W^buf_i + W^svr_i)
24 * L^buf_i = X V_i W^buf_i, L^svr_i = X V_i W^svr_i
25 *
26 * with V1_i deflated by the blocking probability after every population step.
27 * Delay (INF / EXT) stations are infinite-capacity pure delays. The method is
28 * single-chain: it consumes the CHAIN-AGGREGATED demands, i.e. the first
29 * column of MATLAB's sn_get_demands_chain output.
30 *
31 * SIGNATURE. MATLAB's entry point is `npfqn_sqd(sn, N, ...)` and its first act
32 * is to unpack `sn` into six plain arrays; after that line the routine is pure
33 * numerics with no reference to the model layer at all. The port therefore
34 * takes those arrays directly, exactly as the whole pfqn_* family takes L, N, Z
35 * rather than a Network. THE NAME IS UNCHANGED so that the registry keeps its
36 * one-to-one mapping to the MATLAB source. To reconstruct the MATLAB call, a
37 * caller unpacks:
38 *
39 * ST = STchain(:,1) from sn_get_demands_chain(sn)
40 * V = Vchain(:,1) from sn_get_demands_chain(sn)
41 * isDelay(i) = sn.sched(i) is SchedStrategy.INF or .EXT
42 * cap(i) = infinity when isDelay(i), else sn.cap(i), with any
43 * sn.cap(i) > 1e14 also treated as infinite
44 * rt = sn.rt (stateful-indexed routing matrix)
45 * stationToStateful = sn.stationToStateful (ONE-based, as MATLAB stores it)
46 * nclasses = sn.nclasses
47 * N = sn.nclosedjobs when the caller passes nothing
48 *
49 * `computeEffectiveRouting` is NOT hoisted out: collapsing pass-through delay
50 * nodes into a station-to-station chain is algorithm content, not unpacking, so
51 * it is ported here and reads `rt` in the same class-1 slice the reference does,
52 * rt((sf_i-1) nclasses + 1, (sf_j-1) nclasses + 1).
53 *
54 * NO ARITY-COLLIDING OVERLOAD. MATLAB accepts one to seven positional
55 * arguments; every overload here takes eight or nine, and of unrelated types,
56 * so a call transcribed from MATLAB cannot bind to one of them and silently
57 * solve a different model.
58 *
59 * Arithmetic: TRANSCENDENTAL, double and Real only. `exp` in (13), `log` in the
60 * (beta, gamma) calibration, and real powers in both the calibration and the
61 * M/M/1/K blocking probability rho^K / (1 - rho^{K+1}).
62 *
63 * UNEXPLAINED CONSTANTS, reproduced verbatim and NOT rationalized here.
64 * `INITIAL_V1 = 692.192` is the default initial value of the effective-rate
65 * scale V1_i, and `CALIBRATION_EPSILON = 0.05` is the target V_b of the fixed
66 * heuristic calibration (mode 1). Neither is derived anywhere in the reference;
67 * both arrive from the original SolverDBT contribution (Avinash Bommareddy,
68 * Imperial College London FYP, 2026). 692.192 in particular has no stated
69 * units or provenance, and the results DO depend on it whenever the population
70 * sweep is short enough that the deflation V1 <- V1 (1 - pBlock) has not washed
71 * the initial value out. Treat it as an inherited magic number pending an
72 * answer from the contributor, not as a tuned parameter.
73 *
74 * REFERENCE DEFECTS: none found. Reproduces MATLAB to 1e-15 relative on every
75 * combination of the four option switches tried.
76 *
77 * JOB-HOLE DUALITY. Station i of a closed cyclic BAS tandem holds at most
78 * K_i + 1 jobs (its buffer plus a job blocked on its server), so with
79 * C = sum_i (K_i + 1) the empty places of the population-N network form a
80 * closed network of C - N holes travelling the cycle BACKWARDS: a job leaving i
81 * for i+1 moves a hole from i+1 to i at the rate of server i, so dual station j
82 * serves at the rate of its predecessor and keeps its own capacity. Exactly,
83 * X(N) = X_dual(C-N) and Q_j(N) = K_j + 1 - H_j(C-N). The recursion has no
84 * mechanism that turns throughput down past the peak (0.857 against an exact
85 * 0.800 for the two-station K = [4,4] network at N = 6), so whenever the
86 * stations form one deterministic cycle with no delay and 2N > C, the network
87 * is solved as its lower-population dual, as the reference does.
88 */
89
90#include <cmath>
91#include <cstddef>
92#include <limits>
93#include <string>
94#include <vector>
95
96#include "line/num/number.h"
97#include "line/util/error.h"
98#include "line/util/matrix.h"
99
100namespace line {
101namespace npfqn {
102
103/** Return value of npfqn_sqd, mirroring [X, Q, U, R]. */
104template <class T>
105struct SqdResult {
106 std::vector<T> X; ///< (M) per-station throughput
107 std::vector<T> Q; ///< (M) per-station queue length
108 std::vector<T> U; ///< (M) per-station utilization, capped at one
109 std::vector<T> R; ///< (M) per-station residence time
110};
111
112/** The four option switches of the reference, with its defaults. */
113template <class T>
115 /// 0 = base (beta = K, gamma = 1), 1 = fixed heuristic, 2 = blocking-aware
117 /// include the server-blocking-time term in W^svr (MATLAB serverBlockingTime)
119 /// true = MATLAB neighborMode 'ownserver', false = 'downstream'
120 bool ownServerNeighbor = false;
121 /// true = MATLAB v1Policy 'fresh', false = 'compound'
122 bool freshV1 = false;
123 /// per-station initial V1; empty selects INITIAL_V1 for every station
124 std::vector<T> initialV1;
125};
126
127namespace detail {
128
129/** Infinite-capacity test; the routine is gated to inexact T, so this is safe. */
130template <class T>
131bool sqd_is_inf(const T& v) {
132 return !std::isfinite(num_traits<T>::to_double(v));
133}
134
135/** Steady-state blocking probability of an M/M/1/K queue at load rho. */
136template <class T>
137T sqd_mm1k_blocking(const T& K, const T& rho) {
138 using std::pow;
139 const T zero = num_traits<T>::from_int(0), one = num_traits<T>::from_int(1);
140 if (rho <= num_traits<T>::from_double(1e-15)) return zero;
141 if (num_abs(T(rho - one)) < num_traits<T>::from_double(1e-9))
142 return T(one / T(K + one));
143 return T(T(one - rho) * pow(rho, K) / T(one - pow(rho, T(K + one))));
144}
145
146/** Calibrate (beta, gamma) of the load-dependent effective service rate. */
147template <class T>
148void sqd_beta_gamma(const T& K, const T& pBlockDown, int mode, const T& calEps, T& beta,
149 T& gamma) {
150 using std::log;
151 using std::pow;
152 const T one = num_traits<T>::from_int(1);
153 const T a = num_traits<T>::from_int(2);
154 if (K <= a || sqd_is_inf(K)) {
155 beta = K;
156 gamma = one;
157 return;
158 }
159 const T b = K;
160 T Va, Vb;
161 if (mode == 2) { // blocking-aware
162 T pK = pBlockDown;
163 const T lo = num_traits<T>::from_double(1e-6);
164 const T hi = T(one - lo);
165 if (pK > hi) pK = hi;
166 if (pK < lo) pK = lo;
167 Va = T(one - pK * T(a - one) / T(b - one));
168 Vb = T(one - pK);
169 } else if (mode == 1) { // fixed heuristic
170 Va = T(T(b - a) / b);
171 Vb = calEps;
172 } else { // mode 0: base
173 beta = K;
174 gamma = one;
175 return;
176 }
177 const T va_hi = num_traits<T>::from_double(0.999);
178 const T va_lo = num_traits<T>::from_double(0.01);
179 const T vb_lo = num_traits<T>::from_double(1e-6);
180 if (Va > va_hi) Va = va_hi;
181 if (Va < va_lo) Va = va_lo;
182 if (Vb < vb_lo) Vb = vb_lo;
183 if (Vb >= Va) {
184 beta = K;
185 gamma = one;
186 return;
187 }
188 const T lnVa = log(Va);
189 const T lnVb = log(Vb);
190 gamma = T(log(T(lnVa / lnVb)) / log(T(T(a - one) / T(b - one))));
191 const T g_lo = num_traits<T>::from_double(0.5);
192 const T g_hi = num_traits<T>::from_int(10);
193 if (gamma < g_lo) gamma = g_lo;
194 if (gamma > g_hi) gamma = g_hi;
195 beta = T(T(a - one) / pow(T(-lnVa), T(one / gamma)));
196 if (!std::isfinite(num_traits<T>::to_double(gamma)) ||
197 !std::isfinite(num_traits<T>::to_double(beta)) ||
198 beta <= num_traits<T>::from_int(0)) {
199 beta = K;
200 gamma = one;
201 }
202}
203
204/**
205 * Station-to-station effective routing, collapsing pass-through delay nodes.
206 * Reads the class-1 slice of the stateful-indexed routing matrix, exactly as
207 * MATLAB's computeEffectiveRouting does.
208 */
209template <class T>
210Matrix<T> sqd_effective_routing(const Matrix<T>& rt,
211 const std::vector<std::size_t>& stationToStateful,
212 std::size_t nclasses, const std::vector<bool>& isDelay) {
213 const std::size_t M = isDelay.size();
214 const T zero = num_traits<T>::from_int(0);
215 Matrix<T> p(M, M, zero);
216 const auto rtat = [&](std::size_t i, std::size_t j) {
217 // stationToStateful is one-based, as MATLAB stores it
218 const std::size_t ri = (stationToStateful[i] - 1) * nclasses;
219 const std::size_t rj = (stationToStateful[j] - 1) * nclasses;
220 if (ri >= rt.rows() || rj >= rt.cols())
221 throw InputError("npfqn_sqd: stationToStateful indexes outside the routing matrix");
222 return rt(ri, rj);
223 };
224 for (std::size_t i = 0; i < M; ++i) {
225 if (isDelay[i]) continue;
226 for (std::size_t j = 0; j < M; ++j) {
227 const T p_ij = rtat(i, j);
228 if (p_ij <= zero) continue;
229 if (!isDelay[j]) {
230 p(i, j) += p_ij;
231 } else {
232 for (std::size_t k = 0; k < M; ++k) {
233 if (isDelay[k]) continue;
234 const T p_jk = rtat(j, k);
235 if (p_jk > zero) p(i, k) += p_ij * p_jk;
236 }
237 }
238 }
239 }
240 return p;
241}
242
243} // namespace detail
244
245namespace detail {
246
247/** The SQD population recursion on explicit per-station data. */
248template <class T>
249SqdResult<T> sqd_recursion(const std::vector<T>& ST, const std::vector<T>& V,
250 const std::vector<T>& cap, const std::vector<bool>& isDelay,
251 const Matrix<T>& pEff, int N, const SqdOptions<T>& opt) {
252 using std::exp;
253 using std::pow;
254 const std::size_t M = ST.size();
255 const T zero = num_traits<T>::from_int(0), one = num_traits<T>::from_int(1);
256 const T INITIAL_V1 = num_traits<T>::from_double(692.192);
257 const T CALIBRATION_EPSILON = num_traits<T>::from_double(0.05);
258 const T tiny = num_traits<T>::from_double(1e-10);
259 const T eps15 = num_traits<T>::from_double(1e-15);
260
261 std::vector<T> V1(M, zero), v1init(M, zero), L_buf(M, zero), L_svr(M, zero);
262 for (std::size_t i = 0; i < M; ++i) {
263 v1init[i] = opt.initialV1.empty() ? INITIAL_V1 : opt.initialV1[i];
264 V1[i] = v1init[i];
265 }
266 T X = zero;
267 std::vector<T> W_buf(M, zero), W_svr(M, zero);
268
269 for (int pop = 1; pop <= N; ++pop) {
270 // ---- wait times ------------------------------------------------------
271 for (std::size_t i = 0; i < M; ++i) {
272 if (isDelay[i]) {
273 W_buf[i] = zero;
274 W_svr[i] = ST[i];
275 continue;
276 }
277 T pBlockDown = zero;
278 if (opt.ownServerNeighbor) {
279 if (!detail::sqd_is_inf(cap[i]))
280 pBlockDown = detail::sqd_mm1k_blocking(cap[i], T(X * V[i] * ST[i]));
281 } else {
282 for (std::size_t j = 0; j < M; ++j)
283 if (!isDelay[j] && pEff(i, j) > zero && !detail::sqd_is_inf(cap[j]))
284 pBlockDown += pEff(i, j) *
285 detail::sqd_mm1k_blocking(cap[j], T(X * V[j] * ST[j]));
286 }
287
288 T n = zero;
289 if (opt.ownServerNeighbor) {
290 n = L_svr[i];
291 } else {
292 for (std::size_t j = 0; j < M; ++j) n += pEff(i, j) * L_svr[j];
293 }
294
295 T mu_n;
296 if (n < tiny) {
297 mu_n = V1[i];
298 } else {
299 T beta, gamma;
300 detail::sqd_beta_gamma(cap[i], pBlockDown, opt.calibrationMode,
301 CALIBRATION_EPSILON, beta, gamma);
302 T base = T(T(n - one) / beta);
303 if (base < zero) base = zero;
304 const T expArg = pow(base, gamma);
305 mu_n = T(n * V1[i] * exp(T(-expArg))); // Eq. 13
306 }
307 if (mu_n < tiny) mu_n = tiny;
308
309 W_buf[i] = T(one / mu_n * T(one + n)); // Eq. 18
310 W_svr[i] = T(ST[i] * T(one + L_svr[i])); // Eq. 17
311
312 if (opt.serverBlockingTime) {
313 T bt = zero;
314 for (std::size_t j = 0; j < M; ++j) {
315 if (isDelay[j] || !(pEff(i, j) > zero) || detail::sqd_is_inf(cap[j])) continue;
316 const T pBj = detail::sqd_mm1k_blocking(cap[j], T(X * V[j] * ST[j]));
317 const T denom = T(ST[i] + ST[j]);
318 T theta = zero;
319 if (denom > eps15) theta = T(ST[j] / denom);
320 bt += pEff(i, j) * pBj * ST[j] * theta;
321 }
322 W_svr[i] += bt;
323 }
324 }
325
326 // ---- throughput ------------------------------------------------------
327 T sumVW = zero;
328 for (std::size_t i = 0; i < M; ++i) sumVW += V[i] * T(W_buf[i] + W_svr[i]);
329 X = (sumVW > eps15) ? T(num_traits<T>::from_int(pop) / sumVW) : zero;
330
331 // ---- queue lengths ---------------------------------------------------
332 for (std::size_t i = 0; i < M; ++i) {
333 L_buf[i] = X * V[i] * W_buf[i];
334 L_svr[i] = X * V[i] * W_svr[i];
335 }
336
337 // ---- deflate V1 ------------------------------------------------------
338 if (pop < N) {
339 for (std::size_t i = 0; i < M; ++i) {
340 if (isDelay[i]) continue;
341 T pBlock = zero;
342 if (opt.ownServerNeighbor) {
343 if (!detail::sqd_is_inf(cap[i]))
344 pBlock = detail::sqd_mm1k_blocking(cap[i], T(X * V[i] * ST[i]));
345 } else {
346 for (std::size_t j = 0; j < M; ++j)
347 if (!isDelay[j] && pEff(i, j) > zero && !detail::sqd_is_inf(cap[j]))
348 pBlock += pEff(i, j) *
349 detail::sqd_mm1k_blocking(cap[j], T(X * V[j] * ST[j]));
350 }
351 V1[i] = opt.freshV1 ? T(v1init[i] * T(one - pBlock))
352 : T(V1[i] * T(one - pBlock));
353 if (V1[i] < tiny) V1[i] = tiny;
354 }
355 }
356 }
357
358 SqdResult<T> res;
359 res.X.assign(M, zero);
360 res.Q.assign(M, zero);
361 res.U.assign(M, zero);
362 res.R.assign(M, zero);
363 for (std::size_t i = 0; i < M; ++i) {
364 const T T_i = X * V[i];
365 const T Q_i = T(L_buf[i] + L_svr[i]);
366 const T W_tot = T(W_buf[i] + W_svr[i]);
367 res.X[i] = T_i;
368 res.Q[i] = Q_i;
369 res.R[i] = (T_i > eps15) ? T(Q_i / T_i) : W_tot;
370 const T u = T(T_i * ST[i]);
371 res.U[i] = (u < one) ? u : one;
372 }
373 return res;
374}
375
376/**
377 * True when the service stations form ONE deterministic cycle through every
378 * station, all of finite capacity; pred[j] is the station that feeds j.
379 */
380template <class T>
381bool sqd_cyclic_tandem(const Matrix<T>& pEff, const std::vector<bool>& isDelay,
382 const std::vector<T>& cap, std::vector<std::size_t>& pred) {
383 const std::size_t M = isDelay.size();
384 pred.assign(M, 0);
385 if (M < 2) return false;
386 for (std::size_t i = 0; i < M; ++i)
387 if (isDelay[i] || sqd_is_inf(cap[i])) return false;
388 const T one = num_traits<T>::from_int(1);
389 const T tol = num_traits<T>::from_double(1e-9);
390 std::vector<std::size_t> succ(M, 0);
391 for (std::size_t i = 0; i < M; ++i) {
392 std::size_t hits = 0;
393 T rowsum = num_traits<T>::from_int(0);
394 for (std::size_t j = 0; j < M; ++j) {
395 rowsum += pEff(i, j);
396 if (pEff(i, j) > T(one - tol)) {
397 succ[i] = j;
398 ++hits;
399 }
400 }
401 const T dev = T(rowsum - one);
402 if (hits != 1 || succ[i] == i || dev > tol || dev < T(-tol)) return false;
403 }
404 std::vector<bool> seen(M, false);
405 std::size_t i = 0;
406 for (std::size_t step = 0; step < M; ++step) {
407 if (seen[i]) return false;
408 seen[i] = true;
409 pred[succ[i]] = i;
410 i = succ[i];
411 }
412 return i == 0;
413}
414
415} // namespace detail
416
417/**
418 * @brief Smith Queue Decomposition (SQD): approximate MVA for closed networks
419 * under Blocking-After-Service (manufacturing / transfer blocking).
420 *
421 * @param ST (M) chain-aggregated service times, STchain(:,1)
422 * @param V (M) chain-aggregated visit ratios, Vchain(:,1)
423 * @param cap (M) buffer capacities; use infinity for unbounded
424 * @param isDelay (M) true at the INF / EXT stations
425 * @param rt stateful-indexed routing matrix (sn.rt)
426 * @param stationToStateful (M) ONE-based station-to-stateful map
427 * @param nclasses class count, the stride of rt
428 * @param N total closed population
429 * @param opt the four option switches and the initial V1
430 */
431template <class T>
432SqdResult<T> npfqn_sqd(const std::vector<T>& ST, const std::vector<T>& V,
433 const std::vector<T>& cap, const std::vector<bool>& isDelay,
434 const Matrix<T>& rt, const std::vector<std::size_t>& stationToStateful,
435 std::size_t nclasses, int N, const SqdOptions<T>& opt) {
437 "npfqn_sqd requires transcendental arithmetic (the effective-rate "
438 "calibration uses exp, log and real powers)");
439 const std::size_t M = ST.size();
440 if (M == 0) throw InputError("npfqn_sqd: empty station list");
441 if (V.size() != M || cap.size() != M || isDelay.size() != M ||
442 stationToStateful.size() != M)
443 throw InputError("npfqn_sqd: the per-station inputs disagree on the station count");
444 if (nclasses == 0) throw InputError("npfqn_sqd: the class count must be positive");
445 if (N < 0) throw InputError("npfqn_sqd: the population must be nonnegative");
446 if (!opt.initialV1.empty() && opt.initialV1.size() != M)
447 throw InputError("npfqn_sqd: initialV1 must have one entry per station");
448
449 const Matrix<T> pEff =
450 detail::sqd_effective_routing(rt, stationToStateful, nclasses, isDelay);
451
452 // Job-hole duality of a closed cyclic BAS tandem (see the file comment):
453 // past C/2 the network is solved as its lower-population dual.
454 std::vector<std::size_t> pred;
455 if (detail::sqd_cyclic_tandem(pEff, isDelay, cap, pred)) {
456 T capsum = num_traits<T>::from_int(0);
457 for (std::size_t i = 0; i < M; ++i) capsum += cap[i];
458 const long C =
459 std::lround(num_traits<T>::to_double(capsum)) + static_cast<long>(M);
460 const long Ndual = C - static_cast<long>(N);
461 if (2L * N > C && Ndual >= 1) {
462 const T zero = num_traits<T>::from_int(0), one = num_traits<T>::from_int(1);
463 Matrix<T> pDual(M, M, zero);
464 std::vector<T> STdual(M);
465 SqdOptions<T> optDual = opt;
466 for (std::size_t j = 0; j < M; ++j) {
467 for (std::size_t k = 0; k < M; ++k) pDual(j, k) = pEff(k, j);
468 STdual[j] = ST[pred[j]];
469 if (!opt.initialV1.empty()) optDual.initialV1[j] = opt.initialV1[pred[j]];
470 }
471 const SqdResult<T> d = detail::sqd_recursion(STdual, V, cap, isDelay, pDual,
472 static_cast<int>(Ndual), optDual);
473 SqdResult<T> res;
474 res.X = d.X;
475 res.Q.assign(M, zero);
476 res.U.assign(M, zero);
477 res.R.assign(M, zero);
478 const T eps15 = num_traits<T>::from_double(1e-15);
479 for (std::size_t i = 0; i < M; ++i) {
480 res.Q[i] = T(T(cap[i] + one) - d.Q[i]);
481 const T u = T(res.X[i] * ST[i]);
482 res.U[i] = (u < one) ? u : one;
483 res.R[i] = (res.X[i] > eps15) ? T(res.Q[i] / res.X[i]) : zero;
484 }
485 return res;
486 }
487 }
488
489 return detail::sqd_recursion(ST, V, cap, isDelay, pEff, N, opt);
490}
491
492/**
493 * Overload with the reference's default option switches. Eight arguments, so it
494 * cannot collide with a MATLAB call transcribed positionally (the reference
495 * accepts at most seven, starting with an sn).
496 */
497template <class T>
498SqdResult<T> npfqn_sqd(const std::vector<T>& ST, const std::vector<T>& V,
499 const std::vector<T>& cap, const std::vector<bool>& isDelay,
500 const Matrix<T>& rt, const std::vector<std::size_t>& stationToStateful,
501 std::size_t nclasses, int N) {
502 return npfqn_sqd(ST, V, cap, isDelay, rt, stationToStateful, nclasses, N, SqdOptions<T>());
503}
504
505} // namespace npfqn
506} // namespace line
507
508#endif // LINE_API_NPFQN_SQD_H
InputError(const std::string &what)
Definition error.h:105
The exception types the port throws.
Dense matrix and non-owning view.
SqdResult< T > npfqn_sqd(const std::vector< T > &ST, const std::vector< T > &V, const std::vector< T > &cap, const std::vector< bool > &isDelay, const Matrix< T > &rt, const std::vector< std::size_t > &stationToStateful, std::size_t nclasses, int N, const SqdOptions< T > &opt)
Smith Queue Decomposition (SQD): approximate MVA for closed networks under Blocking-After-Service (ma...
Definition npfqn_sqd.h:432
Conservation laws of a layered queueing network, enumerated from its structure.
Definition aoi_dist2ph.h:51
T num_abs(const T &v)
Definition number.h:184
Number-type abstraction for the templated API port.
The four option switches of the reference, with its defaults.
Definition npfqn_sqd.h:114
bool ownServerNeighbor
true = MATLAB neighborMode 'ownserver', false = 'downstream'
Definition npfqn_sqd.h:120
int calibrationMode
0 = base (beta = K, gamma = 1), 1 = fixed heuristic, 2 = blocking-aware
Definition npfqn_sqd.h:116
bool freshV1
true = MATLAB v1Policy 'fresh', false = 'compound'
Definition npfqn_sqd.h:122
bool serverBlockingTime
include the server-blocking-time term in W^svr (MATLAB serverBlockingTime)
Definition npfqn_sqd.h:118
std::vector< T > initialV1
per-station initial V1; empty selects INITIAL_V1 for every station
Definition npfqn_sqd.h:124
Return value of npfqn_sqd, mirroring [X, Q, U, R].
Definition npfqn_sqd.h:105
std::vector< T > R
(M) per-station residence time
Definition npfqn_sqd.h:109
std::vector< T > Q
(M) per-station queue length
Definition npfqn_sqd.h:107
std::vector< T > U
(M) per-station utilization, capped at one
Definition npfqn_sqd.h:108
std::vector< T > X
(M) per-station throughput
Definition npfqn_sqd.h:106