5#ifndef LINE_SOLVERS_NC_SOLVER_NC_RUNNER_H
6#define LINE_SOLVERS_NC_SOLVER_NC_RUNNER_H
92 return ::line::method_registry::methods(
"NC");
105 std::vector<std::string> toks;
106 for (
char ch : method) {
107 if (ch ==
'.' || ch ==
'/') {
111 tok +=
static_cast<char>(std::tolower(
static_cast<unsigned char>(ch)));
115 for (
const std::string& t : toks)
116 if (t ==
"mci" || t ==
"imci" || t ==
"ls" || t ==
"sampling" || t ==
"is" ||
142 if (std::find(valid.begin(), valid.end(), method) != valid.end())
return;
182bool multiserver_to_lld(qn::NetworkStruct<T>& sn,
bool unbudgeted =
false) {
184 bool hasOpen =
false;
185 for (
const qn::JobClass& c : sn.classes) {
186 if (std::isinf(c.population))
191 if (hasOpen && !unbudgeted)
return false;
192 std::size_t n =
static_cast<std::size_t
>(std::llround(Nt));
195 n = std::max<std::size_t>(1, n);
196 for (std::size_t i = 0; i < sn.nstations; ++i) {
197 const double c = sn.stations[i].nservers;
198 if (std::isfinite(c))
199 n = std::max(n,
static_cast<std::size_t
>(std::llround(c)));
202 if (n < 1)
return false;
203 for (std::size_t i = 0; i < sn.nstations; ++i) {
204 std::vector<T> lld(n, num_traits<T>::from_int(1));
205 const double c = sn.stations[i].nservers;
206 if (std::isfinite(c) && c > 1.0)
207 for (std::size_t k = 1; k <= n; ++k)
209 num_traits<T>::from_double(std::min<double>(
static_cast<double>(k), c));
210 sn.stations[i].lldscaling = lld;
227inline std::string nc_multiserver_policy(
const std::string& requested,
228 std::string* warning =
nullptr) {
229 if (requested.empty() || requested ==
"default")
return "default";
230 if (requested ==
"seidmann")
return "seidmann";
231 if (requested ==
"lld" || requested ==
"exact" || requested ==
"loaddep" ||
232 requested ==
"load-dependent")
234 if (warning !=
nullptr)
235 *warning =
"SolverNC does not implement config.multiserver='" + requested +
236 "' (it is a SolverMVA approximation); using 'default'. SolverNC accepts "
237 "'default', 'seidmann' and 'lld'.";
246double nc_population_lattice(
const qn::NetworkStruct<T>& sn) {
247 double lattice = 1.0;
248 if (!sn.chains.empty()) {
250 for (std::size_t c = 0; c < sn.chains.size(); ++c) {
252 for (std::size_t r = 0; r < sn.nclasses && r < sn.chains[c].size(); ++r)
253 if (sn.chains[c][r]) {
254 const double v = sn.classes[r].population;
255 if (std::isfinite(v)) popc += v;
257 lattice *= (1.0 + popc);
260 for (
const qn::JobClass& c : sn.classes)
261 if (std::isfinite(c.population)) lattice *= (1.0 + c.population);
298 if (
sn.has_open_classes())
return true;
299 const std::size_t M =
sn.nstations, C =
sn.nchains;
300 const std::vector<double> Nchain = detail::chain_population(
sn);
302 for (std::size_t c = 0; c < C; ++c)
303 if (std::isfinite(Nchain[c])) NtD += Nchain[c];
304 const std::size_t Nt =
static_cast<std::size_t
>(std::llround(NtD));
305 if (Nt < 1)
return true;
309 std::vector<double> Ztot(C, 0.0);
310 for (std::size_t i = 0; i < M; ++i) {
311 const double nserv =
sn.stations[i].nservers;
312 for (std::size_t c = 0; c < C; ++c) {
314 if (std::isinf(nserv))
316 else if (seidmann && nserv > 1.0)
317 Ztot[c] += L * (nserv - 1.0) / nserv;
320 for (std::size_t c = 0; c < C; ++c)
321 if (Nchain[c] > 0.0 && !(Ztot[c] > 0.0))
324 for (std::size_t i = 0; i < M; ++i) {
325 const double nserv =
sn.stations[i].nservers;
326 if (std::isinf(nserv))
continue;
327 const std::vector<T>& lld =
sn.stations[i].lldscaling;
330 const double lscale = (seidmann && nserv > 1.0) ? 1.0 / nserv : 1.0;
333 else if (!lld.empty())
335 else if (nserv > 1.0)
336 muK = std::min(
static_cast<double>(Nt), nserv);
339 if (!(muK > 0.0) || !std::isfinite(muK))
return false;
341 for (std::size_t c = 0; c < C; ++c)
344 if (!(1.0 - lambda / muK > 0.0))
return false;
348 if (seidmann)
return true;
354 std::vector<std::size_t> qrows;
355 for (std::size_t i = 0; i < M; ++i)
356 if (!std::isinf(
sn.stations[i].nservers)) qrows.push_back(i);
357 if (qrows.empty())
return true;
358 Matrix<double> Lq(qrows.size(), C, 0.0), muq(qrows.size(), Nt, 1.0);
359 for (std::size_t a = 0; a < qrows.size(); ++a) {
360 const std::size_t i = qrows[a];
361 const double nserv =
sn.stations[i].nservers;
362 const std::vector<T>& lld =
sn.stations[i].lldscaling;
364 for (std::size_t k = 0; k < Nt; ++k) {
367 else if (nserv > 1.0)
368 muq(a, k) = std::min(
static_cast<double>(k + 1), nserv);
371 std::vector<int> Nint(C, 0);
372 for (std::size_t c = 0; c < C; ++c)
373 Nint[c] = std::isfinite(Nchain[c]) ?
static_cast<int>(std::llround(Nchain[c])) : 0;
375 for (std::size_t c = 0; c < C; ++c) {
376 if (Nint[c] <= 0)
continue;
377 std::vector<int> Nr = Nint;
393 const std::size_t M =
sn.nstations, C =
sn.nchains;
394 const std::vector<double> Nchain = detail::chain_population(
sn);
395 std::vector<bool> popd(C,
false);
397 for (std::size_t c = 0; c < C; ++c) {
398 popd[c] = std::isfinite(Nchain[c]) && Nchain[c] > 0.0;
399 any = any || popd[c];
401 if (!any)
return false;
403 for (std::size_t c = 0; c < C; ++c) {
404 if (!popd[c])
continue;
406 std::size_t at = 0, count = 0;
407 for (std::size_t i = 0; i < M; ++i) {
409 if (std::isinf(
sn.stations[i].nservers)) {
411 }
else if (L > 0.0) {
416 if (Lz > 0.0 || count != 1)
continue;
417 for (std::size_t s2 = 0; s2 < C; ++s2)
434 const std::size_t M =
sn.nstations, C =
sn.nchains;
435 const std::vector<double> Nchain = detail::chain_population(
sn);
436 bool any_closed =
false;
437 std::vector<bool> closed(C,
false);
438 for (std::size_t c = 0; c < C; ++c) {
439 closed[c] = std::isfinite(Nchain[c]) && Nchain[c] > 0.0;
440 if (closed[c]) any_closed =
true;
442 if (!any_closed)
return 0;
446 for (std::size_t i = 0; i < M; ++i) {
447 if (std::isinf(
sn.stations[i].nservers))
continue;
448 for (std::size_t c = 0; c < C; ++c)
503 bool slotted =
false,
bool for_report =
true,
504 const std::string& multiserver = std::string()) {
505 const std::string m = method.empty() ? std::string(
"default") : method;
510 if (slotted)
return "";
524 if (m !=
"default" && m !=
"morrison")
525 return "SolverNC: method '" + m +
526 "' cannot represent the DPS weights of a discriminatory processor-sharing "
527 "station; it would return the egalitarian-PS network. Use method 'default' or "
528 "'morrison' (npfqn_dps_morrison), SolverMVA, SolverFLD or SolverCTMC.";
535 return "SolverNC analyzes a discriminatory processor-sharing station only in the shape "
536 "Morrison's expansion is derived for: a CLOSED network of exactly two stations, one "
537 "infinite-server (think) station and one single-server DPS station, exponential "
538 "service, each class visiting the two equally often. Use SolverMVA, SolverFLD or "
539 "SolverCTMC for any other DPS model.";
545 return "SolverNC: method 'morrison' is the heavy-usage expansion of a CLOSED network of "
546 "exactly two stations, one infinite-server (think) station and one single-server DPS "
547 "station with exponential service, which this model is not. Remove the method option "
548 "to let SolverNC choose, or use SolverMVA, SolverFLD or SolverCTMC.";
553 if (!
sn.sdr.branch.empty())
return "";
554 if (m ==
"sdr" || m ==
"sdr.mva")
555 return "SolverNC: method '" + m +
556 "' requires state-dependent routing, which this model does not declare.";
562 for (std::size_t ind = 0; ind <
sn.nodes.size(); ++ind)
564 if (m !=
"default" && m !=
"rec")
565 return "solver_nc: a stochastic Petri net is solved by the MDD-rec route; method '" +
566 m +
"' is a normalizing-constant algorithm for queueing networks. Use 'rec' "
582 if (m !=
"default" && m !=
"exact" && m !=
"is" && m !=
"sampling")
583 return "SolverNC: method '" + m +
584 "' cannot represent the rank rate mu(n) of an order-independent station; use "
585 "method 'default' or 'exact' (pfqn_ncoi), 'is', SolverMVA, or SolverCTMC.";
603 for (std::size_t ind = 0; ind <
sn.nodes.size(); ++ind)
604 if (
sn.nodes[ind].nodetype == qn::NodeType::Cache) {
605 const auto itp =
sn.nodeparam.find(ind + 1);
606 const bool has_retrieval =
607 itp !=
sn.nodeparam.end() && itp->second.retrieval_capacity > 0;
608 bool has_source =
false;
609 for (std::size_t j = 0; j <
sn.nodes.size(); ++j)
610 if (
sn.nodes[j].nodetype == qn::NodeType::Source) has_source =
true;
612 if (m !=
"default" && m !=
"exact" && m !=
"sampling" && m !=
"rayint" && m !=
"spm")
613 return "Method '" + m +
"' has no route on a Source-Cache-Sink model: "
614 "solver_nc_cache_analyzer would answer it with the SPM saddle point under "
615 "that name. Use 'default' (or 'spm'/'rayint'), 'exact' or 'sampling'.";
616 }
else if (has_retrieval && has_source) {
617 if (m !=
"default" && m !=
"exact" && m !=
"rayint")
618 return "Method '" + m +
"' has no route on a delayed-hit retrieval cache: "
619 "solver_nc_retrieval_analyzer would answer it with the exact recurrences "
620 "under that name. Use 'default', 'exact' or 'rayint'.";
621 }
else if ((m ==
"rayint" || m ==
"spm") &&
sn.nclosedjobs() > 0) {
622 return "Method '" + m +
"' names the SPM saddle point of an isolated cache; on an "
623 "integrated cache-queueing model the name is handed to the network solve, "
624 "where pfqn_nc has no arm for it. Use 'default' (SPM cache, default network) "
627 if (m ==
"exact" && !has_retrieval && itp !=
sn.nodeparam.end() &&
630 return "NC does not support exact solution of the specified cache replacement "
631 "policy; use the default (approximate) method or SolverCTMC.";
634 if (m ==
"rayint" || m ==
"spm")
635 return "SolverNC: method " + m +
636 " names the SPM saddle point of a cache and, on a retrieval model, the ray/WKB "
637 "delayed-hit expansion; this model declares no Cache node.";
644 for (
char& ch : ml) ch =
static_cast<char>(std::tolower(
static_cast<unsigned char>(ch)));
645 if (ml !=
"default" && ml !=
"exact" && ml !=
"ms" && ml !=
"erlangfp" && ml !=
"asy" &&
646 ml !=
"rec" && ml !=
"mci")
647 return "Method '" + m +
"' has no route on a loss network, which "
648 "solver_nc_lossn_analyzer would answer with the residue transform under that "
649 "name. Use 'default', 'exact' (or 'ms'), 'rec', 'erlangfp', 'asy' or 'mci'.";
653 return "SolverNC: the Finite Capacity Region holds a single infinite server but does not "
654 "apply DROP to every class; holding an arrival back (WAITQ) or blocking the server "
655 "(BAS/BBS/RSRD) keeps the job in the region while it waits, which the Erlang loss "
656 "model has no state for -- use DROP, or SolverCTMC/SolverJMT";
658 return "SolverNC: the 'erlangfp' Erlang fixed point applies only to a loss network, which "
659 "is an open model whose single Delay sits inside a Finite Capacity Region under a "
660 "DROP rule; this model declares no such region (see nc_is_lossn_model)";
662 return "SolverNC: method 'ms' is admissible only on a loss network (open model, one DROP "
663 "region holding a single Delay).";
665 return "SolverNC: method 'asy' is admissible only on a loss network (open model, one DROP "
666 "region holding a single Delay).";
668 return "SolverNC: method rec is the MDD-rec route, admissible on a stochastic Petri net or "
669 "on a loss network (open model, one DROP region holding a single Delay); this model "
671 if (!
sn.regions.empty())
672 return "SolverNC: this model applies a Finite Capacity Region to queueing stations, whose "
673 "aggregate population limit no normalizing-constant algorithm here enforces; only "
674 "the loss network -- one region over a single infinite server, DROP on every "
675 "class -- is solvable. Use SolverCTMC or SolverJMT, or setCapacity for a "
676 "single-station limit";
687 for (std::size_t i = 0; i <
sn.nstations; ++i)
688 if (!
sn.stations[i].lldscaling.empty() ||
689 static_cast<bool>(
sn.stations[i].cdscaling) ||
690 static_cast<bool>(
sn.stations[i].jdscaling))
691 return "SolverNC: method 'mem' is the maximum-entropy GE/GE/1/N of "
692 "solver_nc_mem, which reads the first two moments of ONE service law and "
693 "cannot apply a declared load-, class- or joint-dependent rate. Use "
694 "SolverMVA, SolverCTMC or SolverLDES";
707 if (
sn.has_open_classes()) {
708 for (std::size_t i = 0; i <
sn.nstations; ++i)
709 if (
static_cast<bool>(
sn.stations[i].cdscaling) ||
710 static_cast<bool>(
sn.stations[i].jdscaling))
711 return "SolverNC: class- or joint-dependent rates are solved by the convolution "
712 "of solver_nc_conv, Sauer's multichain recursion on the CLOSED population "
713 "lattice, which holds no position for an open chain; this model is open "
714 "or mixed. Use SolverMVA, SolverCTMC or SolverLDES";
723 bool any_cd =
false, any_multi =
false, any_lld =
false;
724 for (std::size_t i = 0; i <
sn.nstations; ++i) {
725 if (
static_cast<bool>(
sn.stations[i].cdscaling) ||
726 static_cast<bool>(
sn.stations[i].jdscaling))
728 const double c =
sn.stations[i].nservers;
729 if (std::isfinite(c) && c > 1.0) any_multi =
true;
730 if (!
sn.stations[i].lldscaling.empty()) any_lld =
true;
732 if (any_cd && (any_multi || any_lld))
733 return "SolverNC: class- or joint-dependent rates are solved by the convolution of "
734 "solver_nc_conv, which reads no server count above one and no load-dependent "
735 "rate lattice; fold the multiserver capacity into the class-dependent handle, "
736 "or use SolverMVA or SolverCTMC";
753 if ((m ==
"pana" || m ==
"panald") && !
sn.has_open_classes()) {
754 bool diverted_to_conv =
false, any_lld =
false;
755 for (std::size_t i = 0; i <
sn.nstations; ++i) {
756 if (
static_cast<bool>(
sn.stations[i].cdscaling) ||
757 static_cast<bool>(
sn.stations[i].jdscaling))
758 diverted_to_conv =
true;
759 if (!
sn.stations[i].lldscaling.empty()) any_lld =
true;
761 const bool reaches_ld_kernel = (m ==
"panald") || any_lld;
763 const std::string why =
764 "the model is not in normal usage, or the retained terms of the 'panald' "
765 "asymptotic series do not decrease at this population, so the expansion does "
766 "not apply. Use 'exact', 'clw' or an approximate load-dependent method instead.";
768 return "SolverNC: method 'pana' reaches the load-dependent kernel on this "
769 "model, where pfqn_ncld evaluates it as 'panald', and " + why;
770 return "SolverNC: " + why;
776 if (for_report && !diverted_to_conv && !reaches_ld_kernel &&
778 return "SolverNC: the model is not in normal usage, so the 'pana' asymptotic "
779 "expansion does not apply (pfqn_panacea returns NaN and the analyzer an "
780 "empty table). Use 'exact', 'clw' or 'default' instead.";
794 return "SolverNC: method '" + m +
"' (Birman-Kogan load concealment) does not apply: "
795 "a closed chain with no think time is confined to a single queueing station "
796 "shared with other chains, so that station is always busy and the residual "
797 "capacity the concealment hands the other chains is zero. Use 'exact', "
798 "'default' or another approximate method instead.";
819 if (m ==
"comom" || m ==
"comomld" || (for_report && (m ==
"mmint2" || m ==
"gleint"))) {
823 return "SolverNC: method 'comomld' is the load-dependent CoMoM recursion, and "
824 "pfqn_comomrm_ld accepts at most a single queueing station; this model has " +
825 std::to_string(nq) +
".";
827 return "SolverNC: method 'comom' is the CoMoM recursion of pfqn_comomrm, which "
828 "accepts at most a single queueing station; this model has " +
829 std::to_string(nq) +
". Use 'default' or 'ca' for an exact normalizing "
830 "constant, or SolverJMT with method 'jmva.recal'.";
831 return "SolverNC: the '" + m +
832 "' method requires a model with a delay and a single queueing station; this "
833 "model has " + std::to_string(nq) +
".";
840 for (std::size_t i = 0; i <
sn.nstations; ++i)
841 if (std::isfinite(
sn.stations[i].nservers) &&
sn.stations[i].nservers > 1.0) multi =
true;
847 if (multi &&
sn.has_open_classes() &&
848 detail::nc_multiserver_policy(multiserver) ==
"seidmann")
849 return "solver_nc_analyzer: the NC solver cannot provide exact solutions for open "
850 "or mixed multiserver queueing networks under config.multiserver='seidmann'. "
851 "Remove the 'exact' option or the config.multiserver setting";
854 if (multi && detail::has_node_type(
sn, qn::NodeType::Fork))
855 return "SolverNC: NC solver cannot provide exact solutions for a fork-join model with a "
856 "multiserver station: the fork-join transformation carries the parallelism as "
857 "open auxiliary classes, so the inner model is mixed. Remove the 'exact' option.";
864 bool scaling =
false, multiserver =
false, fractional =
false;
865 for (std::size_t i = 0; i <
sn.nstations; ++i) {
866 const auto& st =
sn.stations[i];
867 if (!st.lldscaling.empty() ||
static_cast<bool>(st.cdscaling) ||
868 static_cast<bool>(st.jdscaling))
870 if (std::isfinite(st.nservers) && st.nservers > 1.0) multiserver =
true;
876 if ((scaling || multiserver) && fractional)
877 return "SolverNC: NC load-dependent solver cannot provide exact solutions for "
878 "fractional populations.";
913 if (opt_in.
method ==
"cftp" || opt_in.
method ==
"cftp.approx") {
921 "SolverNC(cftp): the cftp methods draw random states and form the station "
922 "balance functions in the log domain, neither of which exists in exact rational "
939 if (st.
sched == qn::SchedStrategy::OI || st.
sched == qn::SchedStrategy::PAS) oi =
true;
942 "SolverNC: method '" + opt_in.
method +
"' requires a product-form solution; use "
943 "SolverCTMC for an exact answer, or 'comom', which applies Seidmann's "
944 "approximation, for an approximate one");
959 const std::string refusal =
1007 bool mem_blocking =
false;
1008 if (
opt.method ==
"mem") {
1012 const bool mm1k_closed_form =
1016 const bool oi_loss =
1027 std::vector<T> lam(
tr.V.classes.size() + 1,
1084 const std::size_t src = mva::detail::station_of_type(L, qn::NodeType::Source);
1085 const std::size_t q = mva::detail::station_of_type(L, qn::NodeType::Queue);
1087 const T Vq = L.
visits[0](qstateful - 1, 0);
1088 const T lambda = T(L.
rates(src - 1, 0) * Vq);
1089 const T mu = L.
rates(q - 1, 0);
1090 const T rho = T(lambda / mu);
1091 const double Kcap = L.
cap[q - 1];
1092 const unsigned Kint =
static_cast<unsigned>(std::llround(Kcap));
1094 const T Tq = T(lambda * (one - Ploss));
1103 Lsys = T(rho / (one - rho) - Kp1 * rKp1 / (one - rKp1));
1111 ls.
X.assign(1, zero);
1112 ls.
C.assign(1, zero);
1116 ls.
R(q - 1, 0) = T(Lsys / Tq);
1117 ls.
Q(q - 1, 0) = Lsys;
1118 ls.
U(q - 1, 0) = T(Tq / mu);
1119 ls.
Tp(q - 1, 0) = Tq;
1120 ls.
Tp(src - 1, 0) = lambda;
1122 ls.
C[0] = T(ls.
R(q - 1, 0) * Vq);
1137 for (std::size_t ind = 0; ind < L.
nodes.size(); ++ind)
1141 bool multiserver =
false;
1144 bool anyLld =
false;
1151 std::string ms_warning;
1152 const std::string ms_policy =
1153 detail::nc_multiserver_policy(
opt.multiserver, &ms_warning);
1155 if (
opt.method ==
"default") {
1159 if (L.
nstations == 2 && !detail::has_node_type(L, qn::NodeType::Cache) &&
1160 detail::has_node_type(L, qn::NodeType::Delay) && multiserver) {
1162 if (detail::multiserver_to_lld(L)) anyLld =
true;
1164 opt.method =
"comom";
1166 }
else if (ms_policy ==
"lld" && multiserver && !anyLld && L.
has_product_form() &&
1167 detail::nc_population_lattice(L) <= 6000.0) {
1173 if (detail::multiserver_to_lld(L)) anyLld =
true;
1175 }
else if (
opt.method ==
"exact" ||
opt.method ==
"is" ||
opt.method ==
"panald") {
1196 "SolverNC: the '" +
opt.method +
1197 "' method requires the model to have a product-form solution, and this model "
1207 if (!anyLld && multiserver && ms_policy !=
"seidmann") {
1208 if (detail::multiserver_to_lld(L,
true)) anyLld =
true;
1218 if (detail::has_node_type(L, qn::NodeType::Source)) {
1239 std::vector<T>(), std::vector<T>(),
1252 for (std::size_t ci = 0; ci < res.
cache.caches.size() && ci < cr.
itemprob.size(); ++ci)
1254 for (std::size_t ci = 0; ci < res.
cache.caches.size() && ci < cr.
listcost.size(); ++ci)
1283 if (anyLld || nc::detail::has_scaling(L)) {
1285 }
else if (
opt.method ==
"rd" ||
opt.method ==
"nrp" ||
opt.method ==
"nrl" ||
1286 opt.method ==
"nre" ||
opt.method ==
"comomld" ||
opt.method ==
"panald") {
1294 if (!ms_warning.empty())
1307 const std::string& origmethod);
1321 const std::string& origmethod) {
1327 std::vector<std::vector<bool>> mask(M, std::vector<bool>(K,
false));
1328 for (std::size_t i = 0; i < M; ++i)
1329 for (std::size_t k = 0; k < K; ++k)
1331 std::vector<std::vector<bool>> srcmask(M, std::vector<bool>(K,
false));
1332 for (std::size_t i = 0; i < M; ++i)
1333 if (L.
stations[i].nodetype == qn::NodeType::Source)
1334 for (std::size_t k = 0; k < K; ++k) srcmask[i][k] =
true;
1355 std::string satwarn;
1364 out.
actualmethod = (origmethod ==
"default" && !actualmethod.empty() &&
1365 actualmethod !=
"default")
1366 ?
"default/" + actualmethod
1374 "SolverNC does not handle immediate feedback (immfeed); the solver will treat "
1375 "self-loops as class-switching with re-queueing.";
1381 if (!satwarn.empty())
1396 if (std::isfinite(lg))
What a solver observed about the Cache nodes of a model.
UnsupportedError(const std::string &what)
A network plus its refreshed NetworkStruct.
bool has_immediate_feedback() const
Whether immediate feedback is EFFECTIVE anywhere in the model.
std::size_t stateful_of_station(std::size_t st) const
std::vector< double > cap
sn.cap and sn.classcap: the total and per-class buffers.
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< NodeDef > nodes
every node, in creation order
std::vector< Matrix< T > > visits
(nchains) each (nstateful x nclasses)
bool has_product_form() const
sn_has_product_form, conjunct for conjunct.
static void step(const char *fmt,...)
Write one progress line.
The exception types the port throws.
The fork-join fixed point that drives one inner MVA solve.
The Heidelberger-Trivedi fork-join transform, options.config.fork_join='ht'.
The fork-join transform SolverMVA applies before solving a layer that contains a Fork.
Running progress log of a LINE solver run (the "solver console").
The method names of each solver, in listing order.
bool sn_is_oi_loss(const qn::NetworkStruct< T > &sn, std::size_t *qist=nullptr)
Port of sn_is_oi_loss.m: the isolated order-independent loss queue (Source -> OI -> Sink with a finit...
bool sn_is_mm1k_loss(const qn::NetworkStruct< T > &sn)
sn_is_mm1k_loss: the three-node Source/Queue/Sink model of an M/M/1/K with loss, the shape MVA answer...
std::string sn_reducible_chain_refusal(const qn::NetworkStruct< T > &sn)
The by-name refusal of the first closed chain whose (station,class) routing has more than one closed ...
NodeType
Node kinds, with the values of MATLAB NodeType.
@ FIFO
first in, first out
Matrix< T > sn_get_residt_from_respt(const qn::NetworkStruct< T > &L, const Matrix< T > &RN)
Port of sn_get_residt_from_respt: the per-JOB residence time.
Matrix< T > filter_metric(const qn::NetworkStruct< T > &L, const Matrix< T > &metric, MetricKind kind, const std::vector< std::vector< bool > > *zero_mask)
Port of filterMetric: what @@NetworkSolver/getAvg does between the analyzer and the caller.
bool cap_unstable_open_stations(const qn::NetworkStruct< T > &L, Matrix< T > &QN, Matrix< T > &UN, Matrix< T > &RN, const Matrix< T > &TN)
The saturated open-station rule of @@NetworkSolver/getAvg.m:221-308.
void apply_analyzer_arvr(Matrix< T > &AN, const Matrix< T > &supplied)
Overwrite the routing-derived arrival rates with those an analyzer supplied (MvaSolution::AN,...
const char * unstable_open_warning()
The warning getAvg.m raises when cap_unstable_open_stations() fires.
FjMmt< T > fj_fork_join_transform(const qn::NetworkStruct< T > &L, const std::string &method)
options.config.fork_join -> the transform it names.
MvaSolution< T > fj_fixed_point(const qn::NetworkStruct< T > &L, FjMmt< T > &tr, std::vector< T > &lam, const MvaOptions &opt, InnerSolve inner, std::string *warning=nullptr)
Drive the fork-join fixed point of a transformed model to convergence.
Matrix< T > sn_get_arvr_from_tput(const qn::NetworkStruct< T > &L, const Matrix< T > &TN)
Port of sn_get_arvr_from_tput: the arrival rate each station sees, from the throughputs and the class...
ChainDemands< T > sn_get_demands_chain(const qn::NetworkStruct< T > &L)
Port of sn_get_demands_chain.
NcCftpSolution< T > solver_nc_cftp(const qn::NetworkStruct< T > &sn, const NcSolverOptions &opt, const NcCftpOptions &cftpopt)
Solve with the cftp / cftp.approx method.
mva::AvgResult< T > solver_nc_run_analyzer(const qn::NetworkStruct< T > &L_in, const NcSolverOptions &opt_in)
bool nc_is_cacheqn(const qn::NetworkStruct< T > &sn)
True when the model has a Cache node and is not the Source-Cache-Sink shape.
bool nc_is_oi_model(const qn::NetworkStruct< T > &sn)
Port of nc_is_oi_model.m: a closed, open or mixed network with at least one OI station and nothing bu...
NcSolution< T > solver_nc_dt(const qn::NetworkStruct< T > &sn, const NcSolverOptions &opt)
Exact discrete-time analysis of sn.
NcSpnSolution< T > solver_nc_spn_analyzer(const qn::NetworkStruct< T > &sn, const NcSolverOptions &opt)
Analyse a product-form stochastic Petri net.
NcSolution< T > solver_nc_dps_analyzer(const qn::NetworkStruct< T > &sn, const NcSolverOptions &opt)
Analyzes the closed think+DPS network.
bool nc_is_slotted(const NcSolverOptions &opt)
True when the caller asked for the discrete-time route (slotted or timescale "discrete").
MemSupport solver_nc_mem_supports(const qn::NetworkStruct< T > &sn)
Port of solver_nc_mem_supports.m.
NcCacheSolution< T > solver_nc_cache_analyzer(const qn::NetworkStruct< T > &sn, const NcSolverOptions &opt)
Port of solver_nc_cache_analyzer.m.
bool nc_is_normal_usage(const qn::NetworkStruct< T > &sn, bool seidmann=false)
Is the closed model in NORMAL USAGE, the domain of the Mitra-McKenna PANACEA asymptotic expansion (J.
NcSolution< T > solver_nc_cftp_solution(const NcCftpSolution< T > &s)
A cftp solve in the shape every other SolverNC analyzer returns, so the runner's metric filter applie...
bool nc_is_lossn_model(const qn::NetworkStruct< T > &sn)
True when the model is a loss network: the shape above, with EVERY class dropped at the region.
bool nc_is_pas_model(const qn::NetworkStruct< T > &sn)
Port of nc_is_pas_model.m: a closed two-station OI / P&S tandem.
NcSolution< T > solver_nc_oi_analyzer(const qn::NetworkStruct< T > &sn, const NcSolverOptions &opt)
Port of solver_nc_oi_analyzer.m.
bool nc_lc_concealment_degenerate(const qn::NetworkStruct< T > &sn)
Is Birman-Kogan load concealment ('lc'/'lc.ue') degenerate on this model?
double solver_nc_lognormconst(const qn::NetworkStruct< T > &L, const NcSolverOptions &opt)
Port of @@SolverNC/getProbNormConstAggr.m: the log normalizing constant.
std::string resolve_method(const qn::NetworkStruct< T > &, const std::string &method)
Port of SolverNC.resolveMethod: default is NOT resolved ahead of the run.
NcCacheqnRetrievalSolution< T > solver_nc_cacheqn_retrieval_analyzer(const qn::NetworkStruct< T > &sn, const NcSolverOptions &opt)
Port of solver_nc_cacheqn_retrieval_analyzer.m.
void check_method(const std::string &method)
Port of runAnalyzerChecks' method gate: an unlisted method is refused.
std::vector< std::string > list_valid_methods()
Port of SolverNC.listValidMethods.
std::size_t nc_closed_queueing_stations(const qn::NetworkStruct< T > &sn)
How many queueing (non-infinite-server) stations carry demand from a CLOSED chain?
NcRetrievalSolution< T > solver_nc_retrieval_analyzer(const qn::NetworkStruct< T > &sn, const NcSolverOptions &opt)
Port of solver_nc_retrieval_analyzer.m.
NcSolution< T > solver_nc_analyzer(const qn::NetworkStruct< T > &sn, const NcSolverOptions &opt)
Port of solver_nc_analyzer.m.
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?
bool is_stochastic_method(const std::string &method)
Port of SolverNC.isStochasticMethod.
std::string nc_method_refusal(const qn::NetworkStruct< T > &sn, const std::string &method, bool slotted=false, bool for_report=true, const std::string &multiserver=std::string())
May method run on this model?
NcSolution< T > solver_nc_solve(const qn::NetworkStruct< T > &L_in, const NcSolverOptions &opt_in)
The gates, the multiserver conversion and the dispatch of @@SolverNC/runAnalyzer.m,...
bool nc_has_lossn_shape(const qn::NetworkStruct< T > &sn)
True when the model has the SHAPE of a loss network – open, one region, one member station,...
NcCacheqnSolution< T > solver_nc_cacheqn_analyzer(const qn::NetworkStruct< T > &sn, const NcSolverOptions &opt)
Port of solver_nc_cacheqn_analyzer.m.
NcSolution< T > solver_ncld_analyzer(const qn::NetworkStruct< T > &sn, const NcSolverOptions &opt)
Port of solver_ncld_analyzer.m: the load-dependent analyzer, which is solver_ncld plus the same fract...
bool sn_has_dps(const qn::NetworkStruct< T > &sn)
True when any station of the network is scheduled DPS.
bool nc_has_retrieval(const qn::NetworkStruct< T > &sn)
True when the model's Cache carries a delayed-hit retrieval system.
NcLossnSolution< T > solver_nc_lossn_analyzer(const qn::NetworkStruct< T > &sn, const NcSolverOptions &opt)
Port of solver_nc_lossn_analyzer.m.
bool nc_is_noreentrant_cache(const qn::NetworkStruct< T > &sn)
True when the model is exactly a Source, a Cache and a Sink.
mva::AvgResult< T > solver_nc_avg_table(const qn::NetworkStruct< T > &L_in, const NcSolution< T > &d, const std::string &origmethod)
Port of @@SolverNC/runAnalyzer.m for the lang='matlab' path: solve, then apply the metric filter @@Ne...
std::string solver_nc_cftp_supports(const qn::NetworkStruct< T > &sn)
The cftp model-class gate as a public predicate.
bool nc_is_dps_model(const qn::NetworkStruct< T > &sn)
True when the model is the closed two-station network Morrison's expansion is derived for: one infini...
NcSolution< T > nc_dispatch(const qn::NetworkStruct< T > &sn, const NcSolverOptions &opt)
Port of @@SolverNC/ncDispatch.m: the inner solve of the fork-join fixed point, which is the load-depe...
PanaceaLdResult< T > pfqn_panaceald(const Matrix< T > &L, const std::vector< int > &N, const std::vector< T > &Z, const Matrix< T > &mu, int terms)
PANACEA normal-usage asymptotic expansion for LOAD-DEPENDENT closed networks (Mitra and McKenna,...
FeatureSet nc_feature_set(const std::string &method)
SolverNC.getFeatureSet, 48 names, transcribed unchanged.
void check_binding_capacity(const std::string &solver, const NetworkStruct< T > &sn)
NetworkSolver.checkBindingCapacity (NetworkSolver.m:1172-1228): the shared structural gate for finite...
void feature_gate(const std::string &solver, const FeatureSet &declared, const NetworkStruct< T > &sn, const std::string &requested_method="", const std::string &resolved_method="")
runAnalyzerChecks: refuse a model the solver does not declare, by name.
Mm1kLossResult< T > qsys_mm1k_loss(const T &lambda, const T &mu, unsigned K)
Blocking probability of the M/M/1/K 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.
T num_pow_int(const T &base, unsigned e)
Integer power, valid in any field (no transcendental requirement).
Port of solver_nc_analyzer.m, solver_ncld_analyzer.m and @@SolverNC/ncDispatch.m: one inner solve,...
Controls and result shape shared by the normalizing-constant analyzers.
A queueing network and its refreshed NetworkStruct.
PANACEA normal-usage asymptotic expansion for LOAD-DEPENDENT closed networks (Mitra and McKenna,...
Blocking probability of the M/M/1/K queue.
Chain aggregation and de-aggregation.
Ports of the sn_has_* / sn_is_* predicate family of matlab/src/api/sn.
Port of sn_reducible_chain_refusal.m: refusal of a closed chain whose (station,class) routing is redu...
The DECLARED side of the gate: one feature set per solver.
The SolverMVA class surface: @@SolverMVA/runAnalyzer.m and the gates around it.
Port of solver_nc_cache_analyzer.m: the NON-REENTRANT cache, a model that is exactly a Source,...
Port of solver_nc_cacheqn_analyzer.m: the INTEGRATED caching-queueing network, where a Cache sits ins...
Port of solver_nc_cacheqn_retrieval_analyzer.m: a CLOSED integrated cache-queueing model whose Cache ...
The cftp and cftp.approx methods of SolverNC: stationary analysis of a closed single-class product-fo...
Heavy-usage asymptotic analysis of the closed two-station network with one think (infinite-server) st...
Port of solver_nc_lossn_analyzer.m: the open LOSS NETWORK, which is a Source, ONE multiclass Delay si...
Port of solver_nc_mem.m and solver_nc_mem_supports.m: the Maximum Entropy Method of Kouvatsos (1994).
Order-independent (OI) and pass-and-swap (P&S) normalizing-constant analysis.
Port of solver_nc_retrieval_analyzer.m: the OPEN delayed-hit (retrieval-system) cache.
Stationary analysis of a PRODUCT-FORM stochastic Petri net by MDD-rec.
The <kind> part of a LINE:<category>:<kind> identifier (see _kb/17-error-vocabulary....
The metrics getAvg returns, after filtering.
solvers::LossnInfo lossn
self.result.LossN: the loss-network inputs SolverNC keeps for getAvgLinkTable, EMPTY for every other ...
Matrix< T > RN
response time, per visit
std::string warning
The reference's own warning text, verbatim, empty when it did not warn.
Matrix< T > UN
utilization
solvers::FjMetrics< T > fj
self.result.FJ: the fork-join section metrics FJQLen, FJRespT and FJTput, filled by the solvers the f...
std::vector< T > listcost
(h) mean storage cost held by each cache list, K_j = sum_i sigma_i pi_ij, filled only by the NC cache...
std::optional< double > lognormconst
@@SolverNC/getProbNormConstAggr, i.e.
Matrix< T > WN
residence time, per job
std::string method
the method asked for
std::string actualmethod
the algorithm that ran
Matrix< T > QN
queue length
std::vector< T > CN
system response time per class
std::vector< T > XN
system throughput per class
solvers::CacheMetrics< T > cache
What the cache branches observed, EMPTY on a model with no Cache node and on every solver that does n...
Matrix< T > AN
arrival rate
The chain-level view of a layer, as sn_get_demands_chain returns it.
Matrix< T > Lchain
(M x C) demand
The transformed layer and the bookkeeping the fixed point needs to drive it and to merge its results ...
The options SolverMVA reads.
bool base_has_fork
Whether the model this solve came from has a Fork, which the model handed to the analyzer no longer d...
std::string fork_join
options.config.fork_join: which fork-join arm the fixed point takes.
Class-level results, the [Q,U,R,T,C,X] of the MATLAB analyzers.
double lG
log of the normalizing constant, the reference's lG.
Matrix< T > AN
Analyzer-supplied station arrival rates (M x K), NaN where the runner derives them from the routing; ...
solvers::FjMetrics< T > fj
Fork-join section metrics set by the fork-join fixed point (fj_driver.h); empty otherwise.
static constexpr double FineTol
The verdict of solver_nc_mem_supports.
bool blocking
the model carries a binding finite station buffer
What the cache analyzer returns beyond the usual metric table.
Matrix< T > hitproblist
(u x h) access-weighted per-list hit probability, NaN if not exact
std::vector< T > missprob
(u) per-class miss and hit PROBABILITIES, missrate divided by the read class's arrival rate and its c...
Matrix< T > itemprob
(n x h+1) the same from the EXACT recursion, NaN above 10 items
std::vector< T > listcost
(h) mean storage cost held by each list, EMPTY without item sizes
What the closed delayed-hit analyzer returns.
std::vector< T > delayedprob
(K) zero on this path, by the reference's convention
std::vector< T > missprob
(K) the delayed fraction is folded in here
std::vector< T > hitprob
(K) P(item cached)
std::vector< T > latency
(K) NaN: not computed on this path
Matrix< T > hitproblist
(K x h) NaN: not computed on this path
What the integrated analyzer returns: the metrics plus the converged split.
Matrix< T > hitprob
(ncaches x nclasses) converged hit probability
Matrix< T > missprob
(ncaches x nclasses)
qn::NetworkStruct< T > refreshed
The struct whose cache self-switch carries the CONVERGED split rather than the offered one,...
std::vector< std::vector< T > > listcost
per cache, (h) mean storage cost per list; EMPTY without item sizes
std::vector< Matrix< T > > itemprob
per cache, (n x h+1); EMPTY = not computed
What the delayed-hit analyzer returns beyond the metric table.
Matrix< T > itemprob
(n x h+1) column 0 = miss, 1.. = per list
std::vector< T > missprob
(K)
std::vector< T > hitprob
(K) TRUE hit fraction, NaN off the read class
Matrix< T > hitproblist
(K x h) per-list hit fraction
std::vector< T > delayedprob
(K) delayed-hit fraction
std::vector< T > latency
(K) NaN: the latency belongs to SolverMVA
The [Q,U,R,T,C,X,lG] of the reference, plus the algorithm that ran.
solvers::LossnInfo lossn
Set only by the loss-network analyzer (solver_nc_lossn.h), EMPTY for every other model: the inputs ge...
std::vector< T > listcost
(h) mean storage cost held by each cache list, K_j = sum_i sigma_i pi_ij.
mva::MvaSolution< T > sol
std::string warning
The reference's warning text, verbatim, empty when it did not warn.
std::shared_ptr< qn::NetworkStruct< T > > refreshed_struct
Set only by the integrated cacheqn branch: the converged struct whose routing carries the ACTUAL hit/...
solvers::CacheMetrics< T > cache
What the cache branches observed, EMPTY on a model with no Cache node.
Controls, defaulting to SolverOptions('NC') in the reference.
std::string multiserver
options.config.multiserver: how a finite multiserver station is represented.
bool base_has_fork
Whether the model this solve came from has a Fork, which the model handed to the analyzer no longer d...
One job class of the network.
double population
infinite for an open class
One station of the network.
double nservers
may be infinite (a Delay, or an inf-scheduled task)
std::vector< T > lldscaling
sn.lldscaling for this station: the multiplier at population 1, 2, ... Empty when the station is not ...