5#ifndef LINE_API_PFQN_MVAMS_H
6#define LINE_API_PFQN_MVAMS_H
131 const Matrix<T>& mu,
bool stabilize =
true) {
132 const std::size_t M = L.
rows();
133 const std::size_t R = N.size();
135 throw InputError(
"pfqn_mvald: demand matrix and population vector disagree on the class count");
141 res.
XN.assign(R, zero);
143 res.
UN.assign(M, zero);
144 res.
CN.assign(R, zero);
156 res.
lG = -std::numeric_limits<double>::infinity();
163 throw InputError(
"pfqn_mvald: rate matrix and demand matrix disagree on the station count");
164 if (
static_cast<long>(mu.
cols()) < Nt)
165 throw InputError(
"pfqn_mvald: rate matrix needs one column per job in the total population");
167 std::vector<T> Zsum(R, zero);
169 if (Z.
cols() != R)
throw InputError(
"pfqn_mvald: Z and N disagree on the class count");
170 for (std::size_t k = 0; k < Z.
rows(); ++k)
171 for (std::size_t r = 0; r < R; ++r) Zsum[r] += Z(k, r);
174 const std::size_t K =
static_cast<std::size_t
>(Nt) + 1;
175 const std::vector<std::size_t> prods =
plane_sizes(N);
179 std::vector<T> pi(total * M * K, zero);
182 std::vector<int> n(R, 0);
183 std::vector<T> x(R, zero);
185 std::size_t visited = 0;
189 if ((++visited & 1023u) == 0)
190 util::timeout_check(
"Exact load-dependent MVA (use an approximate method or raise the budget)");
191 const std::size_t idx =
pop_index(n, prods);
193 for (
int v : n) nsum += v;
196 std::fill(x.begin(), x.end(), zero);
198 for (std::size_t s = 0; s < R; ++s) {
199 if (n[s] == 0)
continue;
200 const std::size_t idx_s = idx - prods[s];
202 for (std::size_t i = 0; i < M; ++i) {
204 for (
long k = 1; k <= nsum; ++k)
205 w += (L(i, s) / mu(i,
static_cast<std::size_t
>(k - 1))) *
207 pi[(idx_s * M + i) * K +
static_cast<std::size_t
>(k - 1)];
211 if (ctot == zero)
throw NumericError(
ErrorKind{
"Degenerate"},
"pfqn_mvald: zero total residence time");
215 for (
long k = 1; k <= nsum; ++k) {
216 for (std::size_t i = 0; i < M; ++i) {
218 for (std::size_t s = 0; s < R; ++s) {
219 if (n[s] == 0)
continue;
220 const std::size_t idx_s = idx - prods[s];
221 acc += (L(i, s) / mu(i,
static_cast<std::size_t
>(k - 1))) * x[s] *
222 pi[(idx_s * M + i) * K +
static_cast<std::size_t
>(k - 1)];
224 pi[(idx * M + i) * K +
static_cast<std::size_t
>(k)] = acc;
228 for (std::size_t i = 0; i < M; ++i) {
230 for (
long k = 1; k <= nsum; ++k) acc += pi[(idx * M + i) * K + static_cast<std::size_t>(k)];
235 if (stabilize) p0 = tiny;
237 pi[(idx * M + i) * K + 0] = p0;
243 for (
long r =
static_cast<long>(R) - 1; r >= 0; --r)
249 bool prefixFull =
true;
250 for (
long r = 0; r < last_nnz; ++r)
255 bool suffixEmpty =
true;
256 for (std::size_t r =
static_cast<std::size_t
>(last_nnz) + 1; r < R; ++r)
261 if (prefixFull && suffixEmpty) {
262 const T& xr = x[
static_cast<std::size_t
>(last_nnz)];
263 if (xr == zero)
throw NumericError(
ErrorKind{
"Degenerate"},
"pfqn_mvald: zero throughput on the G path");
272 const std::size_t idxN = total - 1;
275 for (std::size_t i = 0; i < M; ++i)
276 for (std::size_t k = 0; k < K; ++k) res.
PI(i, k) = pi[(idxN * M + i) * K + k];
278 for (std::size_t i = 0; i < M; ++i) {
279 for (std::size_t r = 0; r < R; ++r) res.
QN(i, r) = res.
WN(i, r) * res.
XN[r];
280 res.
UN[i] = one - res.
PI(i, 0);
282 for (std::size_t r = 0; r < R; ++r) {
315 const std::vector<int>& N,
const Matrix<T>& Z,
316 const std::vector<int>& mi) {
317 const std::size_t M = D.
rows();
318 const std::size_t R = N.size();
320 throw InputError(
"pfqn_mvamx: demand matrix and population vector disagree on the class count");
321 if (lambda.size() != R)
322 throw InputError(
"pfqn_mvamx: arrival-rate vector and population vector disagree on the class count");
328 res.
XN.assign(R, zero);
333 res.
lG = std::numeric_limits<double>::quiet_NaN();
335 std::vector<std::size_t> openClasses, closedClasses;
336 for (std::size_t r = 0; r < R; ++r) {
338 openClasses.push_back(r);
340 closedClasses.push_back(r);
342 for (std::size_t r = 0; r < R; ++r)
344 throw InputError(
"pfqn_mvamx: arrival rate cannot be specified on a closed class");
346 std::vector<T> Zsum(R, zero);
348 if (Z.
cols() != R)
throw InputError(
"pfqn_mvamx: Z and N disagree on the class count");
349 for (std::size_t k = 0; k < Z.
rows(); ++k)
350 for (std::size_t r = 0; r < R; ++r) Zsum[r] += Z(k, r);
353 for (std::size_t r : openClasses) {
354 for (std::size_t i = 0; i < M; ++i) res.
UN(i, r) = lambda[r] * D(i, r);
355 res.
XN[r] = lambda[r];
358 std::vector<T> UNt(M, zero);
359 for (std::size_t i = 0; i < M; ++i)
360 for (std::size_t r = 0; r < R; ++r) UNt[i] += res.
UN(i, r);
362 const std::size_t nClosed = closedClasses.size();
366 for (std::size_t i = 0; i < M; ++i) {
368 const T slack = one - UNt[i];
369 for (std::size_t c = 0; c < nClosed; ++c) Dc(i, c) = D(i, closedClasses[c]) / slack;
371 std::vector<int> Nc(nClosed);
373 for (std::size_t c = 0; c < nClosed; ++c) {
374 Nc[c] = N[closedClasses[c]];
375 Zc(0, c) = Zsum[closedClasses[c]];
379 for (std::size_t c = 0; c < nClosed; ++c) {
380 const std::size_t r = closedClasses[c];
381 res.
XN[r] = closed.
XN[c];
382 for (std::size_t i = 0; i < M; ++i) {
383 res.
QN(i, r) = closed.
QN(i, c);
384 res.
CN(i, r) = closed.
CN(i, c);
391 for (std::size_t i = 0; i < M; ++i)
392 for (std::size_t c = 0; c < nClosed; ++c) {
393 const std::size_t r = closedClasses[c];
394 res.
UN(i, r) = res.
XN[r] * D(i, r);
397 for (std::size_t i = 0; i < M; ++i) {
399 for (std::size_t c = 0; c < nClosed; ++c) qc += QNc(i, c);
400 const T slack = one - UNt[i];
401 for (std::size_t r : openClasses) {
402 res.
CN(i, r) = D(i, r) * (one + qc) / slack;
403 res.
QN(i, r) = res.
CN(i, r) * res.
XN[r];
437LdmxEc<T> pfqn_ldmx_ec(
const std::vector<T>& lambda,
const Matrix<T>& D,
const Matrix<T>& mu) {
438 const std::size_t M = mu.rows();
439 const std::size_t Nt = mu.cols();
440 const std::size_t R = D.cols();
442 throw InputError(
"pfqn_ldmx_ec: demand matrix and rate matrix disagree on the station count");
443 if (lambda.size() != R)
444 throw InputError(
"pfqn_ldmx_ec: arrival-rate vector and demand matrix disagree on the class count");
446 const T zero = num_traits<T>::from_int(0);
447 const T one = num_traits<T>::from_int(1);
450 out.Lo.assign(M, zero);
451 for (std::size_t i = 0; i < M; ++i)
452 for (std::size_t r = 0; r < R; ++r) out.Lo[i] += lambda[r] * D(i, r);
455 std::vector<std::size_t> b(M, 1);
456 std::size_t maxb = 1;
457 for (std::size_t i = 0; i < M; ++i) {
458 for (std::size_t j = 1; j <= Nt; ++j) {
459 if (mu(i, j - 1) == mu(i, Nt - 1)) {
464 if (b[i] > maxb) maxb = b[i];
469 const std::size_t Cn = Nt + 1 + maxb;
470 Matrix<T> C(M, Cn, zero);
471 for (std::size_t i = 0; i < M; ++i)
472 for (std::size_t j = 1; j <= Cn; ++j) {
473 const T& m = j <= Nt ? mu(i, j - 1) : mu(i, Nt - 1);
474 if (m == zero)
throw InputError(
"pfqn_ldmx_ec: service rate must be nonzero");
475 C(i, j - 1) = one / m;
482 for (std::size_t i = 0; i < M; ++i) {
483 const std::size_t bi = b[i];
484 const T Cb = C(i, bi - 1);
485 const T slack = one - out.Lo[i] * Cb;
487 throw NumericError(ErrorKind{
"Instability"},
"pfqn_ldmx_ec: open-class load saturates a station, effective capacity diverges");
488 const T invSlack = one / slack;
492 for (std::size_t j = 1; j + 1 <= bi; ++j) ratioProd *= C(i, j - 1) / Cb;
494 const long nb =
static_cast<long>(bi) - 2;
495 std::vector<T> E1(Nt + 1, zero);
498 for (std::size_t n = 0; n <= Nt; ++n) {
500 out.E(i, n) =
num_pow_int(invSlack,
static_cast<unsigned>(n + 1));
501 out.Eprime(i, n) = Cb * out.E(i, n);
506 E1[0] = invSlack * ratioProd;
508 E1[n] = invSlack * Cb / C(i, n - 1) * E1[n - 1];
513 for (
long n0 = 0; n0 <= nb; ++n0) {
516 F3 = (n == 0) ? ratioProd : Cb / C(i, n - 1) * F3prev0;
519 const T fac = num_traits<T>::from_int(
static_cast<long>(n) + n0) /
520 num_traits<T>::from_int(n0);
521 F2 = fac * out.Lo[i] * C(i,
static_cast<std::size_t
>(
static_cast<long>(n) + n0) - 1) * F2;
522 F3 = fac * out.Lo[i] * Cb * F3;
523 F2p = fac * out.Lo[i] * C(i,
static_cast<std::size_t
>(
static_cast<long>(n) + n0)) * F2p;
525 if (n0 == 0) F3prev0 = F3;
536 out.E(i, n) = E1[n] + E2 - E3;
538 out.Eprime(i, n) = Cb * E1[n] + E2prime - Cb * E3;
540 out.Eprime(i, n) = Cb * out.E(i, n);
547 for (std::size_t n = 1; n <= Nt; ++n) {
548 if (num_traits<T>::is_exact && out.E(i, n - 1) == zero)
549 throw NumericError(ErrorKind{
"Degenerate"},
"pfqn_ldmx_ec: vanishing effective capacity");
550 out.EC(i, n - 1) = C(i, n - 1) * out.E(i, n) / out.E(i, n - 1);
579 const std::size_t M = D.
rows();
580 const std::size_t R = N.size();
582 throw InputError(
"pfqn_mvaldmx: demand matrix and population vector disagree on the class count");
583 if (lambda.size() != R)
584 throw InputError(
"pfqn_mvaldmx: arrival-rate vector and population vector disagree on the class count");
586 throw InputError(
"pfqn_mvaldmx: rate matrix and demand matrix disagree on the station count");
591 std::vector<std::size_t> openClasses, closedClasses;
593 for (std::size_t r = 0; r < R; ++r) {
595 openClasses.push_back(r);
597 closedClasses.push_back(r);
601 for (std::size_t r = 0; r < R; ++r)
603 throw InputError(
"pfqn_mvaldmx: arrival rate cannot be specified on a closed class");
604 if (
static_cast<long>(mu.
cols()) < Nct)
606 "pfqn_mvaldmx: the load-dependent rates must be given for at least the maximum closed population");
610 for (std::size_t i = 0; i < M; ++i) {
611 for (std::size_t j = 0; j < mu.
cols(); ++j) mux(i, j) = mu(i, j);
612 mux(i, mu.
cols()) = mu(i, mu.
cols() - 1);
614 const detail::LdmxEc<T> ec = detail::pfqn_ldmx_ec(lambda, D, mux);
623 std::vector<char> saturated(M, 0);
624 for (std::size_t i = 0; i < M; ++i) {
625 if (ec.Lo[i] < mux(i, mux.
cols() - 1))
continue;
626 for (std::size_t r : openClasses)
627 if (D(i, r) > zero) saturated[i] = 1;
630 "pfqn_mvaldmx: open-class load saturates a station, the model has no steady state");
634 res.
XN.assign(R, zero);
641 const std::size_t Cc = closedClasses.size();
643 std::vector<int> Nc(Cc, 0);
644 std::vector<T> Zc(Cc, zero);
645 for (std::size_t c = 0; c < Cc; ++c) {
646 const std::size_t r = closedClasses[c];
648 for (std::size_t i = 0; i < M; ++i) Dc(i, c) = D(i, r);
651 if (Z.
cols() != R)
throw InputError(
"pfqn_mvaldmx: Z and N disagree on the class count");
652 for (std::size_t k = 0; k < Z.
rows(); ++k)
653 for (std::size_t c = 0; c < Cc; ++c) Zc[c] += Z(k, closedClasses[c]);
656 const std::vector<std::size_t> prods =
plane_sizes(Nc);
658 const std::size_t K =
static_cast<std::size_t
>(Nct) + 1;
661 std::vector<T> Pc(total * M * K, zero);
662 for (std::size_t i = 0; i < M; ++i) Pc[(0 * M + i) * K + 0] = one;
666 std::vector<T> x(Cc, zero);
667 std::vector<int> nvec(Cc, 0);
669 std::size_t visited = 0;
673 if ((++visited & 1023u) == 0)
674 util::timeout_check(
"Exact load-dependent MVA (use an approximate method or raise the budget)");
675 const std::size_t idx =
pop_index(nvec, prods);
677 for (
int v : nvec)
nc += v;
680 std::fill(x.begin(), x.end(), zero);
682 for (std::size_t i = 0; i < M; ++i)
683 for (std::size_t c = 0; c < Cc; ++c) {
684 if (nvec[c] == 0)
continue;
685 const std::size_t idx_c = idx - prods[c];
687 for (
long k = 1; k <=
nc; ++k)
689 ec.EC(i,
static_cast<std::size_t
>(k - 1)) *
690 Pc[(idx_c * M + i) * K +
static_cast<std::size_t
>(k - 1)];
694 for (std::size_t c = 0; c < Cc; ++c) {
695 if (nvec[c] == 0)
continue;
697 for (std::size_t i = 0; i < M; ++i) ctot += w(i, c);
698 if (ctot == zero)
throw NumericError(
ErrorKind{
"Degenerate"},
"pfqn_mvaldmx: zero total residence time");
702 for (std::size_t i = 0; i < M; ++i) {
703 for (
long k = 1; k <=
nc; ++k) {
705 for (std::size_t c = 0; c < Cc; ++c) {
706 if (nvec[c] == 0)
continue;
707 const std::size_t idx_c = idx - prods[c];
708 acc += Dc(i, c) * ec.EC(i,
static_cast<std::size_t
>(k - 1)) * x[c] *
709 Pc[(idx_c * M + i) * K +
static_cast<std::size_t
>(k - 1)];
711 Pc[(idx * M + i) * K +
static_cast<std::size_t
>(k)] = acc;
714 for (
long k = 1; k <= nc; ++k) acc += Pc[(idx * M + i) * K + static_cast<std::size_t>(k)];
716 if (p0 < tiny) p0 = tiny;
717 Pc[(idx * M + i) * K + 0] = p0;
721 for (
long c =
static_cast<long>(Cc) - 1; c >= 0; --c)
727 bool prefixFull =
true;
728 for (
long c = 0; c < last_nnz; ++c)
729 if (nvec[c] != Nc[c]) {
733 bool suffixEmpty =
true;
734 for (std::size_t c =
static_cast<std::size_t
>(last_nnz) + 1; c < Cc; ++c)
739 if (prefixFull && suffixEmpty) {
740 const T& xr = x[
static_cast<std::size_t
>(last_nnz)];
741 if (xr > zero) res.
G /= xr;
748 const std::size_t idxN = total - 1;
750 for (std::size_t c = 0; c < Cc; ++c) {
751 const std::size_t r = closedClasses[c];
753 for (std::size_t i = 0; i < M; ++i) {
754 res.
CN(i, r) = w(i, c);
755 res.
QN(i, r) = x[c] * w(i, c);
757 const std::size_t idx_c = idxN - prods[c];
759 for (
long k = 1; k <= Nct; ++k) {
760 const std::size_t kk =
static_cast<std::size_t
>(k - 1);
763 u += Dc(i, c) * x[c] * ec.Eprime(i, kk) / ec.E(i, kk) * Pc[(idx_c * M + i) * K + kk];
770 for (std::size_t r : openClasses) {
771 res.
XN[r] = lambda[r];
772 for (std::size_t i = 0; i < M; ++i) {
773 T q = zero, u = zero;
774 for (
long k = 0; k <= Nct; ++k) {
775 const std::size_t kk =
static_cast<std::size_t
>(k);
777 Pc[(idxN * M + i) * K + kk];
780 u += lambda[r] * ec.Eprime(i, kk + 1) / ec.E(i, kk + 1) * Pc[(idxN * M + i) * K + kk];
783 if (lambda[r] == zero)
784 throw NumericError(
ErrorKind{
"Degenerate"},
"pfqn_mvaldmx: an open class must have a positive arrival rate");
785 res.
CN(i, r) = q / lambda[r];
791 for (std::size_t i = 0; i < M; ++i) {
792 if (!saturated[i])
continue;
793 for (std::size_t r : openClasses) {
794 if (!(D(i, r) > zero))
continue;
795 res.
QN(i, r) = std::numeric_limits<T>::infinity();
796 res.
CN(i, r) = std::numeric_limits<T>::infinity();
797 res.
UN(i, r) = lambda[r] * D(i, r) / mux(i, mux.
cols() - 1);
821 const std::vector<int>& N,
const Matrix<T>& Z,
const std::vector<int>& S) {
822 const std::size_t M = D.
rows();
823 const std::size_t R = N.size();
824 if (S.size() != M)
throw InputError(
"pfqn_mvaldms: server-count vector has the wrong length");
828 for (std::size_t r = 0; r < R; ++r)
839 long ncol = Nct > 1 ? Nct : 1;
840 for (std::size_t i = 0; i < M; ++i)
841 if (S[i] !=
INF_SERVERS && S[i] > ncol) ncol = S[i];
844 for (std::size_t i = 0; i < M; ++i)
845 for (
long k = 1; k <= ncol; ++k) {
846 const long c = S[i] ==
INF_SERVERS ? k : (k < S[i] ? k : S[i]);
852 for (std::size_t i = 0; i < M; ++i) {
853 for (std::size_t r = 0; r < R; ++r) {
860 if (rate == zero) res.
UN(i, r) = zero;
894 const std::vector<int>& N,
const Matrix<T>& Z,
const std::vector<int>& mi,
895 const std::vector<int>& S) {
896 const std::size_t M = L.
rows();
897 const std::size_t R = N.size();
899 throw InputError(
"pfqn_mvams: demand matrix and population vector disagree on the class count");
900 if (!mi.empty() && mi.size() != M)
901 throw InputError(
"pfqn_mvams: multiplicity vector has the wrong length");
902 if (!S.empty() && S.size() != M)
903 throw InputError(
"pfqn_mvams: server-count vector has the wrong length");
907 std::vector<int> Sv = S.empty() ? std::vector<int>(M, 1) : S;
908 std::vector<int> miv = mi.empty() ? std::vector<int>(M, 1) : mi;
909 std::vector<T> lam = lambda.empty() ? std::vector<T>(R, zero) : lambda;
911 throw InputError(
"pfqn_mvams: arrival-rate vector and population vector disagree on the class count");
913 bool hasOpenClasses =
false;
914 for (std::size_t r = 0; r < R; ++r)
917 bool hasMultiServer =
false;
918 for (std::size_t i = 0; i < M; ++i)
920 hasMultiServer =
true;
923 bool hasReplicas =
false;
924 for (std::size_t i = 0; i < M; ++i)
930 if (!hasMultiServer) {
931 if (hasOpenClasses)
return pfqn_mvamx(lam, L, N, Z, miv);
935 if (hasOpenClasses) {
939 throw InputError(
ErrorKind{
"Argument"},
"pfqn_mvams: queue replicas are not available in exact MVA for mixed models");
943 res.lG = std::numeric_limits<double>::quiet_NaN();
953 std::vector<T> miT(M);
954 for (std::size_t i = 0; i < M; ++i) miT[i] = num_traits<T>::from_int(miv[i]);
961 for (std::size_t i = 0; i < M; ++i) res.
UN(i, 0) = c.
UN[i];
971 const std::vector<int>& N,
const Matrix<T>& Z,
const std::vector<int>& S) {
972 return pfqn_mvams(lambda, L, N, Z, std::vector<int>(), S);
978 const std::vector<int>& N,
const Matrix<T>& Z) {
979 return pfqn_mvams(lambda, L, N, Z, std::vector<int>(), std::vector<int>());
994 const std::vector<int>& N,
const Matrix<T>& Z,
995 const std::vector<int>& mi,
const std::vector<int>& S,
997 const std::size_t M = L.
rows();
998 const std::size_t R = N.size();
1000 throw InputError(
"pfqn_mvams_ilock: an interlock matrix is required; use pfqn_mvams for the standard arrival theorem");
1002 throw InputError(
"pfqn_mvams_ilock: demand matrix and population vector disagree on the class count");
1003 if (!mi.empty() && mi.size() != M)
1004 throw InputError(
"pfqn_mvams_ilock: multiplicity vector has the wrong length");
1005 if (!S.empty() && S.size() != M)
1006 throw InputError(
"pfqn_mvams_ilock: server-count vector has the wrong length");
1009 std::vector<int> Sv = S.empty() ? std::vector<int>(M, 1) : S;
1010 std::vector<int> miv = mi.empty() ? std::vector<int>(M, 1) : mi;
1011 std::vector<T> lam = lambda.empty() ? std::vector<T>(R, zero) : lambda;
1012 if (lam.size() != R)
1013 throw InputError(
"pfqn_mvams_ilock: arrival-rate vector and population vector disagree on the class count");
1015 for (std::size_t r = 0; r < R; ++r)
1017 throw InputError(
"pfqn_mvams_ilock: the interlock correction is available in exact MVA "
1018 "for closed single-server models only; use an AMVA method");
1019 for (std::size_t i = 0; i < M; ++i)
1021 throw InputError(
"pfqn_mvams_ilock: the interlock correction is available in exact MVA "
1022 "for closed single-server models only; use an AMVA method");
NumericError(const std::string &what)
The exception types the port throws.
Dense matrix and non-owning view.
MvaResult< T > pfqn_mva(const Matrix< T > &L, const std::vector< int > &N, const Matrix< T > &Z, const std::vector< int > &mi)
Exact Mean Value Analysis for closed product-form networks (Reiser and Lavenberg 1980).
MvaResult< T > pfqn_mvams(const std::vector< T > &lambda, const Matrix< T > &L, const std::vector< int > &N, const Matrix< T > &Z, const std::vector< int > &mi, const std::vector< int > &S)
General-purpose exact MVA for mixed networks with multiserver stations.
constexpr int OPEN_CLASS
Marks an open (infinite-population) class in a population vector.
MvaResult< T > pfqn_mvamx(const std::vector< T > &lambda, const Matrix< T > &D, const std::vector< int > &N, const Matrix< T > &Z, const std::vector< int > &mi)
Exact MVA for a mixed open/closed network of single-server stations.
MvaLdResult< T > pfqn_mvald(const Matrix< T > &L, const std::vector< int > &N, const Matrix< T > &Z, const Matrix< T > &mu, bool stabilize=true)
Exact MVA for a closed network of load-dependent stations.
MvaResult< T > pfqn_mvaldms(const std::vector< T > &lambda, const Matrix< T > &D, const std::vector< int > &N, const Matrix< T > &Z, const std::vector< int > &S)
Exact MVA for mixed open/closed networks with multiserver stations.
MvaResult< T > pfqn_mvaldmx(const std::vector< T > &lambda, const Matrix< T > &D, const std::vector< int > &N, const Matrix< T > &Z, const Matrix< T > &mu)
Exact MVA for mixed open/closed networks with limited load dependence.
constexpr int INF_SERVERS
Marks an infinite-server station in a server-count vector.
bool is_open_class(int n)
True when the population entry denotes an open class.
MvamsClosedResult< T > pfqn_mvams_closed(const Matrix< T > &L, const std::vector< int > &N, const Matrix< T > &Z, const std::vector< T > &mi, const std::vector< int > &S, bool wantP0=true)
Memory-bounded exact MVA for closed networks with multiserver stations (Reiser 1981).
MvaResult< T > pfqn_mva_ilock(const Matrix< T > &L, const std::vector< int > &N, const Matrix< T > &Z, const std::vector< int > &mi, const Matrix< T > &IL)
Exact MVA recursion carrying the interlocked-flow correction.
MvaResult< T > pfqn_mvams_ilock(const std::vector< T > &lambda, const Matrix< T > &L, const std::vector< int > &N, const Matrix< T > &Z, const std::vector< int > &mi, const std::vector< int > &S, const Matrix< T > &IL)
MVA entry point for models carrying the interlocked-flow correction.
void timeout_check(const char *where)
The raising checkpoint, for a computation with no valid partial result: throws LINE:numerical:Timeout...
Conservation laws of a layered queueing network, enumerated from its structure.
std::size_t population_count(const std::vector< int > &N)
Number of population vectors n with 0 <= n <= N.
std::vector< std::size_t > plane_sizes(const std::vector< int > &N)
Mixed-radix plane sizes: prods[r] = prod_{s<r} (N[s]+1).
bool next_pop(std::vector< int > &n, const std::vector< int > &N)
Advance n to the next population vector in the lattice 0 <= n <= N, odometer order with the last clas...
T num_pow_int(const T &base, unsigned e)
Integer power, valid in any field (no transcendental requirement).
std::size_t pop_index(const std::vector< int > &n, const std::vector< std::size_t > &prods)
Index of n in the lattice, 0-based (MATLAB hashpop is 1-based).
Number-type abstraction for the templated API port.
Exact Mean Value Analysis for closed product-form networks (Reiser and Lavenberg 1980).
Memory-bounded exact MVA for closed networks with multiserver stations.
Population-vector enumeration and combinatorics.
The <kind> part of a LINE:<category>:<kind> identifier (see _kb/17-error-vocabulary....
Result of pfqn_mvald, mirroring the seven MATLAB outputs.
Matrix< T > WN
(M x R) residence time at the full population
double lG
log of the normalizing constant
Matrix< T > QN
(M x R) mean queue length
std::vector< T > XN
(R) per-class throughput
std::vector< T > UN
(M) utilization, 1 - P(station empty)
std::vector< T > CN
(R) cycle time, exclusive of think time
Matrix< T > PI
(M x (Nt+1)) marginal queue-length distribution at N
bool isNumStable
false once a marginal probability had to be clamped
std::vector< T > XN
(R) per-class throughput
Matrix< T > QN
(M x R) mean queue length
double lG
log of the normalizing constant
Matrix< T > CN
(M x R) residence time
Matrix< T > UN
(M x R) utilization
Return value of pfqn_mvams_closed, mirroring [XN,QN,UN,CN,lG,P0].
std::vector< T > UN
(M) busy probability 1-p_i(0|N) of one copy
std::vector< T > XN
(R) class throughputs
Matrix< T > CN
(M x R) residence times, aggregated over copies
double lG
log of the normalizing constant
Matrix< T > QN
(M x R) mean queue lengths, aggregated over copies