35#include <initializer_list>
126std::vector<int> ints_with_inf(
const Json& j,
const std::string& where) {
127 std::vector<Json> flat;
131 for (
const Json& e : j) {
133 for (
const Json& f : e) flat.push_back(f);
138 std::vector<int> out;
139 out.reserve(flat.size());
140 for (
const Json& e : flat) {
142 std::string s = e.get<std::string>();
143 for (
char& c : s) c =
static_cast<char>(std::tolower(
static_cast<unsigned char>(c)));
144 if (s ==
"inf" || s ==
"+inf" || s ==
"infinity") {
150 if (one.size() != 1)
throw InputError(where +
": expected an integer or \"Inf\"");
152 throw InputError(where +
": a negative entry other than -1 has no meaning, got " +
153 std::to_string(one[0]));
154 out.push_back(one[0]);
159std::vector<int> pop_with_open(
Args& a,
const char* key) {
160 return ints_with_inf(a.get(key), std::string(
"'") + key +
"'");
163std::vector<int> pop_with_open_or_empty(
Args& a,
const char* key) {
164 const Json* v = a.opt(key);
165 return v ? ints_with_inf(*v, std::string(
"'") + key +
"'") : std::vector<int>();
169Matrix<int> int_matrix(
Args& a,
const char* key) {
170 const Json& j = a.get(key);
171 const std::string where = std::string(
"'") + key +
"'";
172 std::vector<std::vector<int> > rows;
173 if (j.is_array() && !j.empty() && j[0].is_array()) {
175 }
else if (!(j.is_array() && j.empty())) {
178 const std::size_t m = rows.size(), n = m ? rows[0].size() : 0;
180 for (std::size_t i = 0; i < m; ++i) {
181 if (rows[i].size() != n)
throw InputError(where +
": rows have different lengths");
182 for (std::size_t k = 0; k < n; ++k) M(i, k) = rows[i][k];
188std::vector<std::size_t> indices(
Args& a,
const char* key) {
189 const std::vector<int> v = a.ints(key);
190 std::vector<std::size_t> out;
191 out.reserve(v.size());
194 throw InputError(std::string(
"'") + key +
"' holds 0-based indices and cannot be "
195 "negative, got " + std::to_string(x));
196 out.push_back(
static_cast<std::size_t
>(x));
201std::vector<long> longs(
Args& a,
const char* key) {
202 const std::vector<int> v = a.ints(key);
203 return std::vector<long>(v.begin(), v.end());
206long a_long(
Args& a,
const char* key) {
return static_cast<long>(a.required_integer(key)); }
209std::vector<double> doubles(
Args& a,
const char* key) {
return a.vector<
double>(key); }
211std::vector<bool> bools(
Args& a,
const char* key) {
212 const Json& j = a.get(key);
213 std::vector<bool> out;
215 if (e.is_boolean()) {
216 out.push_back(e.get<
bool>());
221 if (x != 0 && x != 1)
222 throw InputError(std::string(
"'") + key +
"' entries must be true, false, 0 or 1");
223 out.push_back(x != 0);
238std::size_t given_prefix(
Args& a,
const char* fn, std::initializer_list<const char*> keys) {
242 for (
const char* key : keys) {
245 throw InputError(std::string(fn) +
": '" + key +
"' is positional after " +
246 missing +
", which must then be given as well");
249 if (!gap) missing = std::string(
"'") + key +
"'";
257bool all_or_none(
Args& a,
const char* fn, std::initializer_list<const char*> keys) {
259 std::string names, missing;
260 for (
const char* key : keys) {
261 names += (names.empty() ?
"'" :
", '") + std::string(key) +
"'";
265 missing += (missing.empty() ?
"'" :
", '") + std::string(key) +
"'";
267 if (n == 0)
return false;
268 if (n == keys.size())
return true;
269 throw InputError(std::string(fn) +
": arguments " + names +
270 " are taken together by the port's long form; missing " + missing);
276 OptObj(Args& a,
const char* key,
const char* fn) : j_(a.opt(key)), fn_(fn), key_(key) {
277 if (j_ && !j_->is_object())
278 throw InputError(fn_ +
": '" + key_ +
"' must be an object");
280 OptObj(
const Json* j, std::string fn, std::string key) : j_(j), fn_(std::move(fn)), key_(std::move(key)) {
281 if (j_ && !j_->is_object())
282 throw InputError(fn_ +
": '" + key_ +
"' must be an object");
284 bool given()
const {
return j_ !=
nullptr; }
285 bool has(
const char* k)
const {
return j_ && j_->find(k) != j_->end(); }
286 const Json&
get(
const char* k) {
288 if (!has(k))
throw InputError(fn_ +
": missing required field '" + key_ +
"." + k +
"'");
291 const Json* sub(
const char* k) {
293 return has(k) ? &*j_->find(k) :
nullptr;
295 std::string where(
const char* k)
const {
return fn_ +
": " + key_ +
"." + k; }
297 T number(
const char* k) {
300 std::string text(
const char* k) {
302 if (!v.is_string())
throw InputError(where(k) +
" must be a string");
303 return v.get<std::string>();
305 std::size_t count(
const char* k) {
307 if (v.size() != 1 || v[0] < 0)
308 throw InputError(where(k) +
" must be a single non-negative integer");
309 return static_cast<std::size_t
>(v[0]);
313 for (
auto it = j_->begin(); it != j_->end(); ++it)
314 if (seen_.find(it.key()) == seen_.end())
315 throw InputError(fn_ +
": unknown field '" + key_ +
"." + it.key() +
"'");
322 std::set<std::string> seen_;
330pfqn::NcOptions nc_options(OptObj& o,
const char* fn) {
332 if (o.has(
"samples")) n.samples = o.count(
"samples");
333 if (o.has(
"seed")) n.seed =
static_cast<unsigned long>(o.count(
"seed"));
334 OptObj cfg(o.sub(
"config"), fn,
"options.config");
335 if (cfg.has(
"aghq_nodes")) n.aghq_nodes = cfg.count(
"aghq_nodes");
336 if (cfg.has(
"mcmc_batches")) n.mcmc_batches = cfg.count(
"mcmc_batches");
337 if (cfg.has(
"mcmc_burnin")) n.mcmc_burnin = cfg.number<
double>(
"mcmc_burnin");
343E enum_of(
const std::string& fn,
const char* key,
const std::string& value,
344 std::initializer_list<std::pair<const char*, E>> table) {
345 std::string low = value;
346 for (
char& c : low) c =
static_cast<char>(std::tolower(
static_cast<unsigned char>(c)));
347 std::string accepted;
348 for (
const auto& p : table) {
349 if (low == p.first)
return p.second;
350 accepted += (accepted.empty() ?
"" :
", ") + std::string(p.first);
352 throw InputError(fn +
": unknown " + key +
" '" + value +
"'; accepted: " + accepted);
355std::vector<std::string> strings(
Args& a,
const char* key) {
356 const Json& j = a.get(key);
357 std::vector<std::string> out;
359 out.push_back(j.get<std::string>());
362 if (!j.is_array())
throw InputError(std::string(
"'") + key +
"' must be a list of strings");
363 for (
const Json& e : j) {
364 if (!e.is_string())
throw InputError(std::string(
"'") + key +
"' must be a list of strings");
365 out.push_back(e.get<std::string>());
371std::vector<pfqn::SchedStrategy> sched_list(
Args& a,
const char* key,
const char* fn) {
372 std::vector<pfqn::SchedStrategy> out;
373 for (
const std::string& s : strings(a, key))
374 out.push_back(enum_of<pfqn::SchedStrategy>(fn, key, s,
381std::vector<pfqn::AmvaSched> amva_sched_list(
Args& a,
const char* key,
const char* fn) {
382 std::vector<pfqn::AmvaSched> out;
383 for (
const std::string& s : strings(a, key))
384 out.push_back(enum_of<pfqn::AmvaSched>(fn, key, s,
391Json enc_idx(
const std::vector<std::size_t>& v) {
392 Json j = Json::array();
393 for (std::size_t x : v) j.push_back(
static_cast<std::uint64_t
>(x));
397Json enc_bools(
const std::vector<bool>& v) {
398 Json j = Json::array();
399 for (
bool b : v) j.push_back(b);
405Json enc_tensor(
const moment::MomentTensor<T>& t) {
407 j[
"sz"] = enc_idx(t.sz);
418Json mva_out(
const pfqn::MvaResult<T>& r,
const char* lgkey) {
430Json amva_out(
const pfqn::AmvaResult<T>& r,
const char* itkey) {
437 out[
"converged"] = r.converged;
442Json linearizer_out(
const pfqn::LinearizerResult<T>& r) {
449 out[
"totiter"] = r.totiter;
454Json schmidt_out(
const R& r) {
469 static Json run(Args& a) {
470 const Matrix<T> L = a.matrix<T>(
"L");
471 const std::vector<int> N = a.ints(
"N");
472 pfqn::PfqnManjunathOptions opt;
475 if (a.has(
"stats")) opt.stats = a.boolean(
"stats", opt.stats);
476 const std::size_t k = given_prefix(a,
"pfqn_manjunath", {
"Z",
"A",
"b",
"sense"});
477 pfqn::PfqnManjunathResult<T> r;
482 const Matrix<T> Z = a.matrix<T>(
"Z");
487 throw InputError(
"pfqn_manjunath: 'A', 'b' and 'sense' describe the constraint "
488 "rows together; give all three");
489 const Matrix<T> Z = a.matrix<T>(
"Z");
490 const Matrix<T> A = a.matrix<T>(
"A");
491 const std::vector<long> b = longs(a,
"b");
492 const std::string sense = a.text(
"sense",
"");
522 static Json run(Args& a) {
523 const std::vector<T> lambda = a.vector_or_empty<T>(
"lambda");
524 const Matrix<T> L = a.matrix<T>(
"L");
525 const std::vector<int> N = pop_with_open(a,
"N");
526 const Matrix<T> Z = a.matrix_or_empty<T>(
"Z");
527 OptObj o(a,
"options",
"pfqn_nc");
528 if (!o.given())
throw InputError(
"pfqn_nc: missing required argument 'options' (with field 'method')");
530 const bool longform = !lambda.empty() || o.has(
"tol") || o.has(
"samples") ||
531 o.has(
"seed") || o.has(
"config");
532 pfqn::NcDispatchResult<T> r;
539 throw InputError(
"pfqn_nc: the port's long form (open classes or sampling "
540 "options) takes the absolute tolerance options.tol explicitly");
541 const T atol = o.number<T>(
"tol");
542 pfqn::NcOptions nopt = nc_options(o,
"pfqn_nc");
543 nopt.tol = num_traits<T>::to_double(atol);
553 out[
"method"] = r.method;
554 out[
"valid"] = r.valid;
561 static Json run(Args& a) {
562 const bool lng = all_or_none(a,
"pfqn_nc_sanitize", {
"lambda",
"atol"});
563 pfqn::NcSanitizeResult<T> r;
565 const std::vector<T> lambda = a.vector_or_empty<T>(
"lambda");
566 const Matrix<T> L = a.matrix<T>(
"L");
567 const std::vector<int> N = pop_with_open(a,
"N");
568 const Matrix<T> Z = a.matrix_or_empty<T>(
"Z");
569 const T atol = a.number<T>(
"atol");
573 const Matrix<T> L = a.matrix<T>(
"L");
574 const std::vector<int> N = pop_with_open(a,
"N");
575 const Matrix<T> Z = a.matrix_or_empty<T>(
"Z");
584 out[
"lGremaind"] = r.lGremaind;
586 out[
"classIndex"] = enc_idx(r.classIndex);
593 static Json run(Args& a) {
594 const Matrix<T> L = a.matrix<T>(
"L");
595 const std::vector<int> N = a.ints(
"N");
596 const Matrix<T> Z = a.matrix_or_empty<T>(
"Z");
597 const Matrix<T> mu = a.matrix<T>(
"mu");
598 OptObj o(a,
"options",
"pfqn_ncld");
599 pfqn::NcldResult<T> r;
604 const std::string method = o.text(
"method");
605 const T atol = o.number<T>(
"tol");
606 pfqn::NcOptions nopt = nc_options(o,
"pfqn_ncld");
607 nopt.tol = num_traits<T>::to_double(atol);
615 out[
"method"] = r.method;
622 static Json run(Args& a) {
623 const std::vector<T> lambda = a.vector<T>(
"lambda");
624 const Matrix<T> D = a.matrix<T>(
"D");
625 const std::vector<int> N = pop_with_open(a,
"N");
626 const Matrix<T> Z = a.matrix_or_empty<T>(
"Z");
627 const Matrix<T> mu = a.matrix<T>(
"mu");
628 OptObj o(a,
"options",
"pfqn_ncldmx");
629 pfqn::NcldmxResult<T> r;
634 const std::string method = o.text(
"method");
635 const T atol = o.number<T>(
"tol");
636 pfqn::NcOptions nopt = nc_options(o,
"pfqn_ncldmx");
637 nopt.tol = num_traits<T>::to_double(atol);
645 out[
"lGopen"] = r.lGopen;
656 static Json run(Args& a) {
657 const Matrix<T> A = a.matrix<T>(
"A");
658 const std::vector<int> m = a.ints(
"m");
668 static Json run(Args& a) {
669 const std::vector<T> L = a.vector<T>(
"L");
670 const std::vector<T> N = a.vector<T>(
"N");
671 const std::vector<T> Z = a.vector<T>(
"Z");
683using NrFn = T (*)(
const Matrix<T>&,
const std::vector<T>&,
const std::vector<T>&,
686template <
template <
class>
class F>
689 static Json run(Args& a) {
690 const Matrix<T> L = a.matrix<T>(
"L");
691 const std::vector<T> N = a.vector<T>(
"N");
692 const std::vector<T> Z = a.vector<T>(
"Z");
693 const Matrix<T> alpha = a.matrix<T>(
"alpha");
702 static T call(
const Matrix<T>& L,
const std::vector<T>& N,
const std::vector<T>& Z,
703 const Matrix<T>& al) {
709 static T call(
const Matrix<T>& L,
const std::vector<T>& N,
const std::vector<T>& Z,
710 const Matrix<T>& al) {
716 static T call(
const Matrix<T>& L,
const std::vector<T>& N,
const std::vector<T>& Z,
717 const Matrix<T>& al) {
724 static Json run(Args& a) {
725 const std::vector<T> Phi = a.vector<T>(
"Phi");
726 const std::vector<int> N = a.ints(
"N");
727 a.unsupported(
"f",
"the per-state function f is a callable, which has no JSON "
728 "representation; call pfqn_oi_fnc from the library for that case");
734 out[
"stride"] = enc_idx(r.stride);
741 static Json run(Args& a) {
742 const Matrix<T> L = a.matrix<T>(
"L");
743 const std::vector<int> N = a.ints(
"N");
744 const std::vector<T> Z = a.vector<T>(
"Z");
745 pfqn::PanaceaResult<T> r;
746 if (a.has(
"terms")) {
747 const int terms = a.required_integer(
"terms");
757 out[
"normalUsage"] = r.normalUsage;
764 static Json run(Args& a) {
765 const Matrix<T> L = a.matrix<T>(
"L");
766 const std::vector<int> N = a.ints(
"N");
767 const std::vector<T> Z = a.vector<T>(
"Z");
768 const Matrix<T> mu = a.matrix<T>(
"mu");
769 pfqn::PanaceaLdResult<T> r;
770 if (a.has(
"terms")) {
771 const int terms = a.required_integer(
"terms");
781 out[
"normalUsage"] = r.normalUsage;
782 out[
"reason"] = r.reason ? std::string(r.reason) : std::string();
789 static Json run(Args& a) {
790 const Matrix<T> L = a.matrix<T>(
"L");
791 const std::vector<T> N = a.vector<T>(
"N");
792 const std::vector<T> Z = a.vector<T>(
"Z");
805 static Json run(Args& a) {
806 const Matrix<T> L = a.matrix<T>(
"L");
807 const std::vector<int> N = a.ints(
"N");
808 const Matrix<T> Z = a.matrix_or_empty<T>(
"Z");
809 const Matrix<T> mu = a.matrix<T>(
"mu");
810 OptObj o(a,
"options",
"pfqn_rd");
816 const double tol = o.number<
double>(
"tol");
831 static Json run(Args& a) {
832 const std::vector<T> L = a.vector<T>(
"L");
833 const int N = a.required_integer(
"N");
834 pfqn::RgfResult<T> r;
836 const T Z = a.number<T>(
"Z");
853 static Json run(Args& a) {
854 const Matrix<T> L = a.matrix<T>(
"L");
855 const std::vector<int> N = a.ints(
"N");
856 const std::vector<T> Z = a.vector<T>(
"Z");
857 OptObj o(a,
"options",
"pfqn_rgfmc");
858 pfqn::RgfmcResult<T> r;
863 const T tol = o.number<T>(
"tol");
864 const std::size_t maxterms = o.count(
"maxterms");
865 const T maxcancel = o.number<T>(
"maxcancel");
879 static Json run(Args& a) {
880 const std::vector<T> L = a.vector<T>(
"L");
881 const int N = a.required_integer(
"N");
882 const std::vector<T> s = a.vector<T>(
"s");
896 static Json run(Args& a) {
897 const std::vector<T> lambda = a.vector<T>(
"lambda");
898 const Matrix<T> L = a.matrix<T>(
"L");
899 const std::vector<int> N = pop_with_open(a,
"N");
900 const Matrix<T> Z = a.matrix_or_empty<T>(
"Z");
901 pfqn::MvaResult<T> r;
903 const std::vector<int> mi = a.ints(
"mi");
905 throw InputError(
"pfqn_mvams: the port's form with 'mi' also takes 'S'");
906 const std::vector<int> S = pop_with_open(a,
"S");
909 }
else if (a.has(
"S")) {
910 const std::vector<int> S = pop_with_open(a,
"S");
917 return mva_out(r,
"lG");
923 static Json run(Args& a) {
924 const std::vector<T> lambda = a.vector<T>(
"lambda");
925 const Matrix<T> D = a.matrix<T>(
"D");
926 const std::vector<int> N = pop_with_open(a,
"N");
927 const Matrix<T> Z = a.matrix_or_empty<T>(
"Z");
928 const std::vector<int> mi = a.ints_or_empty(
"mi");
936 static Json run(Args& a) {
937 const std::vector<T> lambda = a.vector<T>(
"lambda");
938 const Matrix<T> D = a.matrix<T>(
"D");
939 const std::vector<int> N = pop_with_open(a,
"N");
940 const Matrix<T> Z = a.matrix_or_empty<T>(
"Z");
941 const Matrix<T> mu = a.matrix<T>(
"mu");
949 static Json run(Args& a) {
950 const std::vector<T> lambda = a.vector<T>(
"lambda");
951 const Matrix<T> D = a.matrix<T>(
"D");
952 const std::vector<int> N = pop_with_open(a,
"N");
953 const Matrix<T> Z = a.matrix_or_empty<T>(
"Z");
954 const std::vector<int> S = pop_with_open(a,
"S");
962 static Json run(Args& a) {
963 const Matrix<T> L = a.matrix<T>(
"L");
964 const std::vector<int> N = a.ints(
"N");
965 const Matrix<T> Z = a.matrix_or_empty<T>(
"Z");
966 const Matrix<T> mu = a.matrix<T>(
"mu");
967 pfqn::MvaLdResult<T> r;
968 if (a.has(
"stabilize")) {
969 const bool st = a.boolean(
"stabilize",
false);
983 out[
"isNumStable"] = r.isNumStable;
992 static Json run(Args& a) {
993 const long N = a_long(a,
"N");
994 const std::vector<T> S = a.vector<T>(
"S");
995 const Matrix<T>
P = a.matrix<T>(
"P");
996 const std::vector<double> K = doubles(a,
"K");
997 const std::vector<bool> isdelay = bools(a,
"isdelay");
998 const std::size_t k = given_prefix(a,
"pfqn_debemva", {
"tol",
"iter_max"});
999 pfqn::DebemvaResult<T> r;
1003 }
else if (k == 1) {
1004 const double tol = a.number<
double>(
"tol");
1008 const double tol = a.number<
double>(
"tol");
1009 const long iter_max = a_long(a,
"iter_max");
1020 out[
"theta"] = r.theta;
1021 out[
"iter"] = r.iter;
1022 out[
"converged"] = r.converged;
1028 static Json run(Args& a) {
1029 const std::vector<double> lam = a.vector<
double>(
"lam");
1030 const Matrix<double> A = a.matrix<
double>(
"A");
1031 const Matrix<double> S = a.matrix<
double>(
"S");
1032 const Matrix<double> SCV = a.matrix<
double>(
"SCV");
1033 const std::vector<double> nservers = doubles(a,
"nservers");
1034 const std::vector<bool> isps = bools(a,
"isps");
1035 const std::vector<double> poolv = doubles(a,
"pool");
1036 const std::vector<double> Ncapv = doubles(a,
"Ncap");
1037 const bool waitq = a.boolean(
"waitq",
true);
1038 const double tol = a.has(
"tol") ? a.number<
double>(
"tol") : 1e-8;
1039 const long iter_max = a.has(
"iter_max") ? a_long(a,
"iter_max") : 1000L;
1041 std::vector<int> pool, Ncap;
1042 for (
double v : poolv) pool.push_back(
static_cast<int>(v) - 1);
1043 for (
double v : Ncapv) Ncap.push_back(
static_cast<int>(v));
1044 const pfqn::OqnrcResult r =
1045 pfqn::pfqn_oqnrc(lam, A, S, SCV, nservers, isps, pool, Ncap, waitq, tol,
static_cast<int>(iter_max));
1054 out[
"iter"] = r.iter;
1061 static Json run(Args& a) {
1062 const long N = a_long(a,
"N");
1063 const std::vector<T> S = a.vector<T>(
"S");
1064 const Matrix<T>
P = a.matrix<T>(
"P");
1065 const std::vector<double> K = doubles(a,
"K");
1066 const std::vector<bool> isdelay = bools(a,
"isdelay");
1067 const std::size_t k = given_prefix(a,
"pfqn_mvablo", {
"tol",
"iter_max"});
1068 pfqn::MvabloResult<T> r;
1072 }
else if (k == 1) {
1073 const double tol = a.number<
double>(
"tol");
1077 const double tol = a.number<
double>(
"tol");
1078 const int iter_max = a.required_integer(
"iter_max");
1088 out[
"iter"] = r.iter;
1089 out[
"converged"] = r.converged;
1096 static Json run(Args& a) {
1097 const Matrix<T> L = a.matrix<T>(
"L");
1098 const std::vector<int> N = a.ints(
"N");
1099 pfqn::MvacResult<T> r;
1101 const Matrix<T> Z = a.matrix<T>(
"Z");
1119 static Json run(Args& a) {
1120 const Matrix<T> L = a.matrix<T>(
"L");
1121 const std::vector<int> N = a.ints(
"N");
1122 const Matrix<T> Z = a.matrix<T>(
"Z");
1123 pfqn::MvacldResult<T> r;
1125 const Matrix<T> mu = a.matrix<T>(
"mu");
1144 static Json run(Args& a) {
1145 const std::vector<T> L = a.vector<T>(
"L");
1146 const T N = a.number<T>(
"N");
1147 pfqn::NintMvaResult<T> r;
1149 const T Z = a.number<T>(
"Z");
1165struct OpMvaInterval {
1167 static Json run(Args& a) {
1168 const Matrix<T> L = a.matrix<T>(
"L");
1169 const std::vector<int> N = a.ints(
"N");
1170 const std::vector<T> Z = a.vector<T>(
"Z");
1173 if (N.size() != 1 && N.size() != 2)
1174 throw InputError(
"pfqn_mva_interval: 'N' must be [nlo nup] or a scalar");
1175 if (Z.size() != 1 && Z.size() != 2)
1176 throw InputError(
"pfqn_mva_interval: 'Z' must be [zlo zup] or a scalar");
1177 const pfqn::MvaIntervalResult<T> r =
1192 static Json run(Args& a) {
1193 const Matrix<T> L = a.matrix<T>(
"L");
1194 const std::vector<int> N = a.ints(
"N");
1195 const std::vector<T> Z = a.vector<T>(
"Z");
1196 pfqn::MomlinResult<T> r;
1197 if (all_or_none(a,
"pfqn_momlin", {
"tol",
"maxiter"})) {
1198 const T tol = a.number<T>(
"tol");
1199 const int maxiter = a.required_integer(
"maxiter");
1214 qc[
"sz"] = Json::array({r.M, r.Rc, r.M, r.Rc});
1228 static Json run(Args& a) {
1229 const Matrix<T> L = a.matrix<T>(
"L");
1230 const std::vector<T> N = a.vector<T>(
"N");
1231 const std::size_t k =
1232 given_prefix(a,
"pfqn_qsa", {
"Z",
"type",
"tol",
"maxiter",
"levels"});
1233 pfqn::AmvaResult<T> r;
1237 }
else if (k == 1) {
1238 const std::vector<T> Z = a.vector<T>(
"Z");
1242 const std::vector<T> Z = a.vector<T>(
"Z");
1243 const std::vector<pfqn::AmvaSched> type = amva_sched_list(a,
"type",
"pfqn_qsa");
1247 }
else if (k == 3) {
1248 const double tol = a.number<
double>(
"tol");
1251 }
else if (k == 4) {
1252 const double tol = a.number<
double>(
"tol");
1253 const std::size_t maxiter = a.count(
"maxiter");
1257 const double tol = a.number<
double>(
"tol");
1258 const std::size_t maxiter = a.count(
"maxiter");
1259 const int levels = a.required_integer(
"levels");
1270 out[
"converged"] = r.converged;
1277 static Json run(Args& a) {
1278 const Matrix<T> L = a.matrix<T>(
"L");
1279 const std::vector<T> N = a.vector<T>(
"N");
1280 const std::vector<T> Z = a.vector<T>(
"Z");
1281 const Matrix<T> mu = a.matrix<T>(
"mu");
1282 const Matrix<T> Q0 = a.matrix<T>(
"Q0");
1283 const std::size_t k = given_prefix(a,
"pfqn_qdamva", {
"tol",
"maxiter"});
1284 pfqn::QdAmvaResult<T> r;
1288 }
else if (k == 1) {
1289 const double tol = a.number<
double>(
"tol");
1293 const double tol = a.number<
double>(
"tol");
1294 const std::size_t maxiter = a.count(
"maxiter");
1310 static Json run(Args& a) {
1311 const Matrix<T> L = a.matrix<T>(
"L");
1312 const std::vector<T> N = a.vector<T>(
"N");
1313 const std::vector<T> Z = a.vector<T>(
"Z");
1314 pfqn::QdLinResult<T> r;
1315 const bool ld = all_or_none(a,
"pfqn_qdlin", {
"mu",
"nservers"});
1316 const std::size_t k = given_prefix(a,
"pfqn_qdlin", {
"tol",
"maxiter",
"wtol"});
1318 std::vector<double> ns;
1320 mu = a.matrix<T>(
"mu");
1321 ns = doubles(a,
"nservers");
1323 double tol = 0, wtol = 0;
1324 std::size_t maxiter = 0;
1325 if (k >= 1) tol = a.number<
double>(
"tol");
1326 if (k >= 2) maxiter = a.count(
"maxiter");
1327 if (k >= 3) wtol = a.number<
double>(
"wtol");
1353 static Json run(Args& a) {
1354 const Matrix<T> L = a.matrix<T>(
"L");
1355 const std::vector<T> N = a.vector<T>(
"N");
1356 const std::size_t k = given_prefix(a,
"pfqn_pam", {
"Z",
"variant"});
1357 pfqn::AmvaResult<T> r;
1362 const std::vector<T> Z = a.vector<T>(
"Z");
1368 "pfqn_pam",
"variant", a.text(
"variant",
""),
1369 {{
"pamb", pfqn::PamVariant::Basic},
1370 {
"pami", pfqn::PamVariant::Improved},
1371 {
"pamt", pfqn::PamVariant::Two}});
1376 return amva_out(r,
"iterations");
1382 static Json run(Args& a) {
1383 const Matrix<T> L = a.matrix<T>(
"L");
1384 const std::vector<T> N = a.vector<T>(
"N");
1385 const std::size_t k = given_prefix(a,
"pfqn_tay", {
"Z",
"tol",
"maxiter",
"QN0"});
1386 pfqn::AmvaResult<T> r;
1391 const std::vector<T> Z = a.vector<T>(
"Z");
1395 }
else if (k == 2) {
1396 const double tol = a.number<
double>(
"tol");
1399 }
else if (k == 3) {
1400 const double tol = a.number<
double>(
"tol");
1401 const std::size_t maxiter = a.count(
"maxiter");
1405 const double tol = a.number<
double>(
"tol");
1406 const std::size_t maxiter = a.count(
"maxiter");
1407 const Matrix<T> QN0 = a.matrix<T>(
"QN0");
1412 return amva_out(r,
"it");
1418 static Json run(Args& a) {
1419 const Matrix<T> L = a.matrix<T>(
"L");
1420 const std::vector<int> N = a.ints(
"N");
1421 const bool lng = all_or_none(a,
"pfqn_scat", {
"type",
"tol",
"maxiter",
"QN0"});
1422 pfqn::LinearizerResult<T> r;
1424 const Matrix<T> Z = a.matrix<T>(
"Z");
1425 const std::vector<pfqn::SchedStrategy> type = sched_list(a,
"type",
"pfqn_scat");
1426 const double tol = a.number<
double>(
"tol");
1427 const int maxiter = a.required_integer(
"maxiter");
1428 const Matrix<T> QN0 = a.matrix_or_empty<T>(
"QN0");
1431 }
else if (a.has(
"Z")) {
1432 const Matrix<T> Z = a.matrix<T>(
"Z");
1439 return linearizer_out(r);
1445 static Json run(Args& a) {
1446 const Matrix<T> D = a.matrix<T>(
"D");
1447 const std::vector<int> N = a.ints(
"N");
1448 const Matrix<int> S = int_matrix(a,
"S");
1449 const std::vector<pfqn::SchedStrategy> sched = sched_list(a,
"sched",
"pfqn_schmidt");
1450 pfqn::SchmidtResult<T> r;
1452 const Matrix<T> v = a.matrix<T>(
"v");
1459 return schmidt_out(r);
1463struct OpSchmidtExt {
1465 static Json run(Args& a) {
1466 const Matrix<T> D = a.matrix<T>(
"D");
1467 const std::vector<int> N = a.ints(
"N");
1468 const Matrix<int> S = int_matrix(a,
"S");
1469 const std::vector<pfqn::SchedStrategy> sched = sched_list(a,
"sched",
"pfqn_schmidt_ext");
1477 static Json run(Args& a) {
1478 const Matrix<T> L = a.matrix<T>(
"L");
1479 const std::vector<int> N = a.ints(
"N");
1480 const std::vector<T> Z = a.vector<T>(
"Z");
1481 const Matrix<T> scv = a.matrix<T>(
"scv");
1482 pfqn::MarieResult<T> r;
1483 if (all_or_none(a,
"pfqn_marie", {
"tol",
"maxiter",
"nservers"})) {
1484 const double tol = a.number<
double>(
"tol");
1485 const int maxiter = a.required_integer(
"maxiter");
1486 const std::vector<int> ns = a.ints(
"nservers");
1499 if (r.cds.empty()) {
1502 Json mu = Json::array();
1503 for (
const auto& c : r.cds) {
1520 static Json run(Args& a) {
1521 const Matrix<T> L = a.matrix<T>(
"L");
1522 const std::vector<int> N = a.ints(
"N");
1523 const Matrix<T> Z = a.matrix_or_empty<T>(
"Z");
1524 const std::vector<int> S = a.ints(
"S");
1525 const std::vector<std::size_t> fcfs = indices(a,
"fcfsNodes");
1526 const Matrix<T> rates = a.matrix<T>(
"rates");
1527 const std::vector<T> tset = a.vector<T>(
"tset");
1529 const pfqn::StdfResult<T> r = Heur
1531 : pfqn::
pfqn_stdf(L, N, Z, S, fcfs, rates, tset);
1532 Json rd = Json::array();
1537 out[
"isNumStable"] = r.isNumStable;
1544 static Json run(Args& a) {
1545 const std::vector<T> N = a.vector<T>(
"N");
1546 const std::vector<T> L = a.vector<T>(
"L");
1547 const std::vector<T> Z = a.vector<T>(
"Z");
1560 static Json run(Args& a) {
1561 const Matrix<T> S = a.matrix<T>(
"S");
1562 const Matrix<T> xi = a.matrix<T>(
"xi");
1563 const std::vector<std::size_t> N = indices(a,
"N");
1564 OptObj o(a,
"sdr",
"pfqn_sdr");
1565 if (!o.given())
throw InputError(
"pfqn_sdr: missing required argument 'sdr'");
1566 pfqn::SdrStruct sdr;
1567 auto idx = [&](
const char* k) {
1569 std::vector<std::size_t> out;
1571 if (x < 0)
throw InputError(o.where(k) +
" cannot be negative");
1572 out.push_back(
static_cast<std::size_t
>(x));
1576 sdr.entry = o.count(
"entry");
1577 sdr.departure = o.count(
"departure");
1579 const Json& br = o.get(
"branch");
1580 if (!br.is_array())
throw InputError(o.where(
"branch") +
" must be a list of index lists");
1581 for (std::size_t b = 0; b < br.size(); ++b) {
1582 std::vector<std::size_t> blk;
1583 if (!br[b].is_null())
1585 if (x < 0)
throw InputError(o.where(
"branch") +
" cannot be negative");
1586 blk.push_back(
static_cast<std::size_t
>(x));
1588 sdr.branch.push_back(blk);
1591 sdr.entryOf = idx(
"entryOf");
1592 sdr.departureOf = idx(
"departureOf");
1593 sdr.level = idx(
"level");
1597 pfqn::SdrResult<T> r;
1598 if (a.has(
"alpha")) {
1599 const Matrix<T> alpha = a.matrix<T>(
"alpha");
1621template <
template <
class>
class F>
1624 static Json run(Args& a) {
1625 const std::vector<T> L = a.vector<T>(
"L");
1626 const T N = a.number<T>(
"N");
1627 const T Z = a.number<T>(
"Z");
1636 static constexpr const char* key =
"XN";
1637 static T call(
const std::vector<T>& L,
const T& N,
const T& Z) {
return pfqn::pfqn_xzabalow(L, N, Z); }
1641 static constexpr const char* key =
"XN";
1642 static T call(
const std::vector<T>& L,
const T& N,
const T& Z) {
return pfqn::pfqn_xzabaup(L, N, Z); }
1646 static constexpr const char* key =
"X";
1647 static T call(
const std::vector<T>& L,
const T& N,
const T& Z) {
return pfqn::pfqn_xzgsblow(L, N, Z); }
1651 static constexpr const char* key =
"X";
1652 static T call(
const std::vector<T>& L,
const T& N,
const T& Z) {
return pfqn::pfqn_xzgsbup(L, N, Z); }
1658 static Json run(Args& a) {
1659 const std::vector<T> L = a.vector<T>(
"L");
1660 const T N = a.number<T>(
"N");
1661 const T Z = a.number<T>(
"Z");
1662 const std::size_t i = a.count(
"i");
1673 static Json run(Args& a) {
1674 const std::vector<T> L = a.vector<T>(
"L");
1675 const T N = a.number<T>(
"N");
1676 const T Z = a.number<T>(
"Z");
1677 pfqn::SsdBounds<T> r;
1678 if (a.has(
"nservers")) {
1679 const std::vector<T> ns = a.vector<T>(
"nservers");
1695 static Json run(Args& a) {
1696 const Matrix<T> L = a.matrix<T>(
"L");
1697 const std::vector<T> N = a.vector<T>(
"N");
1698 pfqn::McubBounds<T> r;
1700 const std::vector<T> Z = a.vector<T>(
"Z");
1716 static Json run(Args& a) {
1717 const Matrix<T> V = a.matrix<T>(
"V");
1718 const Matrix<T> S = a.matrix<T>(
"S");
1719 const std::vector<T> N = a.vector<T>(
"N");
1720 const std::vector<T> Z = a.vector<T>(
"Z");
1721 pfqn::MwrbbBounds<T> r;
1722 if (all_or_none(a,
"pfqn_mwrbb", {
"sched",
"prio"})) {
1723 std::vector<pfqn::MwrbbSched> sched;
1724 for (
int c : a.ints(
"sched")) {
1726 throw InputError(
"pfqn_mwrbb: 'sched' codes are 0=FIFO, 1=PS, 2=non-preemptive "
1727 "priority, 3=preemptive priority, 4=ABA; got " +
1731 const std::vector<int> prio = a.ints(
"prio");
1748 static Json run(Args& a) {
1749 const std::vector<T> L = a.vector<T>(
"L");
1750 const int N = a.required_integer(
"N");
1751 const T Z = a.number<T>(
"Z");
1752 pfqn::PbhBounds<T> r;
1753 if (a.has(
"level")) {
1754 const int level = a.required_integer(
"level");
1772 static Json run(Args& a) {
1773 const std::vector<T> L = a.vector<T>(
"L");
1774 const int N = a.required_integer(
"N");
1775 const T Z = a.number<T>(
"Z");
1776 pfqn::SibBounds<T> r;
1777 if (a.has(
"level")) {
1778 const int level = a.required_integer(
"level");
1795struct OpMvamsClosed {
1797 static Json run(Args& a) {
1798 const Matrix<T> L = a.matrix<T>(
"L");
1799 const std::vector<int> N = a.ints(
"N");
1800 const Matrix<T> Z = a.matrix_or_empty<T>(
"Z");
1801 const std::vector<T> mi = a.vector_or_empty<T>(
"mi");
1802 const std::vector<int> S = pop_with_open_or_empty(a,
"S");
1817struct OpKrizBounds {
1819 static Json run(Args& a) {
1820 const std::vector<T> L = a.vector<T>(
"L");
1821 const int N = a.required_integer(
"N");
1822 const T Z = a.has(
"Z") ? a.number<T>(
"Z") : num_traits<T>::from_int(0);
1823 const int level = a.integer(
"level", 0);
1835 info[
"level"] = r.info.level;
1846struct OpIbjbBounds {
1848 static Json run(Args& a) {
1849 const std::vector<T> L = a.vector<T>(
"L");
1850 const int N = a.required_integer(
"N");
1851 const T Z = a.has(
"Z") ? a.number<T>(
"Z") : num_traits<T>::from_int(0);
1862struct OpLdsyBounds {
1864 static Json run(Args& a) {
1865 const std::vector<T> L = a.vector<T>(
"L");
1866 const int N = a.required_integer(
"N");
1867 const T Z = a.has(
"Z") ? a.number<T>(
"Z") : num_traits<T>::from_int(0);
1868 const Matrix<T> mu = a.matrix_or_empty<T>(
"mu");
1872 const auto opt = [](
bool has,
const T& v) {
return has ?
encode_scalar(v) :
Json(
"NaN"); };
1874 info[
"thm31_lo"] = opt(r.info.has_thm31_lo, r.info.thm31_lo);
1875 info[
"thm31_hi"] = opt(r.info.has_thm31_hi, r.info.thm31_hi);
1876 info[
"thm32_lo"] = opt(r.info.has_thm32_lo, r.info.thm32_lo);
1877 info[
"thm33_lo"] = opt(r.info.has_thm33_lo, r.info.thm33_lo);
1878 info[
"thm33_hi"] = opt(r.info.has_thm33_hi, r.info.thm33_hi);
1879 info[
"thm42_lo"] = opt(r.info.has_thm42_lo, r.info.thm42_lo);
1880 info[
"sec42_bjb"] = opt(r.info.has_sec42_bjb, r.info.sec42_bjb);
1881 info[
"sec42_hi"] = opt(r.info.has_sec42_hi, r.info.sec42_hi);
1882 info[
"Kopt"] = r.info.Kopt > 0 ?
Json(r.info.Kopt) :
Json(
"NaN");
1893 static Json run(Args& a) {
1894 const std::vector<T> L = a.vector<T>(
"L");
1895 const long N = a_long(a,
"N");
1909 static Json run(Args& a) {
1910 const long N = a_long(a,
"N");
1911 const long K = a_long(a,
"K");
1913 if (all_or_none(a,
"pfqn_scbgap", {
"r",
"undominated"})) {
1914 const long r = a_long(a,
"r");
1915 const bool und = a.boolean(
"undominated",
false);
1930 static Json run(Args& a) {
1931 const long R = a_long(a,
"R");
1932 const long K = a_long(a,
"K");
1933 const long N = a_long(a,
"N");
1941struct OpMinclasses {
1943 static Json run(Args& a) {
1944 const T Usum = a.number<T>(
"Usum");
1945 const long K = a_long(a,
"K");
1946 const long N = a_long(a,
"N");
1960 static Json run(Args& a) {
1961 const Matrix<T> L = a.matrix<T>(
"L");
1962 pfqn::UniqueResult<T> r;
1963 if (all_or_none(a,
"pfqn_unique", {
"mu",
"gamma"})) {
1964 const Matrix<T> mu = a.matrix_or_empty<T>(
"mu");
1965 const Matrix<T> gamma = a.matrix_or_empty<T>(
"gamma");
1977 out[
"mapping"] = enc_idx(r.mapping);
1984 static Json run(Args& a) {
1985 const Matrix<T> mu = a.matrix<T>(
"mu");
1986 const std::vector<std::size_t> iset = indices(a,
"iset");
1996 static Json run(Args& a) {
1997 const int N = a.required_integer(
"N");
1998 const int m = a.required_integer(
"m");
1999 const int c = a.required_integer(
"c");
2013 static Json run(Args& a) {
2014 const Matrix<T> L = a.matrix<T>(
"L");
2015 const std::vector<int> N = a.ints(
"N");
2016 const std::vector<T> Z = a.vector<T>(
"Z");
2017 pfqn::SensResult<T> r;
2019 const std::vector<int> mi = a.ints(
"mi");
2031 Json ps = Json::array();
2032 for (
const auto& p : r.params) {
2034 e[
"type"] = std::string(1, p.type);
2035 e[
"station"] = p.station;
2036 e[
"class"] =
static_cast<std::uint64_t
>(p.cls);
2054struct OpSensLdmxEc {
2056 static Json run(Args& a) {
2057 const std::vector<T> lambda = a.vector<T>(
"lambda");
2058 const Matrix<T> D = a.matrix<T>(
"D");
2059 const Matrix<T> mu = a.matrix<T>(
"mu");
2074struct OpSensLinearizer {
2076 static Json run(Args& a) {
2077 const Matrix<T> L = a.matrix<T>(
"L");
2078 const std::vector<int> N = a.ints(
"N");
2079 const std::vector<T> Z = a.vector<T>(
"Z");
2080 pfqn::SensLinearizerResult<T> r;
2081 if (all_or_none(a,
"pfqn_sens_linearizer", {
"tol",
"maxiter"})) {
2082 const T tol = a.number<T>(
"tol");
2083 const unsigned maxiter = a.uinteger(
"maxiter");
2113 static Json run(Args& a) {
2114 const Matrix<T> L = a.matrix<T>(
"L");
2115 const std::vector<int> N = a.ints(
"N");
2116 const std::vector<T> Z = a.vector<T>(
"Z");
2117 pfqn::SensMomResult<T> r;
2118 if (all_or_none(a,
"pfqn_sens_mom", {
"mi",
"groups"})) {
2119 const std::vector<int> mi = a.ints_or_empty(
"mi");
2120 const std::vector<int> groups = a.ints_or_empty(
"groups");
2149 static Json run(Args& a) {
2150 const Matrix<T> L = a.matrix<T>(
"L");
2151 const std::vector<int> N = a.ints(
"N");
2152 const std::vector<T> Z = a.vector<T>(
"Z");
2153 pfqn::SensMvaResult<T> r;
2155 const std::vector<int> mi = a.ints(
"mi");
2177struct OpSensMvaldmx {
2179 static Json run(Args& a) {
2180 const std::vector<T> lambda = a.vector<T>(
"lambda");
2181 const Matrix<T> D = a.matrix<T>(
"D");
2182 const std::vector<int> N = pop_with_open(a,
"N");
2183 const std::vector<T> Z = a.vector<T>(
"Z");
2184 const Matrix<T> mu = a.matrix<T>(
"mu");
2203struct OpSensMomldmx {
2205 static Json run(Args& a) {
2206 const std::vector<T> lambda = a.vector<T>(
"lambda");
2207 const Matrix<T> D = a.matrix<T>(
"D");
2208 const std::vector<int> N = pop_with_open(a,
"N");
2209 const std::vector<T> Z = a.vector<T>(
"Z");
2210 const Matrix<T> mu = a.matrix<T>(
"mu");
2211 const std::vector<int> groups = a.ints_or_empty(
"groups");
2236 static Json run(Args& a) {
2237 const std::vector<T> S = a.vector<T>(
"S");
2238 const Matrix<T> V = a.matrix<T>(
"V");
2239 const std::vector<int> N = a.ints(
"N");
2240 const std::vector<T> Z = a.vector<T>(
"Z");
2241 pfqn::SensResptResult<T> r;
2242 if (all_or_none(a,
"pfqn_sens_respt", {
"b",
"tmax"})) {
2243 const std::vector<int> b = a.ints(
"b");
2244 const int tmax = a.required_integer(
"tmax");
2269struct OpQlenJointMoments {
2271 static Json run(Args& a) {
2272 const Matrix<T> L = a.matrix<T>(
"L");
2273 const std::vector<int> N = a.ints(
"N");
2274 const std::vector<T> Z = a.vector<T>(
"Z");
2275 a.unsupported(
"lGsrc",
"the injected log G source is a callable, which has no JSON "
2276 "representation; omit it to have pfqn_nc supply log G");
2277 std::vector<std::pair<std::size_t, std::size_t> > pairs;
2278 if (a.has(
"pairs")) {
2279 const Matrix<int>
P = int_matrix(a,
"pairs");
2280 if (!
P.empty() &&
P.cols() != 2)
2281 throw InputError(
"pfqn_qlen_joint_moments: 'pairs' must be a P x 2 matrix of "
2282 "0-based (station, class) indices");
2283 for (std::size_t p = 0; p <
P.rows(); ++p) {
2284 if (
P(p, 0) < 0 ||
P(p, 1) < 0)
2285 throw InputError(
"pfqn_qlen_joint_moments: 'pairs' holds 0-based indices");
2286 pairs.emplace_back(
static_cast<std::size_t
>(
P(p, 0)),
2287 static_cast<std::size_t
>(
P(p, 1)));
2290 const bool lng = all_or_none(a,
"pfqn_qlen_joint_moments", {
"route",
"options"});
2291 pfqn::QlenJointMomentsResult<T> r;
2294 "pfqn_qlen_joint_moments",
"route", a.text(
"route",
""),
2295 {{
"auto", pfqn::QlenJointRoute::Auto},
2296 {
"tail", pfqn::QlenJointRoute::Tail},
2297 {
"pmf", pfqn::QlenJointRoute::Pmf}});
2298 OptObj o(a,
"options",
"pfqn_qlen_joint_moments");
2300 pfqn::NcOptions nopt = nc_options(o,
"pfqn_qlen_joint_moments");
2301 if (o.has(
"tol")) nopt.tol = o.number<
double>(
"tol");
2312 out[
"tail"] = enc_tensor(r.tail);
2313 out[
"binomial"] = enc_tensor(r.binomial);
2314 out[
"factorial"] = enc_tensor(r.factorial);
2315 out[
"raw"] = enc_tensor(r.raw);
2316 out[
"central"] = enc_tensor(r.central);
2317 out[
"cumulant"] = enc_tensor(r.cumulant);
2321 info[
"route"] = r.route;
2325 info[
"exact"] = r.exact;
2326 Json pj = Json::array();
2327 for (
const auto& p : r.pairs)
2328 pj.push_back(Json::array({
static_cast<std::uint64_t
>(p.first),
2329 static_cast<std::uint64_t
>(p.second)}));
2331 info[
"dims"] = enc_idx(r.dims);
2337struct OpResptPsMoments {
2339 static Json run(Args& a) {
2340 const std::vector<T> S = a.vector<T>(
"S");
2341 const std::vector<long> N = longs(a,
"N");
2342 const std::vector<T> Z = a.vector<T>(
"Z");
2343 pfqn::ResptPsMomentsResult<T> r;
2344 if (a.has(
"method")) {
2345 const pfqn::ResptPsRoute m = enum_of<pfqn::ResptPsRoute>(
2346 "pfqn_respt_ps_moments",
"method", a.text(
"method",
""),
2347 {{
"auto", pfqn::ResptPsRoute::Auto},
2348 {
"exact", pfqn::ResptPsRoute::Exact},
2349 {
"asymptotic", pfqn::ResptPsRoute::Asymptotic}});
2351 r = pfqn::pfqn_respt_ps_moments(S, N, Z, m);
2354 r = pfqn::pfqn_respt_ps_moments(S, N, Z);
2357 Json ms = Json::array();
2358 for (pfqn::ResptPsMethod m : r.method) {
2360 case pfqn::ResptPsMethod::None: ms.push_back(
"none");
break;
2361 case pfqn::ResptPsMethod::Exact: ms.push_back(
"exact");
break;
2362 case pfqn::ResptPsMethod::Asymptotic: ms.push_back(
"asymptotic");
break;
2363 case pfqn::ResptPsMethod::Unavailable: ms.push_back(
"unavailable");
break;
2393 static Json run(Args& a) {
2394 const Matrix<T> L = a.matrix<T>(
"L");
2395 const std::vector<int> N = a.ints(
"N");
2396 const std::vector<T> Z = a.vector_or_empty<T>(
"Z");
2397 const std::vector<double> sv = a.vector_or_empty<
double>(
"s");
2398 const Json* oj = a.opt(
"options");
2401 throw InputError(
"pfqn_mcmc: options.seed is required; the port draws from a seeded "
2402 "generator and has no session RNG to fall back on");
2403 Args op(*oj,
"pfqn_mcmc options");
2404 const std::size_t samples = op.count(
"samples", 100000);
2405 std::size_t nbatches = pfqn::MCMC_DEFAULT_BATCHES;
2406 double burnin = pfqn::MCMC_DEFAULT_BURNIN;
2407 if (
const Json* cj = op.opt(
"config")) {
2408 Args cfg(*cj,
"pfqn_mcmc options.config");
2409 nbatches = cfg.count(
"mcmc_batches", nbatches);
2410 burnin = cfg.scalar<
double>(
"mcmc_burnin", burnin);
2413 const std::uint64_t seed =
required_seed(op,
"pfqn_mcmc",
"options.seed");
2415 pfqn::McRng rng(seed);
2416 const pfqn::McmcResult<T> r = pfqn::pfqn_mcmc(L, N, Z, sv, samples, nbatches, burnin, rng);
2442 static Json run(Args& a) {
2443 const Matrix<T> D = a.matrix<T>(
"D");
2444 const std::vector<int> N = a.ints(
"N");
2445 const std::vector<T> Z = a.vector_or_empty<T>(
"Z");
2446 const std::size_t I = a.count(
"I", 100000);
2447 std::string v = a.text(
"variant",
"imci");
2448 for (
char& c : v) c =
static_cast<char>(std::tolower(
static_cast<unsigned char>(c)));
2449 pfqn::MciVariant variant;
2450 if (v ==
"imci") variant = pfqn::MciVariant::Imci;
2451 else if (v ==
"mci") variant = pfqn::MciVariant::Mci;
2452 else if (v ==
"rm") variant = pfqn::MciVariant::Rm;
2453 else if (v ==
"amci") variant = pfqn::MciVariant::Amci;
2454 else if (v ==
"lhsmci") variant = pfqn::MciVariant::Lhsmci;
2455 else throw InputError(
"pfqn_mci: variant must be one of imci, mci, rm, amci, lhsmci; got '" +
2459 const pfqn::NcResult<T> r = pfqn::pfqn_mci(D, N, Z, I, variant, rng);
2470 static Json run(Args& a) {
2471 const Matrix<T> L = a.matrix<T>(
"L");
2472 const std::vector<int> N = a.ints(
"N");
2473 const std::vector<T> Z = a.vector_or_empty<T>(
"Z");
2474 const std::size_t samples = a.count(
"samples", 100000);
2477 const pfqn::NcResult<T> r = pfqn::pfqn_mmsample2(L, N, Z, samples, rng);
2570 const std::string oirate =
2571 "the per-station service rates are callables of the station state "
2572 "(std::function), which have no JSON representation.";
2573 t[
"pfqn_oi_insvc"] =
"the in-service rate oirate is a callable of the station state "
2574 "(std::function), which has no JSON representation.";
2575 t[
"pfqn_mvajd"] = oirate;
2576 t[
"pfqn_mvaoi"] = oirate;
2577 t[
"pfqn_mvaoi_marg"] = oirate;
2578 t[
"pfqn_ncoi"] = oirate;
2579 t[
"pfqn_oi_mixed"] =
"the order-independent rate mu is a callable of the per-class count "
2580 "vector (std::function), which has no JSON representation.";
2581 t[
"pfqn_oi_open"] = t[
"pfqn_oi_mixed"];
2582 t[
"pfqn_oi_respt"] = t[
"pfqn_oi_mixed"];
2583 t[
"pfqn_ncjd"] = oirate;
2584 t[
"pfqn_pas_nc"] = oirate;
2585 t[
"pfqn_oi_is"] =
"the per-station rates are callables (std::function), which have no JSON "
2587 t[
"pfqn_pas_is"] = t[
"pfqn_oi_is"];
Internal to the –api dispatcher: what a per-domain translation unit needs to add entries to the table...
Named-argument reader over the parsed JSON object.
const std::string * get(const Element *el, const std::string &key)
el.get(key), with Python's None as a null pointer.
SqniResult< T > pfqn_sqni(const std::vector< T > &N, const std::vector< T > &L, const std::vector< T > &Z)
Square-root non-iterative (SQNI) approximation for a single queueing station with per-class delay.
RgfmcResult< T > pfqn_rgfmc(const Matrix< T > &L, const std::vector< int > &N, const std::vector< T > &Z, const T &tol, std::size_t maxterms, const T &maxcancel)
Multiclass Recursion by Generating Functions (RGF), with think times.
RdResult< T > pfqn_rd(const Matrix< T > &L0, const std::vector< int > &N, const Matrix< T > &Z, const Matrix< T > &mu0, double tol, NcMethod method)
Reduction heuristic (RD) for the normalizing constant of a closed LOAD-DEPENDENT product-form network...
MvaIntervalResult< T > pfqn_mva_interval(const Matrix< T > &L, int nlo, int nup, const T &zlo, const T &zup)
Exact interval-valued MVA for single-class closed product-form networks.
QlenJointMomentsResult< T > pfqn_qlen_joint_moments(const Matrix< T > &L, const std::vector< int > &N, const std::vector< T > &Z, const std::vector< std::pair< std::size_t, std::size_t > > &pairs, QlenJointRoute route, const QlenJointLgSource< T > &lGsrc, NcMethod method, const NcOptions &nopt)
Joint moments of the queue-length vector of a closed product-form network, obtained from normalizing ...
T pfqn_xia(const std::vector< T > &L, int N, const std::vector< T > &s)
Xia's asymptotic approximation of the normalizing constant of a load-dependent (multiserver) closed n...
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,...
SchmidtExtResult< T > pfqn_schmidt_ext(const Matrix< T > &D, const std::vector< int > &N, const Matrix< int > &S, const std::vector< SchedStrategy > &sched)
Extended Schmidt MVA with queue-aware alpha corrections.
SensResptResult< T > pfqn_sens_respt(const std::vector< T > &S, const Matrix< T > &V, const std::vector< int > &N, const std::vector< T > &Z, const std::vector< int > &b, int tmax)
Exact raw moments E[W^t], t = 1..3, of the sojourn time of a job at an FCFS b-server center of a clos...
LinearizerResult< T > pfqn_scat(const Matrix< T > &L, const std::vector< int > &N, const Matrix< T > &Z, const std::vector< SchedStrategy > &type, double tol, int maxiter, const Matrix< T > &QN0)
Neuse-Chandy SCAT (Self-Correcting Approximation Technique) approximate MVA.
OqnrcResult pfqn_oqnrc(const std::vector< double > &lam, const Matrix< double > &A, const Matrix< double > &S, const Matrix< double > &SCV, const std::vector< double > &nservers, const std::vector< bool > &isps, const std::vector< int > &pool, const std::vector< int > &Ncap, bool waitq, double tol, int iter_max)
Runs OQNRC.
StdfResult< T > pfqn_stdf(const Matrix< T > &L, const std::vector< int > &N, const Matrix< T > &Z, const std::vector< int > &S, const std::vector< std::size_t > &fcfsNodes, const Matrix< T > &rates, const std::vector< T > &tset)
Sojourn-time distribution at the listed FCFS stations.
KrizBounds< T > pfqn_kriz_bounds(const std::vector< T > &Lin, int N, const T &Z, int level=0)
Kriz (1984) throughput bounds.
AmvaResult< T > pfqn_pam(const Matrix< T > &L, const std::vector< T > &N, const std::vector< T > &Z, PamVariant variant=PamVariant::Basic)
Hsieh-Lam Proportional Approximation Methods (PAMB / PAMI / PAMT).
NcldmxResult< T > pfqn_ncldmx(const std::vector< T > &lambda, const Matrix< T > &D, const std::vector< int > &N, const Matrix< T > &Z, const Matrix< T > &mu, const std::string &method, const T &atol, const NcOptions &nopt)
Normalizing constant of a MIXED open/closed network with limited load dependence.
ScbBounds< T > pfqn_scb(const std::vector< T > &L, long N)
Bracket on the throughput and the per-device utilizations of the UNKNOWN multiclass system whose sing...
NcSanitizeResult< T > pfqn_nc_sanitize(const std::vector< T > &lambda, const Matrix< T > &L, const std::vector< int > &N, const Matrix< T > &Z, const T &atol)
Preprocessing shared by the normalizing-constant solvers: drop the classes that cannot contribute,...
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.
SensMvaResult< T > pfqn_sens_mva(const Matrix< T > &L, const std::vector< int > &N, const std::vector< T > &Z, const std::vector< int > &mi)
Exact per-station queue-length variances and covariances of a closed product-form network,...
SensLinearizerResult< T > pfqn_sens_linearizer(const Matrix< T > &L, const std::vector< int > &N, const std::vector< T > &Z, const T *tol, unsigned maxiter)
Approximate moments E[Q_i], Var[Q_i], Cov[Q_i,Q_j], E[Q_i^2] and E[Q_i^3] of the per-station total qu...
long pfqn_minclasses(const T &Usum, long K, long N)
Smallest number of customer classes R consistent with an observed sum of device utilizations,...
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.
UniqueResult< T > pfqn_unique(const Matrix< T > &L, const Matrix< T > &mu, const Matrix< T > &gamma)
Merge stations whose (L, mu, gamma) rows are exactly equal.
McubBounds< T > pfqn_mcub(const Matrix< T > &L, const std::vector< T > &N, const std::vector< T > &Z)
Kerola's multiclass composite bound (Perf.
PropfairResult< T > pfqn_propfair(const Matrix< T > &L, const std::vector< T > &N, const std::vector< T > &Z)
Proportionally fair allocation estimate of the normalizing constant (Schweitzer 1979; Walton,...
NcldResult< T > pfqn_ncld(const Matrix< T > &L, const std::vector< int > &N, const Matrix< T > &Z, const Matrix< T > &mu, const std::string &method_name, const T &atol, const NcOptions &nopt)
Normalizing constant of a LOAD-DEPENDENT closed network: the dispatcher.
std::function< std::vector< double >(const Matrix< T > &, const std::vector< std::vector< int > > &)> QlenJointLgSource
Injected source of log G.
LdsyBounds< T > pfqn_ldsy_bounds(const std::vector< T > &Lin, int N, const T &Zin, const Matrix< T > &muIn)
Shanthikumar-Yao (1988) throughput bounds for queue-dependent rates.
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.
T pfqn_xzabaup(const std::vector< T > &L, const T &N, const T &Z)
X <= min(1/Lmax, N/(sum(L)+Z)): capacity bound and population bound.
NcMethod nc_method_of(const std::string &s)
Map a method name to its enum; throws UnsupportedError on an unknown one.
QlenJointRoute
Which survival-array identity is used.
MvabloResult< T > pfqn_mvablo(long N, const std::vector< T > &S, const Matrix< T > &P, const std::vector< double > &K, std::vector< bool > isdelay, double tol=1e-4, int iter_max=1000)
Runs MVABLO.
T pfqn_xzabalow(const std::vector< T > &L, const T &N, const T &Z)
X >= N / (Z + N sum(L)), the ABA population bound.
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.
StdfResult< T > pfqn_stdf_heur(const Matrix< T > &L, const std::vector< int > &N, const Matrix< T > &Z, const std::vector< int > &S, const std::vector< std::size_t > &fcfsNodes, const Matrix< T > &rates, const std::vector< T > &tset)
Heuristic sojourn-time distribution at the listed FCFS stations.
T pfqn_nre(const Matrix< T > &L0, const std::vector< T > &N, const std::vector< T > &Z, const Matrix< T > &alpha0)
Saddle-tilted Edgeworth approximation of log G for a limited load-dependent model.
MwrbbSched
Station discipline codes, matching the MATLAB sched argument.
AmvaResult< T > pfqn_tay(const Matrix< T > &L, const std::vector< T > &N, const std::vector< T > &Z, double tol=1e-6, std::size_t maxiter=1000, const Matrix< T > &QN0=Matrix< T >())
Tay's arrival-instant approximate MVA.
T pfqn_xzgsbup(const std::vector< T > &L, const T &N, const T &Z)
X = 2N / (R + sqrt(R^2 - 4 Z Lmax N)), R from the geometric queue bound.
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.
DebemvaResult< T > pfqn_debemva(long N, const std::vector< T > &S, const Matrix< T > &P, const std::vector< double > &K, std::vector< bool > isdelay, double tol=0.0, long iter_max=100000)
Runs debeMVA.
QdAmvaResult< T > pfqn_qdamva(const Matrix< T > &L, const std::vector< T > &N, const std::vector< T > &Z, const Matrix< T > &mu, const Matrix< T > &Q0, double tol=1e-6, std::size_t maxiter=10000)
QD-AMVA: queue-dependent approximate mean value analysis.
AmvaResult< T > pfqn_qsa(const Matrix< T > &L, const std::vector< T > &N, const std::vector< T > &Z, const std::vector< AmvaSched > &type, double tol=1e-10, std::size_t maxiter=100, int levels=3)
Queue-Shift Approximation (QSA) for closed product-form networks.
T pfqn_usumbound(long R, long K, long N)
Largest value the sum of device utilizations can take in any closed product-form network with R class...
SibBounds< T > pfqn_sib(const std::vector< T > &L, int N, const T &Z, int level)
Successively Improving Bounds (Srinivasan 1985/1987) on the cycle time and throughput of a single-cla...
SchmidtResult< T > pfqn_schmidt(const Matrix< T > &D, const std::vector< int > &N, const Matrix< int > &S, const std::vector< SchedStrategy > &sched, const Matrix< T > &v)
Schmidt's MVA for closed networks with general scheduling disciplines and class-dependent multiserver...
SdrResult< T > pfqn_sdr(const Matrix< T > &S, const Matrix< T > &xi, const std::vector< std::size_t > &N, const SdrStruct &sdr, const Matrix< T > &alpha=Matrix< T >())
Exact product form of eq.
T pfqn_qzgbup(const std::vector< T > &L, const T &N, const T &Z, std::size_t i)
As the lower bound, with Y from the ABA upper bound and the sigma term.
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.
MmintResult< T > pfqn_mmint2(const std::vector< T > &L, const std::vector< T > &N, const std::vector< T > &Z)
Adaptive form (MATLAB pfqn_mmint2): Gauss-Kronrod on [0, u_hi], u_hi past the mode where log f has fa...
OiFncResult< T > pfqn_oi_fnc(const std::vector< T > &Phi, const std::vector< int > &N, const std::function< T(const std::vector< int > &)> &f)
Order-independent (OI) functional server: the balance function Psi and the rate mu_f of an auxiliary ...
PanaceaResult< T > pfqn_panacea(const Matrix< T > &L, const std::vector< int > &N, const std::vector< T > &Z, int terms)
PANACEA normal-usage asymptotic expansion of the normalizing constant (Ramakrishnan and Mitra,...
T pfqn_scbgap(long N, long K, long r, bool undominated)
Demand-free bound on the relative throughput error incurred when r of the N single-customer classes a...
T pfqn_nrp(const Matrix< T > &L, const std::vector< T > &N, const std::vector< T > &Z, const Matrix< T > &alpha)
Norlund-Rice probit approximation of log G.
RgfResult< T > pfqn_rgf(const std::vector< T > &L, int N, const T &Z)
Recursion by Generating Functions (RGF) for the normalizing constant of a SINGLE-CLASS closed product...
MwrbbBounds< T > pfqn_mwrbb(const Matrix< T > &V, const Matrix< T > &S, const std::vector< T > &N, const std::vector< T > &Z, const std::vector< MwrbbSched > &sched, const std::vector< int > &prio)
Majumdar-Woodside robust box bounds on the per-class throughput of a closed multiclass network with m...
NintMvaResult< T > pfqn_nintmva(const std::vector< T > &L, const T &N, const T &Z)
Mean value analysis at a nonintegral population (fractional-base aMVA).
SensMomResult< T > pfqn_sens_mom(const Matrix< T > &L, const std::vector< int > &N, const std::vector< T > &Z, const std::vector< int > &mi, const std::vector< int > &groups)
Exact moments E[Q], Var[Q], E[Q^2] and E[Q^3] of the grouped queue lengths of a closed product-form n...
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).
PbhBounds< T > pfqn_pbh(const std::vector< T > &L, int N, const T &Z, int level)
Performance Bound Hierarchy (Eager and Sevcik 1983, ACM TOCS 1(2):99-115) for single-class closed pro...
Matrix< T > pfqn_mushift(const Matrix< T > &mu, const std::vector< std::size_t > &iset)
Shift the load-dependent service-rate lattice of selected stations.
NcMethod
The methods this port dispatches, one per compute_norm_const case.
SensLdmxEcResult< T > pfqn_sens_ldmx_ec(const std::vector< T > &lambda, const Matrix< T > &D, const Matrix< T > &mu)
Effective capacity terms of the mixed load-dependent MVA of Bruell-Balbo-Afshari, together with their...
QdLinResult< T > pfqn_qdlin(const Matrix< T > &L, const std::vector< T > &N, const std::vector< T > &Z, const Matrix< T > &mu, const std::vector< double > &nservers, double tol=1e-6, std::size_t maxiter=1000, double wtol=1e-4)
QD-LIN: the Linearizer arm of AMVA-LD, on a plain demand matrix.
SensMvaldmxResult< T > pfqn_sens_mvaldmx(const std::vector< T > &lambda, const Matrix< T > &D, const std::vector< int > &N, const std::vector< T > &Z, const Matrix< T > &mu)
Exact queue-length variances and covariances of a mixed open/closed product-form network with limited...
std::vector< T > pfqn_mu_ms(int N, int m, int c)
Aggregate load-dependent rate of m identical c-server FCFS stations.
PamVariant
Which of the three proportional approximations to run.
T pfqn_nrl(const Matrix< T > &L, const std::vector< T > &N, const std::vector< T > &Z, const Matrix< T > &alpha)
Norlund-Rice logit approximation of log G.
T pfqn_qzgblow(const std::vector< T > &L, const T &N, const T &Z, std::size_t i)
Qgb = y/(1-y) - y^(N+1)/(1-y) with y = N L_i / (Z + sum(L) + Lmax N).
T pfqn_perm(const Matrix< T > &A, const std::vector< int > &m)
Permanent of a matrix with repeated columns, by Ryser's formula.
SensMomResult< T > pfqn_sens_momldmx(const std::vector< T > &lambda, const Matrix< T > &D, const std::vector< int > &N, const std::vector< T > &Z, const Matrix< T > &mu, const std::vector< int > &groups)
Exact moments E[Q], Var[Q], E[Q^2], E[Q^3] and covariances of the grouped queue lengths of a mixed lo...
MomlinResult< T > pfqn_momlin(const Matrix< T > &L, const std::vector< int > &N, const std::vector< T > &Z, const T &tol, int maxiter)
Moment linearizer: approximate first and second queue-length moments of a large closed product-form n...
SensResult< T > pfqn_sens(const Matrix< T > &L, const std::vector< int > &N, const std::vector< T > &Z, const std::vector< int > &mi)
Exact analytic derivatives of the mean performance measures {X,Q,U,R} of a closed product-form (BCMP)...
IbjbBounds< T > pfqn_ibjb_bounds(const std::vector< T > &Lin, int N, const T &Z)
Dallery (1987) improved balanced job bounds.
T pfqn_xzgsblow(const std::vector< T > &L, const T &N, const T &Z)
X = 2N / (R + sqrt(R^2 - 4 Z Lmax (N-1))), R from the geometric queue bound.
MvacldResult< T > pfqn_mvacld(const Matrix< T > &L, const std::vector< int > &N, const Matrix< T > &Z, const Matrix< T > &mu)
MVAC for networks with queue-length dependent (QLD) service centers, the Section V extension of Conwa...
NcDispatchResult< T > pfqn_nc(const std::vector< T > &lambda, const Matrix< T > &L, const std::vector< int > &N, const Matrix< T > &Z, NcMethod method, const T &atol, const NcOptions &nopt)
Normalizing constant of a product-form queueing network: the dispatcher.
MvacResult< T > pfqn_mvac(const Matrix< T > &L, const std::vector< int > &N, const Matrix< T > &Z)
MVAC: exact mean value analysis BY CHAIN of a closed multichain product-form network (Conway,...
PfqnManjunathResult< T > pfqn_manjunath(const Matrix< T > &L, const std::vector< int > &N, const Matrix< T > &Z, const Matrix< T > &A, const std::vector< long > &b, const std::string &sense, const PfqnManjunathOptions &options={})
Exact normalizing constant of a closed multiclass product-form network whose state space carries arbi...
SsdBounds< T > pfqn_ssd(const std::vector< T > &L, const T &N, const T &Z, const std::vector< T > &nservers)
Server-Station Disaggregation bounds for a multiserver closed network (Dallery and Suri,...
void push(EventOutcome< T > &out, const std::vector< T > &row, const T &rate, const T &prob, const std::vector< std::size_t > &start, const std::vector< std::size_t > &preempt)
Append one successor with its tags.
std::uint64_t required_seed(Args &a, const std::string &fn, const char *spelled="seed")
The seed of a function whose port draws from a caller-owned generator.
Json encode_vectors(const std::vector< std::vector< T > > &v)
A list of vectors, the shape a per-class or per-segment result returns.
Matrix< T > matrix_from_json(const Json &j, const std::string &where)
A matrix from a JSON value: 2-D array as rows, 1-D array as a row vector, scalar as 1x1,...
std::vector< int > int_vector_from_json(const Json &j, const std::string &where)
An integer vector; a non-integral entry is an error, never a truncation.
Json encode_matrices(const std::vector< Matrix< T > > &v)
A list of matrices, the shape the MMAP/BMAP families return as {D0,D1,...}.
T number_from_json(const Json &j, const std::string &where)
std::vector< T > vector_from_json(const Json &j, const std::string &where)
A flat numeric vector: 1-D array, or a 1-row / 1-column 2-D array.
Json encode_vector(const std::vector< T > &v)
Json encode_matrix(const Matrix< T > &m)
void register_library_only_pfqn_b(LibraryOnlyTable &t)
Json encode_scalar(const T &v)
Json encode_count(std::size_t n)
A count.
void register_api_pfqn_b(DispatchTable &t)
std::map< std::string, std::string > LibraryOnlyTable
name -> why the function has no named-JSON-argument form.
Json encode_ints(const std::vector< int > &v)
std::map< std::string, Invoker > DispatchTable
Conservation laws of a layered queueing network, enumerated from its structure.
debeMVA: MVA-based approximation of closed networks with finite (BAS) buffers.
Dallery (1987) improved balanced job bounds for single-class closed networks of single-server station...
Kriz (1984) closed-form throughput bounds for single-class closed networks of single-server stations ...
Shanthikumar-Yao (1988) throughput bounds for single-class closed networks with arbitrary queue-depen...
Exact normalizing constant of a closed multiclass product-form network whose state space carries arbi...
Marie's iterative aggregation-decomposition for closed networks with FCFS general (Coxian) service.
Monte Carlo Integration estimate of the normalizing constant of a closed product-form network (Ross,...
Chen-O'Cinneide REGULARIZATION: a Markov chain Monte Carlo estimator of the class throughputs X(r) = ...
Kerola's multiclass composite bound (Perf.
McKenna-Mitra integral form of the normalizing constant of a repairman model (one queueing station,...
Sampled McKenna-Mitra integral form of the normalizing constant of a repairman (single-queue plus del...
Moment linearizer: approximate first and second queue-length moments of a large closed product-form n...
Aggregate load-dependent rate of m identical c-server FCFS stations.
Shift the load-dependent service-rate lattice of selected stations.
Exact interval-valued MVA for single-class closed product-form networks.
MVABLO: approximate MVA for closed networks with Blocking-After-Service (BAS).
MVAC: exact mean value analysis BY CHAIN of a closed multichain product-form network (Conway,...
MVAC for networks with queue-length dependent (QLD) service centers, the Section V extension of Conwa...
Exact Mean Value Analysis for mixed open/closed networks with multiserver stations.
Memory-bounded exact MVA for closed networks with multiserver stations.
Majumdar-Woodside robust box bounds on the per-class throughput of a closed multiclass network with m...
Normalizing constant of a product-form queueing network: the dispatcher.
Preprocessing shared by the normalizing-constant solvers: drop the classes that cannot contribute,...
Normalizing constant of a LOAD-DEPENDENT closed network: the dispatcher.
Normalizing constant of a MIXED open/closed network with limited load dependence.
Mean value analysis at a nonintegral population (fractional-base aMVA).
Norlund-Rice inversion of the normalizing constant on a SADDLE-TILTED contour, with a second-order Ed...
Norlund-Rice inversion of the normalizing constant, in its logistic (NRL) and probit (NRP) substituti...
Order-independent (OI) functional server: the balance function Psi and the rate mu_f of an auxiliary ...
OQNRC: approximate MVA for open queueing networks with restricted capacity.
Hsieh-Lam Proportional Approximation Methods (PAMB / PAMI / PAMT).
PANACEA normal-usage asymptotic expansion of the normalizing constant (Ramakrishnan and Mitra,...
PANACEA normal-usage asymptotic expansion for LOAD-DEPENDENT closed networks (Mitra and McKenna,...
Performance Bound Hierarchy (Eager and Sevcik 1983, ACM TOCS 1(2):99-115) for single-class closed pro...
Permanent of a matrix with repeated columns, by Ryser's formula.
Proportionally fair allocation estimate of the normalizing constant (Schweitzer 1979; Walton,...
QD-AMVA: queue-dependent approximate mean value analysis.
QD-LIN: the Linearizer arm of AMVA-LD, on a plain demand matrix.
Joint moments of the queue-length vector of a closed product-form network, obtained from normalizing ...
Queue-Shift Approximation (QSA) for closed product-form networks.
Geometric-bound lower bound on the queue length at station i.
Geometric-bound upper bound on the queue length at station i.
Reduction heuristic (RD) for the normalizing constant of a closed LOAD-DEPENDENT product-form network...
Sojourn-time moments at the processor-sharing station of a closed terminal-driven system (Mitra and M...
Recursion by Generating Functions (RGF) for the normalizing constant of a SINGLE-CLASS closed product...
Multiclass Recursion by Generating Functions (RGF), with think times.
Neuse-Chandy SCAT (Self-Correcting Approximation Technique) approximate MVA.
Dowdy-Carlson-Krantz-Tripathi (1992) single-class bounds of multi-class queueing networks,...
Schmidt's MVA for closed networks with general scheduling disciplines and class-dependent multiserver...
Extended Schmidt MVA with queue-aware alpha corrections.
Product-form state-dependent routing.
Exact analytic derivatives of the mean performance measures {X,Q,U,R} of a closed product-form (BCMP)...
Effective capacity terms of the mixed load-dependent MVA of Bruell-Balbo-Afshari, together with their...
Approximate moments E[Q_i], Var[Q_i], Cov[Q_i,Q_j], E[Q_i^2] and E[Q_i^3] of the per-station total qu...
Exact moments E[Q], Var[Q], E[Q^2] and E[Q^3] of the grouped queue lengths of a closed product-form n...
Exact higher queue-length moments (up to order three) of mixed open/closed product-form networks with...
Exact per-station queue-length variances and covariances of a closed product-form network,...
Exact queue-length variances and covariances of a mixed open/closed product-form network with limited...
Exact raw moments E[W^t], t = 1..3, of the sojourn time of a job at an FCFS b-server center of a clos...
Successively Improving Bounds (Srinivasan 1985/1987) on the cycle time and throughput of a single-cla...
Square-root non-iterative (SQNI) approximation for a single queueing station with per-class delay.
Server-Station Disaggregation bounds for a multiserver closed network (Dallery and Suri,...
Sojourn-time distribution at multiserver FCFS stations of a closed product-form network (J.
Heuristic sojourn-time distribution at multiserver FCFS stations, a variant of J.
Tay's arrival-instant approximate MVA.
Station consolidation and its inverse: merge identical demand rows into one station with a multiplici...
Xia's asymptotic approximation of the normalizing constant of a load-dependent (multiserver) closed n...
Asymptotic-bound-analysis lower bound on throughput.
Asymptotic-bound-analysis upper bound on throughput.
Geometric-square-root bound, lower bound on throughput.
Geometric-square-root bound, upper bound on throughput.