5#ifndef LINE_SOLVERS_MVA_MVA_DISPATCH_H
6#define LINE_SOLVERS_MVA_MVA_DISPATCH_H
130 if (why.empty())
return why;
131 return why +
" Use method 'mgisrgi', which takes any Markovian patience.";
180 int src = 0, q = 0, snk = 0;
182 if (nd.
nodetype == qn::NodeType::Source) ++src;
183 else if (nd.
nodetype == qn::NodeType::Queue) ++q;
184 else if (nd.
nodetype == qn::NodeType::Sink) ++snk;
186 return src == 1 && q == 1 && snk == 1 && L.
nclosedjobs() == 0.0;
213inline bool qsys_serves_method(
const std::string& method) {
228bool has_state_dependent_rates(
const qn::NetworkStruct<T>& L) {
229 for (
const auto& st : L.stations)
230 if (!st.lldscaling.empty() || st.cdscaling || st.jdscaling)
return true;
236bool is_open_scs(
const qn::NetworkStruct<T>& L) {
237 if (L.nof_nodes() != 3)
return false;
238 int src = 0, ca = 0, snk = 0;
239 for (
const qn::NodeDef& nd : L.nodes) {
240 if (nd.nodetype == qn::NodeType::Source) ++src;
241 else if (nd.nodetype == qn::NodeType::Cache) ++ca;
242 else if (nd.nodetype == qn::NodeType::Sink) ++snk;
244 return src == 1 && ca == 1 && snk == 1 && L.nclosedjobs() == 0.0;
249 return s == qn::SchedStrategy::SRPT || s == qn::SchedStrategy::PSJF ||
250 s == qn::SchedStrategy::FB || s == qn::SchedStrategy::LRPT ||
251 s == qn::SchedStrategy::SETF;
256std::size_t station_of_type(
const qn::NetworkStruct<T>& L,
qn::NodeType ty) {
257 for (std::size_t i = 0; i < L.nof_nodes(); ++i)
258 if (L.nodes[i].nodetype == ty)
return L.nodes[i].station;
264bool row_is_exponential(
const qn::NetworkStruct<T>& L, std::size_t ist) {
265 for (std::size_t r = 0; r < L.nclasses; ++r) {
266 if (L.disabled[ist - 1][r])
continue;
267 const double v = num_traits<T>::to_double(L.scv(ist - 1, r));
268 if (!std::isfinite(v))
continue;
269 if (std::fabs(v - 1.0) >= 1e-6)
return false;
276bool is_order_one_proc(
const lang::Distrib<T>& d) {
286std::string qsys_plain_server_reason(
const qn::NetworkStruct<T>& L, std::size_t q) {
287 const qn::Station<T>& st = L.stations[q - 1];
288 if (st.nservers != 1.0)
return "a single server";
289 if (st.sched != qn::SchedStrategy::FCFS)
return "FCFS scheduling";
290 if (std::isfinite(L.cap[q - 1]))
return "an infinite buffer";
291 if (has_state_dependent_rates(L))
return "a load-independent server";
313 if (!(method ==
"default" || method ==
"exact" || method ==
"mg1kk" || method ==
"ddckk" ||
320 if (n.
nodetype == qn::NodeType::Delay) ++nd;
321 else if (n.
nodetype == qn::NodeType::Queue) ++nq;
323 if (nd != 1 || nq != 1)
return "";
325 std::size_t d = 0, q = 0;
326 for (std::size_t i = 0; i < L.
nstations; ++i) {
327 if (d == 0 && L.
stations[i].sched == SchedStrategy::INF) d = i + 1;
328 if (q == 0 && L.
stations[i].sched == SchedStrategy::FCFS) q = i + 1;
330 const double N = L.
classes[0].population;
331 if (d == 0 || q == 0 || detail::has_state_dependent_rates(L) ||
332 !std::isfinite(L.
stations[q - 1].nservers) || L.
cap[q - 1] < N ||
335 if (L.
visits.empty())
return "";
338 if (Vd <= 0.0 || Vq <= 0.0 || std::fabs(Vd - Vq) > 1e-10 * Vd)
return "";
339 const bool dexp = L.
procid(d, 1) == ProcessType::EXP;
340 const bool qexp = L.
procid(q, 1) == ProcessType::EXP;
341 const bool ddet = L.
procid(d, 1) == ProcessType::DET;
342 const bool qdet = L.
procid(q, 1) == ProcessType::DET;
343 const bool single = L.
stations[q - 1].nservers == 1.0 || N == 1.0;
345 if (method ==
"default" || method ==
"exact") {
346 if (dexp && single && !qexp && renewal)
return "mg1kk";
347 if (ddet && qdet)
return "ddckk";
348 }
else if (method ==
"mg1kk") {
349 if (dexp && single && renewal)
return "mg1kk";
350 }
else if (method ==
"ddckk") {
351 if (ddet && qdet)
return "ddckk";
352 }
else if (method ==
"mmckk") {
353 if (dexp && qexp)
return "mmckk";
370 if (!(L.
nclasses > 1 && detail::is_open_sqs(L)))
return "";
371 const std::size_t q = detail::station_of_type(L, qn::NodeType::Queue);
372 const std::size_t src = detail::station_of_type(L, qn::NodeType::Source);
373 for (std::size_t r = 0; r < L.
nclasses; ++r) {
375 if (std::isfinite(v) && !(std::fabs(v - 1.0) < 1e-6))
return "";
377 if (detail::has_state_dependent_rates(L) || std::isfinite(L.
cap[q - 1]))
return "";
378 const double k = L.
stations[q - 1].nservers;
380 if (sc == SchedStrategy::HOL) {
381 if (k == 1.0)
return "mg1.prio";
382 if (std::isfinite(k)) {
383 bool ok =
true, first =
true;
385 for (std::size_t r = 0; r < L.
nclasses && ok; ++r) {
392 }
else if (!(std::fabs(mu - mu1) <= 1e-12 * mu1)) {
396 if (ok)
return "mmc.prio";
398 }
else if (sc == SchedStrategy::FCFSPRPRIO) {
399 if (k == 1.0)
return "mg1.prio.pr";
413 if (!(detail::is_open_sqs(L) && L.
nclasses == 1))
return false;
414 const std::size_t src = detail::station_of_type(L, qn::NodeType::Source);
415 const std::size_t q = detail::station_of_type(L, qn::NodeType::Queue);
416 if (src == 0 || q == 0)
return false;
420 return detail::qsys_plain_server_reason(L, q).empty();
437 if (base !=
"default" && base !=
"exact")
438 return "a station with breakdowns is solved by the M/G/1 breakdown closed form under method "
439 "'default' or 'exact' only, not '" + method +
"'; use SolverCTMC for any other model";
440 if (!(detail::is_open_sqs(L) && L.
nclasses == 1))
441 return "SolverMVA solves breakdowns only on a single-class open Source -> Queue -> Sink model "
442 "(the M/G/1 breakdown closed form); use SolverCTMC";
443 const std::size_t src = detail::station_of_type(L, qn::NodeType::Source);
444 const std::size_t q = detail::station_of_type(L, qn::NodeType::Queue);
447 else need = detail::qsys_plain_server_reason(L, q);
452 if (need.empty() && !(detail::is_order_one_proc(bp.
failure) && detail::is_order_one_proc(bp.
repair)))
453 need =
"exponential failure and repair times";
455 if (need.empty())
return "";
456 return "the M/G/1 breakdown closed form needs " + need +
" at the breakdown station; use SolverCTMC";
476 "solver_mva_qsys_analyzer: the open queueing-system closed forms need transcendental "
477 "arithmetic; rerun this model with --arith double or --arith real");
481 const std::size_t src = detail::station_of_type(L, qn::NodeType::Source);
482 const std::size_t q = detail::station_of_type(L, qn::NodeType::Queue);
483 if (src == 0 || q == 0)
throw InputError(
"solver_mva_qsys_analyzer: no Source-Queue pair");
488 const T Vq = L.
visits[0](qstateful - 1, 0);
489 const T srcRate = L.
rates(src - 1, 0);
490 const T lambda = T(srcRate * Vq);
491 const T mu = L.
rates(q - 1, 0);
492 const double k = L.
stations[q - 1].nservers;
493 const unsigned ku = std::isfinite(k) ?
static_cast<unsigned>(std::llround(k)) : 1u;
502 if (ca1 && (qsched == qn::SchedStrategy::PS || qsched == qn::SchedStrategy::DPS ||
503 qsched == qn::SchedStrategy::GPS || (qsched == qn::SchedStrategy::LCFSPR && k == 1)))
509 auto closed_form_out = [&](
const T& Rv,
const T& lam,
const T& Uq,
const T& Xsys,
517 so.
X.assign(1, zero);
518 so.
C.assign(1, zero);
522 so.
C[0] = T(Rv * Vq);
525 so.
Tp(src - 1, 0) = Xsys;
526 so.
Tp(q - 1, 0) = lam;
527 so.
Q(q - 1, 0) = T(lam * Rv);
542 const T alpha = bp.failure_rate;
543 const T beta = bp.repair_rate;
546 T(beta / (lambda + beta)))
549 return closed_form_out(W, lambda, T(lambda / mu), srcRate,
"mg1.breakdown");
559 const std::size_t n = arv.
D0.rows();
562 for (std::size_t i = 0; i < n; ++i)
563 for (std::size_t j = 0; j < n; ++j)
gen(i, j) += Dk(i, j);
565 T lambdaBatch = zero, m1 = zero, m2 = zero;
566 for (std::size_t b = 0; b < arv.
Dmark.size(); ++b) {
568 for (std::size_t i = 0; i < n; ++i)
569 for (std::size_t j = 0; j < n; ++j) rb += T(pie[i] * arv.
Dmark[b](i, j));
573 m2 += T(bs * bs * rb);
575 T EX = one, EX2 = one;
577 EX = T(m1 / lambdaBatch);
578 EX2 = T(m2 / lambdaBatch);
581 const T lamJobs = T(lambdaBatch * EX);
582 return closed_form_out(T(r.
W * Vq), lamJobs, r.
U, lamJobs,
"mxm1");
592 T lambdaBatch = zero, m1 = zero, m2 = zero;
593 for (std::size_t b = 0; b < arv.
Dmark.size(); ++b) {
594 const T rb = arv.
Dmark[b](0, 0);
598 m2 += T(bs * bs * rb);
600 const T EX = T(m1 / lambdaBatch), EX2 = T(m2 / lambdaBatch);
602 const T lamJobs = T(lambdaBatch * EX);
603 return closed_form_out(r.
W, lamJobs, r.
U, lamJobs,
"mxg1");
605 if (method0 ==
"exact")
607 "solver_mva_qsys_analyzer: MVA exact method unavailable for this model: the M^X/G/1 closed "
608 "form needs a batch Poisson source (an order-1 BMAP) feeding one FCFS server; use SolverCTMC");
618 if (
opt.method ==
"exact")
620 "solver_mva_qsys_analyzer: M/M/1/K tail-drop is solved by the approximate "
621 "'mg1k.mgs' method (MacGregor Smith); it is not available under method='exact'. "
622 "Use the default method, or SolverCTMC/SolverNC for an exact result");
623 const double Kcap = L.
cap[q - 1];
624 const T rho = T(lambda / mu);
628 const T Tq = T(lambda * (one - Ploss));
631 if (std::fabs(rhod - 1.0) < 1e-10) {
635 const T rKp1 = qsys::detail::num_pow(rho, Kp1);
636 Lsys = T(rho / (one - rho) - Kp1 * rKp1 / (one - rKp1));
644 ls.
X.assign(1, zero);
645 ls.
C.assign(1, zero);
648 ls.
R(q - 1, 0) = T(Lsys / Tq);
649 ls.
Q(q - 1, 0) = Lsys;
650 ls.
U(q - 1, 0) = T(Tq / mu);
651 ls.
Tp(q - 1, 0) = Tq;
652 ls.
Tp(src - 1, 0) = lambda;
654 ls.
C[0] = T(ls.
R(q - 1, 0) * Vq);
667 if (method ==
"exact") {
668 if (ca1 && cs1 && ku == 1) method =
"mm1";
669 else if (ca1 && cs1 && ku > 1) method =
"mmk";
670 else if (ca1 && ku == 1) method =
"mg1";
671 else if (cs1 && ku == 1) method =
"gm1";
675 "solver_mva_qsys_analyzer: no exact closed form for this queueing system "
676 "(neither arrivals nor service are exponential, or it has several servers)");
677 }
else if (method ==
"default") {
682 else if (ca1 && cs1 && ku == 1) method =
"mm1";
683 else if (ca1 && cs1 && ku > 1) method =
"mmk";
684 else if (ca1 && ku == 1) method =
"mg1";
685 else if (cs1 && ku == 1) method =
"gm1";
687 else if (ku > 1) method =
"gigk";
688 else method =
"gig1.klb";
695 if (method ==
"erlanga" || method ==
"mgisrgi" || method ==
"gigk.diffusion") {
696 const double cap = L.
cap[q - 1];
698 const double room = std::isfinite(cap)
699 ? std::max(0.0, cap -
static_cast<double>(ku))
700 : std::numeric_limits<double>::infinity();
701 T Lsys = zero, Tq = zero, Uq = zero;
702 if (method ==
"gigk.diffusion") {
710 "' needs a reneging patience law on the queue");
711 if (method ==
"erlanga") {
732 as.
X.assign(1, zero);
733 as.
C.assign(1, zero);
738 as.
R(q - 1, 0) = Tq > zero ? T(Lsys / Tq) : zero;
739 as.
Q(q - 1, 0) = Lsys;
741 as.
Tp(q - 1, 0) = Tq;
742 as.
Tp(src - 1, 0) = srcRate;
744 as.
C[0] = T(as.
R(q - 1, 0) * Vq);
752 else if (method ==
"mg1" || method ==
"mgi1") R =
qsys::qsys_mg1(lambda, mu, cs).W;
754 else if (method ==
"gigk.kingman_approx")
758 else if (method ==
"gig1" || method ==
"gig1.allen")
772 else if (method ==
"rqna") {
775 const T rho1 = lambda / mu;
778 }
else if (method ==
"rqt") {
781 const T Gamma_a = ca / lambda;
787 else if (method ==
"qed") R = T(
qsys::qsys_mmk_qed(lambda, mu, ku).meanWait + one / mu);
789 else if (method ==
"gig1.extremal")
791 else if (method ==
"gm1" || method ==
"gim1") {
797 const bool markovian = arv.
has_map();
820 auto f = [&](
const T& x) {
return T(
lang::dist_lst(arv, T(mu - mu * x)) - x); };
822 bool straddles =
false;
823 for (
int i = 0; i < 8; ++i) {
828 hi = 1.0 - (1.0 - hi) / 10.0;
841 }
else if (method ==
"gimc") {
847 if (!cs1 &&
opt.method ==
"gimc")
849 "SolverMVA: the 'gimc' closed form needs exponential servers and renewal arrivals "
850 "(a PH source with rank-one D1, or a source with an LST); use 'gigk'");
853 "solver_mva_qsys_analyzer: the GI/M/c closed form needs renewal arrivals (a PH source, "
854 "or a source with an LST) and the arrival process is correlated");
860 "' is not available for a model with one station and one class");
879 s.
Tp(src - 1, 0) = srcRate;
880 s.
Tp(q - 1, 0) = lambda;
881 s.
Q(q - 1, 0) = T(lambda * R);
903 "solver_mva_qsys_prio_analyzer: no exact priority closed form for this model");
906 const std::size_t src = detail::station_of_type(L, qn::NodeType::Source);
907 const std::size_t q = detail::station_of_type(L, qn::NodeType::Queue);
908 const double nsrv = L.
stations[q - 1].nservers;
910 std::vector<std::size_t> order(K);
911 for (std::size_t r = 0; r < K; ++r) order[r] = r;
912 std::stable_sort(order.begin(), order.end(), [&](std::size_t a, std::size_t b) {
913 return L.classes[a].prio < L.classes[b].prio;
916 std::vector<T> lam(K, zero), mu(K, zero), cs(K, one);
917 for (std::size_t j = 0; j < K; ++j) {
918 const std::size_t r = order[j];
919 lam[j] = L.
rates(src - 1, r);
920 mu[j] = L.
rates(q - 1, r);
925 std::vector<T> la, ma, ca;
926 for (std::size_t j = 0; j < K; ++j)
928 la.push_back(lam[j]);
936 std::vector<T> W(K, zero);
937 for (std::size_t j = 0, a = 0; j < K; ++j)
950 for (std::size_t j = 0; j < K; ++j) {
951 const std::size_t r = order[j];
953 s.
R(q - 1, r) = W[j];
957 s.
Tp(q - 1, r) = lam[j];
958 s.
Tp(src - 1, r) = lam[j];
959 s.
Q(q - 1, r) = T(lam[j] * W[j]);
984 "solver_mva_finite_source_analyzer: no finite-source closed form for this model");
987 std::size_t d = 0, q = 0;
988 for (std::size_t i = 0; i < M; ++i) {
989 if (d == 0 && L.
stations[i].sched == SchedStrategy::INF) d = i + 1;
990 if (q == 0 && L.
stations[i].sched != SchedStrategy::INF) q = i + 1;
992 const double N = L.
classes[0].population;
993 const double nsrv = L.
stations[q - 1].nservers;
994 const unsigned c =
static_cast<unsigned>(std::min(nsrv, N));
995 const unsigned K =
static_cast<unsigned>(N);
996 const T EO = T(one / L.
rates(d - 1, 0));
997 const T ES = T(one / L.
rates(q - 1, 0));
999 T Xs = zero, Qq = zero, Rq = zero;
1000 if (variant ==
"ddckk") {
1002 Xs = res.
scalar(
"throughput");
1003 Qq = res.
scalar(
"meanQueueLength");
1004 Rq = res.
scalar(
"meanSojournTime");
1008 "solver_mva_finite_source_analyzer: the " + variant +
" closed form needs "
1009 "transcendental arithmetic; rerun this model with --arith double or --arith real");
1027 s.
X.assign(1, zero);
1028 s.
C.assign(1, zero);
1034 s.
Tp(q - 1, 0) = Xs;
1036 s.
Q(d - 1, 0) = T(Nt - Qq);
1038 s.
Tp(d - 1, 0) = Xs;
1039 s.
U(d - 1, 0) = s.
Q(d - 1, 0);
1041 s.
C[0] = T(Rq + EO);
1058 "solver_mva_dps_exact: the exact DPS closed form needs transcendental arithmetic; "
1059 "rerun this model with --arith double or --arith real");
1063 const std::size_t src = detail::station_of_type(L, qn::NodeType::Source);
1064 const std::size_t q = detail::station_of_type(L, qn::NodeType::Queue);
1066 std::vector<T> lam(K, zero), mu(K, zero), w(K, one);
1067 for (std::size_t r = 0; r < K; ++r) {
1068 lam[r] = L.
rates(src - 1, r);
1069 mu[r] = L.
rates(q - 1, r);
1070 const std::vector<T>& sp = L.
stations[q - 1].schedparam;
1071 if (sp.size() > r && sp[r] > zero) w[r] = sp[r];
1081 s.
C.assign(K, zero);
1082 s.
X.assign(K, zero);
1085 for (std::size_t r = 0; r < K; ++r) {
1086 s.
R(q - 1, r) = Wd[r];
1089 if (mu[r] > zero) s.
U(q - 1, r) = T(lam[r] / mu[r]);
1090 s.
Tp(q - 1, r) = lam[r];
1091 s.
Tp(src - 1, r) = lam[r];
1092 s.
Q(q - 1, r) = T(lam[r] * Wd[r]);
1116 const bool has_cd_or_jd = [&] {
1118 if (st.cdscaling || st.jdscaling)
return true;
1122 if (method ==
"exact" || method ==
"mva") {
1125 "solver_mvald_analyzer: there is no exact class-/joint-dependent solver in MVA");
1128 out.actualmethod =
"exact";
1131 if (!(method ==
"default" || method ==
"amva" || method ==
"qd" || method ==
"lin" ||
1134 "' method is not supported by the load-dependent MVA solver");
1136 if (method ==
"default" && !has_cd_or_jd) {
1138 bool integral =
true, finite =
true, all_open = !L.
classes.empty();
1140 if (std::isfinite(c.
population)) all_open =
false;
1141 if (!std::isfinite(c.
population)) finite =
false;
1156 bool converged =
true;
1164 out.
sol.converged = converged;
1193 "solver_mva_qsys_sizebased_analyzer: the M/G/1 size-based closed forms need "
1194 "transcendental arithmetic; rerun this model with --arith double or --arith real");
1198 const std::size_t src = detail::station_of_type(L, qn::NodeType::Source);
1199 const std::size_t q = detail::station_of_type(L, qn::NodeType::Queue);
1207 std::vector<std::size_t> chain_of(K, 0);
1208 for (std::size_t c = 0; c < L.
nchains; ++c)
1209 for (std::size_t r : L.
inchain[c]) chain_of[r - 1] = c;
1211 std::vector<T> lambda(K, zero), mu(K, zero), cs(K, one), vis(K, one);
1212 for (std::size_t r = 0; r < K; ++r) {
1213 vis[r] = L.
visits[chain_of[r]](qstateful - 1, r);
1214 lambda[r] = T(L.
rates(src - 1, r) * vis[r]);
1215 mu[r] = L.
rates(q - 1, r);
1218 if (!(lambda[r] > zero) || !(mu[r] > zero))
1220 "solver_mva_qsys_sizebased_analyzer: the arrival and service rates must be "
1228 case qn::SchedStrategy::SRPT:
1230 actual =
"mg1.srpt";
1232 case qn::SchedStrategy::PSJF:
1234 actual =
"mg1.psjf";
1236 case qn::SchedStrategy::FB:
1240 case qn::SchedStrategy::LRPT:
1242 actual =
"mg1.lrpt";
1244 case qn::SchedStrategy::SETF:
1246 actual =
"mg1.setf";
1248 case qn::SchedStrategy::SJF: {
1251 std::vector<double> ld(K), md(K), cd(K);
1252 for (std::size_t r = 0; r < K; ++r) {
1259 for (std::size_t r = 0; r < K; ++r) W[r] = num_traits<T>::from_double(Wd[r]);
1274 s.
C.assign(K, zero);
1275 s.
X.assign(K, zero);
1278 for (std::size_t r = 0; r < K; ++r) {
1279 s.
R(q - 1, r) = T(W[r] * vis[r]);
1280 s.
C[r] = s.
R(q - 1, r);
1282 s.
U(q - 1, r) = T(lambda[r] / mu[r]);
1283 s.
Tp(q - 1, r) = lambda[r];
1284 s.
Tp(src - 1, r) = lambda[r];
1285 s.
Q(q - 1, r) = T(lambda[r] * W[r]);
1310 "solver_mva_marie_analyzer: Marie's aggregation-decomposition needs transcendental "
1311 "arithmetic; rerun this model with --arith double or --arith real");
1317 for (std::size_t c = 0; c < C; ++c)
1318 if (!std::isfinite(d.
Nchain[c]))
1320 "solver_mva_marie_analyzer: the 'marie' method supports closed models only; this "
1321 "model has open classes");
1322 for (
const auto& nd : L.
nodes)
1323 if (nd.nodetype == qn::NodeType::Source)
1325 "solver_mva_marie_analyzer: the 'marie' method supports closed models only; this "
1326 "model has a Source");
1328 std::vector<std::size_t> qrows, drows;
1329 for (std::size_t i = 0; i < M; ++i) {
1331 const bool delay = std::isinf(L.
stations[i].nservers) || sc == qn::SchedStrategy::INF;
1336 if (!(sc == qn::SchedStrategy::FCFS || sc == qn::SchedStrategy::PS ||
1337 sc == qn::SchedStrategy::LCFSPR))
1339 "supports FCFS, PS, LCFSPR and Delay stations "
1340 "only; station '") +
1345 std::vector<T> Z(C, zero);
1346 for (std::size_t c = 0; c < C; ++c)
1347 for (std::size_t i : drows) Z[c] += d.
Lchain(i, c);
1349 const std::size_t Mq = qrows.size();
1350 Matrix<T> Lq(Mq, C, zero), SCV(Mq, C, one);
1351 std::vector<int> ns(Mq, 1);
1352 bool multiserver =
false;
1353 for (std::size_t a = 0; a < Mq; ++a) {
1354 const std::size_t i = qrows[a];
1355 const double srv = L.
stations[i].nservers;
1356 ns[a] = std::isfinite(srv) ?
static_cast<int>(std::llround(srv)) : 1;
1357 if (ns[a] > 1) multiserver =
true;
1358 for (std::size_t c = 0; c < C; ++c) {
1359 Lq(a, c) = d.
Lchain(i, c);
1360 if (L.
stations[i].sched != qn::SchedStrategy::FCFS)
continue;
1365 if (C > 1 && multiserver)
1367 "solver_mva_marie_analyzer: the 'marie' method supports multiserver stations for "
1368 "single-chain models only");
1370 std::vector<int> N(C, 0);
1371 for (std::size_t c = 0; c < C; ++c) N[c] = static_cast<int>(std::llround(d.
Nchain[c]));
1377 mr.
X.assign(C, zero);
1381 for (std::size_t c = 0; c < C; ++c)
1388 Matrix<T> Qchain(M, C, zero), Uchain(M, C, zero), Rchain(M, C, zero), Tchain(M, C, zero);
1389 for (std::size_t a = 0; a < Mq; ++a)
1390 for (std::size_t c = 0; c < C; ++c) {
1391 Qchain(qrows[a], c) = mr.
Q(a, c);
1392 Uchain(qrows[a], c) = mr.
U(a, c);
1394 for (std::size_t i = 0; i < M; ++i)
1395 for (std::size_t c = 0; c < C; ++c) Tchain(i, c) = T(mr.
X[c] * d.
Vchain(i, c));
1396 for (std::size_t i = 0; i < M; ++i)
1397 for (std::size_t c = 0; c < C; ++c)
1398 if (Tchain(i, c) > zero) Rchain(i, c) = T(Qchain(i, c) / Tchain(i, c));
1400 for (std::size_t i : drows)
1401 for (std::size_t c = 0; c < C; ++c) {
1402 Qchain(i, c) = T(Tchain(i, c) * d.
STchain(i, c));
1403 Uchain(i, c) = Qchain(i, c);
1404 Rchain(i, c) = d.
STchain(i, c);
1416 out.
sol.method =
opt.method;
1417 out.
sol.iter = mr.
it;
1444 for (
const auto& c : L.
classes)
1445 if (std::isinf(c.population)) open =
true;
1450 if (open && detail::is_open_sqs(L)) {
1451 const std::size_t sq = detail::station_of_type(L, NodeType::Queue);
1452 const std::size_t ss = detail::station_of_type(L, NodeType::Source);
1453 bool poisson =
true;
1454 for (std::size_t r = 0; r < L.
nclasses; ++r) {
1456 if (std::isfinite(v) && !(std::fabs(v - 1.0) < 1e-6)) poisson =
false;
1458 if (sq != 0 && L.
stations[sq - 1].nservers == 1.0 && poisson)
1463 "SolverMVA supports shortest-job-next (SJF) scheduling in closed models (a population "
1464 "recursion) and in the open single-server M/G/1 system with Poisson sources "
1465 "(Source -> Queue -> Sink). Use SolverLDES for this model");
1488 const bool has_oi_station = std::any_of(
1490 return st.sched == SchedStrategy::OI || st.sched == SchedStrategy::PAS;
1492 const bool exact_method = (
opt.method ==
"default" ||
opt.method ==
"exact");
1498 bool anyOpen =
false, allOpen =
true;
1499 for (
const auto& c : L.
classes) {
1500 if (std::isinf(c.population)) anyOpen =
true;
1501 else allOpen =
false;
1503 if (has_oi_station && exact_method && anyOpen && !allOpen)
1505 "the order-independent analyzer of SolverMVA serves closed and open networks; a "
1506 "mixed network with an OI station is solved exactly by SolverNC (method 'default' "
1509 for (std::size_t c = 0; c < L.
nchains; ++c)
1512 "the order-independent analyzer requires one class per chain (no class "
1525 "SolverMVA supports order-independent (OI) and pass-and-swap (PAS) stations only "
1526 "through its exact order-independent analyzer, which requires method 'default' or "
1527 "'exact' (got '" +
opt.method +
1528 "'), an empty/zero swap graph at every OI/PAS station, a closed or fully open "
1529 "model, and every other station to be product-form (INF, PS, LCFS-PR, SIRO, or "
1530 "class-independent-rate FCFS). Use SolverCTMC or SolverLDES for this model");
1543 if (kv.second.retrieval_capacity <= 0)
continue;
1545 if (detail::station_of_type(L, NodeType::Source) == 0) {
1562 const bool sqs = detail::is_open_sqs(L);
1563 const std::size_t qst = detail::station_of_type(L, NodeType::Queue);
1565 const std::size_t srcst = detail::station_of_type(L, NodeType::Source);
1568 if (detail::is_open_scs(L)) {
1591 for (std::size_t ci = 0; ci < qout.
cache.caches.size() && ci < co.
itemprob.size(); ++ci)
1618 ((detail::qsys_serves_method(method) && !detail::has_state_dependent_rates(L)) ||
1623 if (sqs && L.
nclasses > 1 && qsched == SchedStrategy::POLLING) {
1627 if (
opt.method ==
"default" ||
opt.method ==
"amva.default")
1644 if (sqs && L.
nclasses > 1 && L.
nclasses <= 3 && qsched == SchedStrategy::DPS &&
1645 !detail::has_state_dependent_rates(L) &&
1646 L.
stations[qst - 1].nservers == 1.0 && detail::row_is_exponential(L, srcst) &&
1647 detail::row_is_exponential(L, qst))
1651 static const char* kBounds[] = {
"aba.upper",
"aba.lower",
"bjb.upper",
"bjb.lower",
1652 "pb.upper",
"pb.lower",
"gb.upper",
"gb.lower",
1653 "sb.upper",
"sb.lower",
"mw.upper",
"mw.lower"};
1654 for (
const char* b : kBounds)
1657 "SolverBA with method '" +
1674 if (method ==
"mvac") {
1684 if (method ==
"qna") {
1693 if (method ==
"rqna") {
1701 if (method ==
"rqt") {
1709 if (method ==
"amva.mapqn" || method ==
"mapqn") {
1723 bool all_open =
true;
1724 for (std::size_t r = 0; r < L.
nclasses; ++r)
1725 if (std::isfinite(L.
classes[r].population)) all_open =
false;
1735 if ((
opt.base_has_fork || L.
has_fork()) && method ==
"default") {
What a solver observed about the Cache nodes of a model.
UnsupportedError(const std::string &what)
A network plus its refreshed NetworkStruct.
std::size_t stateful_of_station(std::size_t st) const
std::size_t nof_nodes() const
std::vector< std::vector< Distrib< T > > > service
service[i][r], 0-based station and class; a disabled entry marks a pair never visited.
std::map< std::size_t, BreakdownParam< T > > breakdownparam
Server breakdown / repair, keyed by 1-based STATION index.
bool has_breakdown() const
Any station at all, the guard every solver gate needs first.
std::map< std::size_t, CacheParam< T > > nodeparam
Cache parameters by 1-based NODE index; only Cache nodes have an entry.
Matrix< double > procid() const
sn.procid (M x K): the ProcessType id of each (station, class) pair, as refreshProcessTypes....
std::vector< double > cap
sn.cap and sn.classcap: the total and per-class buffers.
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
std::vector< NodeDef > nodes
every node, in creation order
std::vector< Matrix< T > > visits
(nchains) each (nstateful x nclasses)
double nclosedjobs() const
sn.nclosedjobs: the total population of the closed classes.
bool has_product_form() const
sn_has_product_form, conjunct for conjunct.
Steady-state distribution of a continuous-time Markov chain.
What refreshProcessRepresentations and refreshLST compute FROM a distribution: the (D0,...
Index of dispersion for counts (IDC) of a MAP at resolution t.
PatienceHandles< T > sn_patience_handles(const qn::NetworkStruct< T > &sn, std::size_t ist, std::size_t r)
Build the patience handles of station ist (0-based), class r.
bool sn_has_bursty_arrival(const qn::NetworkStruct< T > &sn)
std::string sn_patience_exp_refusal(const qn::NetworkStruct< T > &sn, std::size_t ist, std::size_t r)
Port of sn_patience_exp_refusal.m: the by-name refusal of a reneging patience that is not EXPONENTIAL...
std::string sn_patience_refusal(const qn::NetworkStruct< T > &sn, std::size_t ist, std::size_t r)
Port of sn_patience_refusal.m: the by-name refusal of a reneging patience that is not a Markovian law...
RenewalLst sn_renewal_lst(const qn::NetworkStruct< T > &sn, std::size_t ist)
Renewal inter-arrival LST of class 1 at station ist (1-based).
std::function< double(double)> RenewalLst
A real-argument Laplace-Stieltjes transform; empty when there is none.
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.
bool process_is_batch(ProcessType p)
True when an EVENT of this process releases (or, as a service process, completes) a BATCH of jobs who...
T dist_lst(const Distrib< T > &d, const T &s)
sn.lst: the Laplace-Stieltjes transform E[exp(-sX)].
ProcessType
Distribution kinds, with the values of MATLAB ProcessType.
const char * sched_to_text(SchedStrategy s)
NodeType
Node kinds, with the values of MATLAB NodeType.
std::vector< T > map_count_idc(const Map< T > &m, const std::vector< T > &t)
Index of dispersion for counts (IDC) of a MAP at resolution t.
std::vector< T > map_pie(const Map< T > &m)
Phase distribution seen by an arriving job, pie = pi D1 / (pi D1 e).
std::vector< T > ctmc_solve(const Matrix< T > &Qin, const std::string &linsolver=std::string())
Steady-state distribution of a continuous-time Markov chain.
std::string mva_qsys_prio_variant(const qn::NetworkStruct< T > &L)
Port of SolverMVA.qsysPrioVariant(sn): the exact priority closed form solver_mva_qsys_prio_analyzer a...
DispatchResult< T > solver_mva_qsys_prio_analyzer(const qn::NetworkStruct< T > &L, const MvaOptions &opt)
Port of solver_mva_qsys_prio_analyzer.m: the exact priority closed form for a single open queue with ...
DispatchResult< T > solver_mva_qsys_sizebased_analyzer(const qn::NetworkStruct< T > &L, const MvaOptions &opt)
Port of solver_mva_qsys_sizebased_analyzer.m: the M/G/1 formulas for the size-based disciplines (Wier...
MvaSolution< T > solver_mva_polling_analyzer(const qn::NetworkStruct< T > &L, const MvaOptions &opt)
Port of solver_mva_polling_analyzer.m.
MvaSolution< T > solver_mva_cacheqn_analyzer(const qn::NetworkStruct< T > &L, const MvaOptions &opt, qn::NetworkStruct< T > *refreshed_out=nullptr, MvaCacheqnCacheOutputs< T > *cache_out=nullptr)
bool sn_has_sjn(const qn::NetworkStruct< T > &L)
True when the layer has an SJF station, the reference's any(sn.sched == SchedStrategy....
bool mva_is_mxg1_system(const qn::NetworkStruct< T > &L)
Port of SolverMVA.isMxg1System: the single-class Source -> Queue -> Sink shape whose source is a batc...
std::vector< std::size_t > find_oi_stations(const qn::NetworkStruct< T > &L)
The OI stations of a model, 1-based station indices.
std::string mva_finite_source_variant(const qn::NetworkStruct< T > &L, const std::string &method)
Port of SolverMVA.finiteSourceVariant(sn, method): the finite-source closed form solver_mva_finite_so...
bool sn_is_mm1k_loss(const qn::NetworkStruct< T > &L)
Port of matlab/src/api/sn/sn_is_mm1k_loss.m: a single-class open Source-Queue-Sink system whose queue...
std::string polling_poisson_warning(const qn::NetworkStruct< T > &L)
The reference's line_warning for method 'default' when a polled class has a non-Poisson arrival proce...
MvaSolution< T > solver_rqna(const qn::NetworkStruct< T > &L, const MvaOptions &opt)
SjnAnalyzerResult< T > solver_mva_sjn_analyzer(const qn::NetworkStruct< T > &L, const MvaOptions &opt)
Port of solver_mva_sjn_analyzer.m.
std::string amva_method_alias(const std::string &m)
The amva.
std::string mva_erlanga_patience_reason(const qn::NetworkStruct< T > &L)
Why method 'erlanga' cannot answer this model's patience, or "".
DispatchResult< T > solver_mva_marie_analyzer(const qn::NetworkStruct< T > &L, const MvaOptions &opt)
Port of solver_mva_marie_analyzer.m: Marie's iterative aggregation-decomposition for a CLOSED network...
CacheResult< T > solver_mva_cache_analyzer(const qn::NetworkStruct< T > &L, const MvaOptions &opt)
Port of solver_mva_cache_analyzer.m for a Source-Cache-Sink model.
DispatchResult< T > solver_mva_finite_source_analyzer(const qn::NetworkStruct< T > &L, const MvaOptions &opt)
Port of solver_mva_finite_source_analyzer.m: the finite-source (machine repair) closed forms for the ...
MvaSolution< T > solver_mvac_analyzer(const qn::NetworkStruct< T > &L, const MvaOptions &opt)
Port of solver_mvac.m.
MvaSolution< T > solver_mapqn(const qn::NetworkStruct< T > &L, const MvaOptions &opt)
MvaSolution< T > solver_qna(const qn::NetworkStruct< T > &L, const MvaOptions &opt)
Port of solver_qna.m.
DispatchResult< T > solver_mvald_analyzer(const qn::NetworkStruct< T > &L, const MvaOptions &opt, const Matrix< T > &init_sol)
Port of solver_mvald_analyzer.m: the load-dependent branch.
ClassResults< T > sn_deaggregate_chain_results(const qn::NetworkStruct< T > &L, const ChainDemands< T > &d, const Matrix< T > &Qchain, const Matrix< T > &Uchain, const Matrix< T > &Rchain, const Matrix< T > &Tchain, const std::vector< T > &Xchain)
Port of sn_deaggregate_chain_results.
std::string mva_breakdown_reason(const qn::NetworkStruct< T > &L, const std::string &method)
Port of SolverMVA.supportsBreakdown: a station with Queue.setBreakdown is served by one arm,...
MvaSolution< T > solver_mvald(const qn::NetworkStruct< T > &L, const MvaOptions &opt)
Port of solver_mvald.m: exact MVA on a load-dependent model, through pfqn_mvaldmx.
MvaCacheqnRetrievalSolution< T > solver_mva_cacheqn_retrieval_analyzer(const qn::NetworkStruct< T > &L, const MvaOptions &opt)
Port of solver_mva_cacheqn_retrieval_analyzer.m.
MvaSolution< T > solver_mva_oi_analyzer(const qn::NetworkStruct< T > &L, const MvaOptions &opt)
Port of solver_mva_oi_analyzer.m.
MvaSolution< T > solver_rqt(const qn::NetworkStruct< T > &L, const MvaOptions &opt)
DispatchResult< T > solver_mva_qsys_analyzer(const qn::NetworkStruct< T > &L, const MvaOptions &opt)
Port of solver_mva_qsys_analyzer.m: the closed forms for a single-class open Source-Queue-Sink model.
DispatchResult< T > solver_mva_dps_exact(const qn::NetworkStruct< T > &L, const MvaOptions &opt)
The exact multiclass M/M/1-DPS solve the reference inlines in mvaDispatch: the truncated multiclass c...
MvaSolution< T > solver_amva(const qn::NetworkStruct< T > &L, const ChainDemands< T > &d, MvaOptions opt, const Matrix< T > &init_sol, bool &converged)
bool nc_is_oi_model(const qn::NetworkStruct< T > &L)
Port of nc_is_oi_model: whether the model as a WHOLE is order-independent, which is a strictly strong...
MvaSolution< T > solver_mva_retrieval_analyzer(const qn::NetworkStruct< T > &L, const MvaOptions &opt, MvaRetrievalCacheOutputs< T > *cache_out=nullptr)
MvaSolution< T > solver_mva_analyzer(const qn::NetworkStruct< T > &L, const MvaOptions &opt, const Matrix< T > &init_sol)
Port of solver_mva_analyzer.m, default and the explicit method names.
DispatchResult< T > mva_dispatch(const qn::NetworkStruct< T > &L, const MvaOptions &opt, const Matrix< T > &init_sol)
The ladder itself.
ChainDemands< T > sn_get_demands_chain(const qn::NetworkStruct< T > &L)
Port of sn_get_demands_chain.
std::string nc_oi_refusal(const qn::NetworkStruct< T > &sn, const std::string &route="oi")
Port of nc_oi_refusal.m: may the order-independent route ROUTE run on this model?
MarieResult< T > pfqn_marie(const Matrix< T > &L, const std::vector< int > &N, const std::vector< T > &Z, const Matrix< T > &scv, double tol, int maxiter, const std::vector< int > &nservers)
Marie's method for a closed network with FCFS Coxian service.
std::string mva_base_method(const std::string &method)
The method name with any leading "amva." alias stripped.
bool mva_qsys_serves_method(const std::string &method)
The method names solver_mva_qsys_analyzer has an arm for.
GigkRqtResult< T > qsys_gigk_rqt(const T &lambda, const T &mu, const T &Gamma_a, const T &Gamma_s, std::size_t k, const T &alpha_a, const T &alpha_s)
Robust Queueing Theory (RQT) worst-case system time of a G/G/k FCFS queue.
MeanValueResult< T > qsys_mg1_breakdown(const T &lambda, const T &mu, const T &cs, const T &alpha, const T &ER, const T &ER2, const T &RLST)
M/G/1 FCFS with exponential failures (busy or idle) and general repair.
QsysRes qsys_gimc(const std::function< double(double)> &lst, double lambda, double mu, unsigned c, const QsysResOptions &o=QsysResOptions())
QsysQedResult< T > qsys_mmk_qed(const T &lambda, const T &mu, unsigned s)
Halfin-Whitt QED approximation for the M/M/s queue, and the square-root staffing rule that inverts it...
QsysResult< T > qsys_gigk_approx_kingman(const T &lambda, const T &mu, const T &ca, const T &cs, unsigned k)
Kingman (Lee-Longton) scaling of the exact M/M/k waiting time.
QsysResult< T > qsys_mm1(const T &lambda, const T &mu)
Exact mean response time of the M/M/1 queue.
Gig1ExtremalResult< T > qsys_gig1_bnds_extremal(const T &lambda, const T &mu, const T &ca, const T &cs, std::size_t K=4000, std::size_t N=2000, bool skipTight=false)
Extremal two-moment bounds for the GI/GI/1 queue.
Mg1SjfResult qsys_mg1_sjf(const std::vector< double > &lambda, const std::vector< double > &mu, const std::vector< double > &cs)
M/G/1 non-preemptive SJF.
QsysResult< T > qsys_gigk_approx(const T &lambda, const T &mu, const T &ca, const T &cs, unsigned k)
Default G/I/G/k approximation of the mean response time.
QsysGgnmResult< T > qsys_ggnm_diffusion(const T &lambda, const T &mu, unsigned n, double m, const T &ca, const T &cs, const std::function< T(const T &)> &serviceCcdf=std::function< T(const T &)>(), double tol=1e-12, std::size_t panels=4000)
Diffusion approximation for the G/GI/n/m queue.
MxM1Result< T > qsys_mxm1(const T &lambda_batch, const T &mu, const T &E_X, const T &E_X2)
M^X/M/1: the batch-arrival queue with exponential service.
Mg1DisciplineResult< T > qsys_mg1_srpt(const std::vector< T > &lambda, const std::vector< T > &mu, const std::vector< T > &cs)
M/G/1 under SRPT (shortest remaining processing time), by the Schrage-Miller formula.
QsysAbandonResult< T > qsys_erlanga(const T &lambda, const T &mu, const T &theta, unsigned s, double r=std::numeric_limits< double >::infinity(), const MgisrgiOptions &opts=MgisrgiOptions())
Exact analysis of the Erlang A model M/M/s/r+M.
T qsys_gm1(const T &sigma, const T &mu)
Exact mean response time of the G/M/1 queue.
QsysResult< T > qsys_gig1_approx_gelenbe(const T &lambda, const T &mu, const T &ca, const T &cs)
Gelenbe diffusion approximation with instantaneous-return boundary.
QsysResult< T > qsys_gig1_approx_marchal(const T &lambda, const T &mu, const T &ca, const T &cs)
Marchal approximation of the mean response time of a G/I/G/1 queue.
Mg1DisciplineResult< T > qsys_mg1_fb(const std::vector< T > &lambda, const std::vector< T > &mu, const std::vector< T > &cs)
M/G/1 under FB (feedback), also called LAS (least attained service).
MmcPrioResult< T > qsys_mmc_prio(const std::vector< T > &lambda, const T &mu, unsigned c)
M/M/c with head-of-line priorities.
QsysRes qsys_mmckk(double alpha, double mu, unsigned c, unsigned K, const QsysResOptions &o=QsysResOptions())
Exact M/M/c/K/K finite-source queue.
QsysAbandonResult< T > qsys_mgisrgi_whitt(const T &lambda, const T &mu, unsigned s, double r, const Patience< T > &patience, const MgisrgiOptions &opts=MgisrgiOptions())
Engineering solution of the call-center model M/GI/s/r+GI.
QsysResult< T > qsys_gigk_approx_whitt(const T &lambda, const T &mu, const T &ca, const T &cs, unsigned k)
Whitt (1993) approximation for the GI/G/k queue, eqs.
Mg1DisciplineResult< T > qsys_mg1_lrpt(const std::vector< T > &lambda, const std::vector< T > &mu, const std::vector< T > &cs)
M/G/1 under LRPT (longest remaining processing time).
PhM1Result< T > qsys_phm1(const std::vector< T > &alpha, const Matrix< T > &Tm, const T &mu, const T &tol)
Exact PH/M/1, the GI/M/1 queue with phase-type interarrival times.
QsysResT< T > qsys_ddckk(const T &EO, const T &ES, unsigned c, unsigned K)
Exact D/D/c/K/K finite-source queue.
Mm1DpsResult< T > qsys_mm1_dps(const std::vector< T > &lambda, const std::vector< T > &mu, const std::vector< T > &w, const T &tol, unsigned maxCutoff)
Multiclass M/M/1 under DPS (discriminatory processor sharing), solved numerically on the truncated po...
QsysRes qsys_mg1kk(double alpha, unsigned K, const std::function< double(double)> &lst, double ES)
Exact M/G/1/K/K finite-source queue, service given by its LST.
QsysResult< T > qsys_mg1(const T &lambda, const T &mu, const T &cs)
Exact mean response time of the M/G/1 queue (Pollaczek-Khinchine).
MeanValueResult< T > qsys_mxg1(const T &lambda_batch, const T &mu, const T &cs, const T &E_X, const T &E_X2)
M^X/G/1 from the first two raw moments of the batch size.
QsysResT< double > QsysRes
QsysResult< T > qsys_gig1_approx_kobayashi(const T &lambda, const T &mu, const T &ca, const T &cs)
Kobayashi diffusion approximation for the G/I/G/1 queue.
Mg1kLossMgsResult< T > qsys_mg1k_loss_mgs(const T &lambda, const T &mu, const T &mu_scv, unsigned K)
MacGregor Smith's closed-form approximation of the M/G/1/K loss probability.
T qsys_gigk_rqt_gamma(const T &rho, const T &mu, const T &Gamma_a, const T &sigma_s, std::size_t k, const T &alpha_a, const std::string ®ime="independent")
Service variability parameter of the Robust Queueing Theory (RQT) framework.
QsysResult< T > qsys_gig1_approx_allencunneen(const T &lambda, const T &mu, const T &ca, const T &cs)
Allen-Cunneen approximation of the mean response time of a G/I/G/1 queue.
QsysResult< T > qsys_mmk(const T &lambda, const T &mu, unsigned k)
Exact mean response time of the M/M/k queue (Erlang-C).
QsysResult< T > qsys_gig1_approx_heyman(const T &lambda, const T &mu, const T &ca, const T &cs)
Heyman approximation of the mean response time of a G/I/G/1 queue.
QsysResult< T > qsys_gg1(const T &lambda, const T &mu, const T &ca2, const T &cs2)
G/G/1 dispatcher: exact where a two-moment description determines the answer, Allen-Cunneen otherwise...
QsysResult< T > qsys_gig1_approx_klb(const T &lambda, const T &mu, const T &ca, const T &cs)
Kraemer and Langenbach-Belz approximation for the G/I/G/1 queue.
Mg1PrioResult< T > qsys_mg1_prio(const std::vector< T > &lambda, const std::vector< T > &mu, const std::vector< T > &cs)
M/G/1 with non-preemptive head-of-line priorities: per-class mean response times from the Cobham/Klei...
Mg1PrioPrResult< T > qsys_mg1_prio_pr(const std::vector< T > &lambda, const std::vector< T > &mu, const std::vector< T > &cs, const std::vector< T > &ES3=std::vector< T >())
M/G/1 with preemptive-resume priorities.
Mg1DisciplineResult< T > qsys_mg1_psjf(const std::vector< T > &lambda, const std::vector< T > &mu, const std::vector< T > &cs)
M/G/1 under PSJF (preemptive shortest job first).
QsysResult< T > qsys_gig1_ubnd_kingman(const T &lambda, const T &mu, const T &ca, const T &cs)
Kingman upper bound on the mean waiting time of a G/G/1 queue.
Mg1DisciplineResult< T > qsys_mg1_setf(const std::vector< T > &lambda, const std::vector< T > &mu, const std::vector< T > &cs)
M/G/1 under SETF (shortest elapsed time first), the non-preemptive counterpart of FB/LAS.
Gig1RqResult< T > qsys_gig1_rq(const T &rho, const T &mu, const T &cs2, IaFun &&IaFun_)
Robust Queueing (RQ) approximation of a G/GI/1 queue characterized by its arrival index of dispersion...
QsysResult< T > qsys_gig1_approx_kimura(const T &lambda, const T &mu, const T &ca, const T &cs)
Kimura diffusion-interpolation approximation for the G/I/G/1 queue.
CacheMetrics< T > cache_metrics_of(const qn::NetworkStruct< T > &sn, const std::vector< T > &hitprob, const std::vector< T > &missprob, const std::vector< T > &delayedprob, const std::vector< T > &latency, const Matrix< T > &hitproblist, const Matrix< T > &itemprob, const std::vector< T > &listcost)
Assemble CacheMetrics from what a cache analyzer returned.
CacheMetrics< T > cache_metrics_of_matrix(const qn::NetworkStruct< T > &sn, const Matrix< T > &hitprob, const Matrix< T > &missprob)
The same, for the integrated caching-queueing branch, whose hit and miss probabilities are (ncaches x...
Conservation laws of a layered queueing network, enumerated from its structure.
RootResult< T > root_brent(F f, const T &a0, const T &b0, const T &tol, unsigned maxiter=200)
Brent's method on a bracket with a sign change.
A queueing network and its refreshed NetworkStruct.
Marie's iterative aggregation-decomposition for closed networks with FCFS general (Coxian) service.
Exact analysis of the finite-source D/D/c/K/K machine-repair model.
G/G/1 dispatcher: exact where a two-moment description determines the answer, Allen-Cunneen otherwise...
Diffusion approximation for the G/GI/n/m queue.
Allen-Cunneen approximation of the mean response time of a G/I/G/1 queue.
Gelenbe diffusion approximation with instantaneous-return boundary.
Heyman approximation of the mean response time of a G/I/G/1 queue.
Kimura diffusion-interpolation approximation for the G/I/G/1 queue.
Kraemer and Langenbach-Belz approximation for the G/I/G/1 queue.
Kobayashi diffusion approximation for the G/I/G/1 queue.
Marchal approximation of the mean response time of a G/I/G/1 queue.
Extremal two-moment bounds for the GI/GI/1 queue.
Robust Queueing (RQ) approximation of a G/GI/1 queue characterized by its arrival index of dispersion...
Kingman upper bound on the mean waiting time of a G/G/1 queue.
Default G/I/G/k approximation of the mean response time.
Kingman (Lee-Longton) scaling of the exact M/M/k waiting time.
Whitt (1993) approximation for the GI/G/k queue, eqs.
Robust Queueing Theory (RQT) worst-case system time of a G/G/k FCFS queue.
Service variability parameter of the Robust Queueing Theory (RQT) framework.
Exact analysis of the GI/M/c queue (Takacs, 1962).
Exact mean response time of the G/M/1 queue.
Exact mean response time of the M/G/1 queue (Pollaczek-Khinchine).
M/G/1 FCFS with server breakdowns: Queue.setBreakdown with no down service.
M/G/1 under FB (feedback), also called LAS (least attained service).
M/G/1 under LRPT (longest remaining processing time).
M/G/1 with non-preemptive head-of-line priorities: per-class mean response times from the Cobham/Klei...
M/G/1 with preemptive-resume priorities: per-class mean (and optionally variance of the) response tim...
M/G/1 under PSJF (preemptive shortest job first).
M/G/1 under SETF (shortest elapsed time first), the non-preemptive counterpart of FB/LAS.
M/G/1 with non-preemptive shortest-job-first scheduling: per-class mean response times.
M/G/1 under SRPT (shortest remaining processing time), by the Schrage-Miller formula.
MacGregor Smith's closed-form approximation of the M/G/1/K loss probability.
Exact analysis of the finite-source M/G/1/K/K (machine-repair) queue.
Engineering solution of the call-center model M/GI/s/r+GI.
Exact mean response time of the M/M/1 queue.
Multiclass M/M/1 under DPS (discriminatory processor sharing), solved numerically on the truncated po...
M/M/c with non-preemptive (head-of-line) priorities and a common exponential service rate (Cobham,...
Exact analysis of the finite-source M/M/c/K/K (machine-repair) queue.
Exact mean response time of the M/M/k queue (Erlang-C).
Halfin-Whitt QED approximation for the M/M/s queue, and the square-root staffing rule that inverts it...
M^X/G/1: the FCFS batch-Poisson queue with general service.
M^X/M/1: the batch-arrival queue with exponential service.
Exact PH/M/1, the GI/M/1 queue with phase-type interarrival times.
Deterministic scalar root finding.
Port of matlab/src/api/sn/sn_has_bursty_arrival.m.
Port of matlab/src/api/sn/sn_patience_handles.m.
Port of matlab/src/api/sn/sn_renewal_lst.m.
The DECLARED side of the gate: one feature set per solver.
SolverMVA method 'amva.mapqn': the horizontal-cut mean value analysis (mapqn_amva) of a closed multic...
SolverMVA over a SolverLN layer.
The non-reentrant cache analyzer: a Source-Cache-Sink model.
Integrated caching-queueing analyzer, a port of matlab/src/solvers/MVA/solver_mva_cacheqn_analyzer....
Port of solver_mva_cacheqn_retrieval_analyzer.m: a CLOSED integrated cache-queueing model whose Cache...
Exact mean-value analysis for networks with order-independent stations.
The multiclass open polling analyzer (ladder branch 5).
Delayed-hit (retrieval-system) cache analyzer, a port of matlab/src/solvers/MVA/solver_mva_retrieval_...
Closed networks with shortest-job-next (SJF) stations, ladder branch 0.
MVAC, exact mean value analysis BY CHAIN (Conway, de Souza e Silva and Lavenberg, IEEE Trans.
QNA, the two-moment open-network decomposition analyzer.
Robust Queueing Network Analyzer (RQNA), a port of matlab/src/solvers/MVA/solver_rqna....
Robust Queueing Network Analyzer (RQNA) of Robust Queueing Theory, a port of matlab/src/solvers/MVA/s...
The <kind> part of a LINE:<category>:<kind> identifier (see _kb/17-error-vocabulary....
Outcome of a scalar solve.
bool converged
tolerance was met before the iteration cap
T root
best estimate of the root
The patience law of one station-class pair, in the forms the solvers consume.
qsys::Patience< T > as_patience() const
This law as the Patience argument of the abandonment solvers.
bool present
Whether the pair declares reneging at all; everything below is unset when false.
bool isExponential
Whether the law is exponential, in which case the analysis is exact.
T rate
The abandonment rate 1/mean.
bool has_map() const
True when the type carries a (D0,D1) pair of its own.
Matrix< T > D0
The (D0,D1) pair when the type carries one directly.
std::vector< Matrix< T > > Dmark
MMAP per-class D1 blocks / BMAP per-batch-size blocks; empty otherwise.
A MAP as the pair of matrices (D0, D1).
What the cache analyzer reports beyond the [Q,U,R,T] block.
std::vector< T > hitprob
per class, NaN where the class does not read
std::vector< T > missprob
Matrix< T > itemprob
(n x h+1) per-item occupancy, column 0 = miss.
Matrix< T > hitproblist
(R x h) per-list hit fractions, access-weighted over items.
The chain-level view of a layer, as sn_get_demands_chain returns it.
std::vector< double > Nchain
(C) population, infinite for an open chain
Matrix< T > STchain
(M x C) mean service time
Matrix< T > Lchain
(M x C) demand
Matrix< T > Vchain
(M x C) visits
Matrix< T > SCVchain
(M x C)
Class-level results, as sn_deaggregate_chain_results returns them.
What the dispatch returns: the metrics plus the algorithm that produced them.
std::string actualmethod
The concrete algorithm, as the reference's actualmethod.
std::string warning
Non-empty when the analyzer that ran would have raised a reference line_warning and still returned a ...
solvers::CacheMetrics< T > cache
What a cache branch measured, EMPTY on every model without a Cache.
std::shared_ptr< qn::NetworkStruct< T > > refreshed_struct
Set only by the integrated cacheqn branch: the converged struct whose routing carries the actual hit/...
The cache half of the reference's return list: the (ncaches x nclasses) hit and miss split,...
Matrix< T > missprob
(ncaches x nclasses)
Matrix< T > hitprob
(ncaches x nclasses)
std::vector< Matrix< T > > itemprob
per cache, (n x h+1); EMPTY = not computed
What the closed delayed-hit analyzer returns.
std::vector< T > delayedprob
(K) zero on this path, by the reference's convention
Matrix< T > hitproblist
(K x h) NaN: not computed on this path
std::vector< T > missprob
(K) the delayed fraction is folded in here
std::vector< T > latency
(K) NaN: not computed on this path
std::vector< T > hitprob
(K) P(item cached), read class only
The options SolverMVA reads.
The cache half of the reference's return list: hitprob, missprob, delayedprob, latency,...
std::vector< T > missprob
Matrix< T > itemprob
(n x h+1), column 0 = miss
Matrix< T > hitproblist
(K x h)
std::vector< T > delayedprob
Class-level results, the [Q,U,R,T,C,X] of the MATLAB analyzers.
What the analyzer returns, the reference's metrics plus its actualmethod.
Result of pfqn_marie, mirroring the six MATLAB outputs.
int it
iterations performed
Matrix< T > Q
(M x R) mean queue length
std::vector< T > X
(R) per-class throughput
Matrix< T > U
(M x R) utilization
Server breakdown and repair of a station whose server fails and is repaired.
lang::Distrib< T > repair
time to repair of a down server
lang::Distrib< T > failure
time to failure of an up server
std::vector< T > down_service_rates
sn.downServiceRates(ist, :): per class, 0 = no service while down.
One job class of the network.
double population
infinite for an open class
One station of the network.
The four outputs [W, Wq, U, Q] of qsys_mxg1, qsys_mg1_vacation and qsys_mg1_breakdown.
T W
mean response (sojourn) time of an arbitrary job
T U
server utilization (fraction of time doing work)
std::vector< double > W
per-class mean response time
T U
server utilization rho
Steady-state measures of a multiserver queue with customer abandonment.
T utilization
E[min(N,s)]/s.
T throughput
lambda(1-P_loss)P(S)
Steady-state measures of the G/GI/n/m diffusion approximation.
T throughput
lambda(1-P(block))
T meanNumber
mean number in system
MATLAB's res struct: named measures in insertion order, plus res.analyzer.
T scalar(const std::string &name) const
The scalar field name; throws when absent.
Every Cache node of the model, in node order; empty on a model with none.