80 const std::string& jobclass)
const {
81 for (std::size_t i = 0; i <
Station.size(); ++i) {
83 if (col ==
"QLen")
return QLen[i];
84 if (col ==
"Util")
return Util[i];
85 if (col ==
"RespT")
return RespT[i];
86 if (col ==
"ResidT")
return ResidT[i];
87 if (col ==
"ArvR")
return ArvR[i];
88 if (col ==
"Tput")
return Tput[i];
89 const std::vector<double>& ci =
column(col);
90 return i < ci.size() ? ci[i] : std::numeric_limits<double>::quiet_NaN();
92 return std::numeric_limits<double>::quiet_NaN();
96 if (col ==
"QLen")
return QLen;
97 if (col ==
"Util")
return Util;
98 if (col ==
"RespT")
return RespT;
99 if (col ==
"ResidT")
return ResidT;
100 if (col ==
"ArvR")
return ArvR;
101 if (col ==
"Tput")
return Tput;
102 if (col ==
"QLenCI")
return QLenCI;
103 if (col ==
"UtilCI")
return UtilCI;
104 if (col ==
"RespTCI")
return RespTCI;
105 if (col ==
"ResidTCI")
return ResidTCI;
106 if (col ==
"ArvRCI")
return ArvRCI;
107 if (col ==
"TputCI")
return TputCI;
108 throw InputError(
"AvgTable::column: unknown column '" + col +
"'");
126 for (std::size_t i = 0; i < source.
Station.size(); ++i) {
127 if (!keep(i))
continue;
136 if (!source.
has_ci())
continue;
150 return filter_avg_table(*
this, [&](std::size_t i) {
156 return filter_avg_table(*
this, [&](std::size_t i) {
162 return filter_avg_table(*
this, [&](std::size_t i) {
168 return filter_avg_table(*
this, [&](std::size_t i) {
169 return JobClass[i] == jobclass.get_name();
209 const std::ios::fmtflags flags = out.flags();
210 const std::streamsize precision = out.precision();
213 const auto cell = [](
double m,
double h) {
214 std::ostringstream c;
215 c << std::setprecision(6) << m <<
" +- " << std::setprecision(3) << h;
218 out << std::left << std::setw(16) <<
"Station" << std::setw(14) <<
"JobClass" << std::right;
219 for (
const char* h : {
"QLen",
"Util",
"RespT",
"ResidT",
"ArvR",
"Tput"}) out << std::setw(22) << h;
221 for (std::size_t i = 0; i <
Station.size(); ++i)
222 out << std::left << std::setw(16) <<
Station[i] << std::setw(14) <<
JobClass[i]
223 << std::right << std::setw(22) << cell(
QLen[i],
QLenCI[i])
226 << std::setw(22) << cell(
Tput[i],
TputCI[i]) <<
'\n';
230 out << std::left << std::setw(16) <<
"Station" << std::setw(14) <<
"JobClass"
231 << std::right << std::setw(12) <<
"QLen" << std::setw(12) <<
"Util"
232 << std::setw(12) <<
"RespT" << std::setw(12) <<
"ResidT"
233 << std::setw(12) <<
"ArvR" << std::setw(12) <<
"Tput" <<
'\n';
234 out << std::setprecision(6);
235 for (std::size_t i = 0; i <
Station.size(); ++i)
236 out << std::left << std::setw(16) <<
Station[i] << std::setw(14) <<
JobClass[i]
237 << std::right << std::setw(12) <<
QLen[i] << std::setw(12) <<
Util[i]
238 << std::setw(12) <<
RespT[i] << std::setw(12) <<
ResidT[i]
239 << std::setw(12) <<
ArvR[i] << std::setw(12) <<
Tput[i] <<
'\n';
241 out.precision(precision);
252 const std::ios::fmtflags flags = out.flags();
253 const std::streamsize precision = out.precision();
255 for (
const std::string& s :
JobClasses) w = std::max(w, s.size() + 2);
256 out << std::left << std::setw(10) <<
"Chain" << std::setw(
int(w)) <<
"JobClasses" << std::right
257 << std::setw(12) <<
"SysRespT" << std::setw(12) <<
"SysTput" <<
'\n';
258 out << std::setprecision(6);
259 for (std::size_t c = 0; c <
Chain.size(); ++c)
260 out << std::left << std::setw(10) <<
Chain[c] << std::setw(
int(w)) <<
JobClasses[c] << std::right
261 << std::setw(12) <<
SysRespT[c] << std::setw(12) <<
SysTput[c] <<
'\n';
263 out.precision(precision);
274 const std::ios::fmtflags flags = out.flags();
275 const std::streamsize precision = out.precision();
276 std::size_t
ws = 10, wj = 12;
277 for (std::size_t i = 0; i <
Station.size(); ++i) {
281 out << std::left << std::setw(
int(
ws)) <<
"Station" << std::setw(10) <<
"Chain" << std::setw(
int(wj))
282 <<
"JobClasses" << std::right;
283 for (
const char* c : {
"QLen",
"Util",
"RespT",
"ResidT",
"ArvR",
"Tput"}) out << std::setw(12) << c;
284 out <<
'\n' << std::setprecision(6);
285 for (std::size_t i = 0; i <
Station.size(); ++i)
286 out << std::left << std::setw(
int(
ws)) <<
Station[i] << std::setw(10) <<
Chain[i] << std::setw(
int(wj))
287 <<
JobClasses[i] << std::right << std::setw(12) <<
QLen[i] << std::setw(12) <<
Util[i]
288 << std::setw(12) <<
RespT[i] << std::setw(12) <<
ResidT[i] << std::setw(12) <<
ArvR[i]
289 << std::setw(12) <<
Tput[i] <<
'\n';
291 out.precision(precision);
302 const std::ios::fmtflags flags = out.flags();
303 const std::streamsize precision = out.precision();
304 std::size_t
wf = 6, wj = 6, wc = 10;
305 for (std::size_t i = 0; i <
Fork.size(); ++i) {
307 wj = std::max(wj,
Join[i].
size() + 2);
310 out << std::left << std::setw(
int(
wf)) <<
"Fork" << std::setw(
int(wj)) <<
"Join" << std::setw(
int(wc))
311 <<
"JobClass" << std::right << std::setw(14) <<
"FJQLen" << std::setw(14) <<
"FJRespT" << std::setw(14)
313 out << std::setprecision(6);
314 for (std::size_t i = 0; i <
Fork.size(); ++i)
315 out << std::left << std::setw(
int(
wf)) <<
Fork[i] << std::setw(
int(wj)) <<
Join[i] << std::setw(
int(wc))
317 << std::setw(14) <<
FJTput[i] <<
'\n';
319 out.precision(precision);
330 const std::ios::fmtflags flags = out.flags();
331 const std::streamsize precision = out.precision();
332 std::size_t wl = 6, wc = 10;
333 for (std::size_t i = 0; i <
Link.size(); ++i) {
334 wl = std::max(wl,
Link[i].
size() + 2);
337 out << std::left << std::setw(
int(wl)) <<
"Link" << std::setw(
int(wc)) <<
"JobClass" << std::right
338 << std::setw(14) <<
"Capacity" << std::setw(14) <<
"Demand" << std::setw(14) <<
"Occupancy"
339 << std::setw(14) <<
"LinkBlocking" << std::setw(14) <<
"RouteLoss" <<
'\n';
340 out << std::setprecision(6);
341 for (std::size_t i = 0; i <
Link.size(); ++i)
342 out << std::left << std::setw(
int(wl)) <<
Link[i] << std::setw(
int(wc)) <<
JobClass[i] << std::right
346 out.precision(precision);
359void fill_table(AvgTable& t,
const qn::NetworkStruct<double>& sn,
const mva::AvgResult<double>& r) {
360 for (std::size_t i = 0; i < sn.nstations; ++i)
361 for (std::size_t c = 0; c < sn.nclasses; ++c) {
362 const double q = r.QN(i, c), u = r.UN(i, c), rt = r.RN(i, c);
363 const double w = r.WN(i, c), a = r.AN(i, c), x = r.TN(i, c);
364 if (q == 0.0 && u == 0.0 && rt == 0.0 && w == 0.0 && a == 0.0 && x == 0.0)
continue;
365 t.Station.push_back(sn.stations[i].name);
366 t.JobClass.push_back(sn.classes[c].name);
369 t.RespT.push_back(rt);
370 t.ResidT.push_back(w);
374 for (std::size_t c = 0; c <
sn.nclasses && c < r.CN.size(); ++c) {
375 t.SysClass.push_back(
sn.classes[c].name);
376 t.SysRespT.push_back(r.CN[c]);
377 t.SysTput.push_back(c < r.XN.size() ? r.XN[c] : 0.0);
380 t.warning = r.warning;
381 t.ListCost = r.listcost;
382 if (r.lognormconst.has_value()) {
383 t.has_lognormconst =
true;
384 t.lognormconst = r.lognormconst.value();
402 const std::size_t M =
sn.nstations, K =
sn.nclasses;
404 for (std::size_t i = 0; i < M; ++i)
405 for (std::size_t c = 0; c < K; ++c) {
406 RN(i, c) = r.RN(i, c);
407 TN(i, c) = r.TN(i, c);
411 for (std::size_t i = 0; i < M; ++i)
412 for (std::size_t c = 0; c < K; ++c) {
413 const double q = r.QN(i, c), u = r.UN(i, c), rt = r.RN(i, c), x = r.TN(i, c);
415 const double w = WN(i, c), a = is_source ? 0.0 : AN(i, c);
418 if (q == 0.0 && u == 0.0 && rt == 0.0 && w == 0.0 && a == 0.0 && x == 0.0)
continue;
419 t.Station.push_back(
sn.stations[i].name);
420 t.JobClass.push_back(
sn.classes[c].name);
423 t.RespT.push_back(rt);
424 t.ResidT.push_back(w);
428 for (std::size_t c = 0; c <
sn.nclasses && c < r.CN.size(); ++c) {
429 t.SysClass.push_back(
sn.classes[c].name);
430 t.SysRespT.push_back(r.CN[c]);
431 t.SysTput.push_back(c < r.XN.size() ? r.XN[c] : 0.0);
448 for (std::size_t i = 0; i <
sn.nstations; ++i)
449 for (std::size_t c = 0; c <
sn.nclasses; ++c) {
450 const double q = r.QN(i, c), u = r.UN(i, c), rt = r.RN(i, c);
451 const double w = WNfix(i, c), a = r.AN(i, c), x = r.TN(i, c);
452 if (q == 0.0 && u == 0.0 && rt == 0.0 && w == 0.0 && a == 0.0 && x == 0.0)
continue;
453 t.Station.push_back(
sn.stations[i].name);
454 t.JobClass.push_back(
sn.classes[c].name);
457 t.RespT.push_back(rt);
458 t.ResidT.push_back(w);
462 for (std::size_t c = 0; c <
sn.nclasses && c < r.CN.cols(); ++c) {
463 t.SysClass.push_back(
sn.classes[c].name);
464 t.SysRespT.push_back(r.CN(0, c));
465 t.SysTput.push_back(c < r.XN.cols() ? r.XN(0, c) : 0.0);
481 const auto at = [](
const Matrix<double>& m, std::size_t i, std::size_t c) {
482 return i < m.rows() && c < m.cols() ? m(i, c) : 0.0;
484 for (std::size_t i = 0; i <
sn.nstations; ++i)
485 for (std::size_t c = 0; c <
sn.nclasses; ++c) {
486 const double q =
QN(i, c), u =
UN(i, c), rt = RN(i, c), w = WN(i, c), a = AN(i, c), x = TN(i, c);
487 if (q == 0.0 && u == 0.0 && rt == 0.0 && w == 0.0 && a == 0.0 && x == 0.0)
continue;
488 t.QLenCI.push_back(at(QCI, i, c));
489 t.UtilCI.push_back(at(UCI, i, c));
490 t.RespTCI.push_back(at(RCI, i, c));
491 t.ResidTCI.push_back(rt > 0.0 ? at(RCI, i, c) * w / rt : 0.0);
492 t.ArvRCI.push_back(at(ACI, i, c));
493 t.TputCI.push_back(at(TCI, i, c));
507 if (!o.map_env.empty()) c.
mode = o.map_env;
508 if (!o.map_env_method.empty()) c.method = o.map_env_method;
509 if (o.map_env_maxstages) c.max_stages = o.map_env_maxstages;
515 if (!o.method.empty()) c.
method = o.method;
516 if (o.cutoff > 0.0) c.cutoff = o.cutoff;
517 if (!o.cutoff_vec.empty()) c.cutoff_vec = o.cutoff_vec;
518 if (o.state_max) c.state_max = o.state_max;
519 if (o.timestep > 0.0) c.timestep = o.timestep;
532 if (!o.symbolic.empty()) s.
backend = o.symbolic;
533 if (o.symbolic_timeout > 0) s.timeout_s = o.symbolic_timeout;
539 if (!o.method.empty()) f.
method = o.method;
540 if (o.tol >= 0.0) f.tol = o.tol;
541 if (o.iter_tol >= 0.0) f.iter_tol = o.iter_tol;
542 if (o.iter_max >= 0) f.iter_max =
static_cast<std::size_t
>(o.iter_max);
543 if (o.timespan_end > 0.0) f.timespan_end = o.timespan_end;
544 if (!o.init_sol.empty()) f.init_sol = o.init_sol;
545 if (o.seed) f.seed = o.seed;
546 if (!o.highvar.empty()) f.highvar = o.highvar;
547 if (o.timestep > 0.0) f.timestep = o.timestep;
561 if (!o.method.empty()) j.
method = o.method;
562 if (o.samples) j.samples =
static_cast<double>(o.samples);
563 if (o.seed) j.seed =
static_cast<long>(o.seed);
564 if (o.replications > 0) j.replications = o.replications;
565 if (o.timespan_end > 0.0) j.max_simulated_time = o.timespan_end;
566 j.confint = o.confint;
568 j.verbose = o.verbose;
575 if (!o.method.empty())
opt.method = o.method;
576 if (o.samples)
opt.samples = o.samples;
577 if (o.events)
opt.events = o.events;
578 if (o.seed)
opt.seed =
static_cast<long>(o.seed);
579 if (o.timeout > 0.0)
opt.timeout = o.timeout;
582 if (o.replications > 1)
opt.replications = o.replications;
583 if (o.confint > 0.0)
opt.confint = o.confint;
584 if (!o.cimethod.empty())
opt.cimethod = o.cimethod;
585 if (o.ciminbatch >= 0)
opt.ciminbatch = o.ciminbatch;
586 if (o.ciminobs >= 0)
opt.ciminobs = o.ciminobs;
587 if (o.obmoverlap >= 0.0)
opt.obmoverlap = o.obmoverlap;
588 if (o.spectral_low_freq_frac > 0.0)
opt.spectral_low_freq_frac = o.spectral_low_freq_frac;
589 if (!o.tranfilter.empty())
opt.tranfilter = o.tranfilter;
590 if (o.mserbatch > 0)
opt.mserbatch = o.mserbatch;
591 if (o.warmupfrac >= 0.0)
opt.warmupfrac = o.warmupfrac;
592 opt.cnvgon = o.cnvgon;
593 if (o.cnvgtol > 0.0)
opt.cnvgtol = o.cnvgtol;
594 if (o.cnvgbatch > 0)
opt.cnvgbatch = o.cnvgbatch;
595 if (o.cnvgchk >= 0)
opt.cnvgchk = o.cnvgchk;
596 if (!o.init_sol.empty())
opt.init_sol = o.init_sol;
597 if (o.init_jobs.rows() > 0)
opt.init_jobs = o.init_jobs;
598 opt.track_jobs = o.track_jobs;
599 opt.verbose = o.verbose;
609std::string facade_name_of_family(
const std::string& fam) {
610 if (fam ==
"mva" || fam ==
"nc" || fam ==
"ctmc" || fam ==
"mam" || fam ==
"ag" ||
611 fam ==
"ba" || fam ==
"ssa" || fam ==
"jmt" || fam ==
"lqns") {
612 std::string up = fam;
613 std::transform(up.begin(), up.end(), up.begin(), ::toupper);
616 if (fam ==
"fld")
return "FLD";
620 "SolverAUTO: method family 'ldes' names the discrete-event engine, and none was "
621 "found (common/ldes or common/ldes.jar, or $LINE_LDES_DIR); 'ssa' is the simulator "
622 "this port builds in process");
627 "SolverAUTO: method family 'ln' names the layered solver, which takes a "
628 "LayeredNetwork rather than a Network");
631 "SolverAUTO: method family 'env' names the random-environment solver, which takes an "
632 "Environment rather than a Network");
635 "SolverAUTO: method family 'uq' names the uncertainty-quantification solver, which "
636 "this facade does not wrap");
637 throw InputError(
"SolverAUTO: no engine stands behind method family '" + fam +
"'");
642 std::vector<double> v;
644 for (std::size_t c = 0; c < m.cols(); ++c) v.push_back(m(0, c));
657 const std::map<std::size_t, std::vector<double> >& hit) {
659 for (std::size_t c = 0; c < out.caches.size(); ++c) {
661 const std::map<std::size_t, std::vector<double> >::const_iterator it = hit.find(m.node);
662 if (it == hit.end())
continue;
664 for (std::size_t r = 0; r < m.hitprob.size(); ++r) m.missprob.push_back(1.0 - m.hitprob[r]);
672 const std::map<std::string, ldes::LdesCacheMetrics>& cm) {
674 for (std::size_t c = 0; c < out.caches.size(); ++c) {
676 const std::map<std::string, ldes::LdesCacheMetrics>::const_iterator it = cm.find(m.name);
677 if (it == cm.end())
continue;
678 m.hitprob = row_of(it->second.hit);
679 m.missprob = row_of(it->second.miss);
680 m.delayedprob = row_of(it->second.delayed);
681 m.latency = row_of(it->second.latency);
682 m.hitproblist = it->second.hitList;
683 m.itemprob = it->second.itemProb;
684 m.listcost = row_of(it->second.listCost);
694void solve_named(
const std::string& name,
const SolverOptions& o,
702 if (o.confint < 0.0 || o.confint >= 1.0)
703 throw InputError(
"SolverOptions: confint must be a confidence level in (0,1), or 0 to disable; got " +
704 std::to_string(o.confint));
707 if (!o.method.empty())
opt.method = o.method;
708 if (o.tol >= 0.0)
opt.tol = o.tol;
709 if (o.iter_tol >= 0.0)
opt.iter_tol = o.iter_tol;
710 if (o.iter_max >= 0)
opt.iter_max = o.iter_max;
711 if (!o.multiserver.empty())
opt.multiserver = o.multiserver;
712 if (!o.highvar.empty())
opt.highvar = o.highvar;
713 if (!o.np_priority.empty())
opt.np_priority = o.np_priority;
714 if (!o.fork_join.empty())
opt.fork_join = o.fork_join;
723 t.
method = r.actualmethod;
724 fill_table(t,
sn, r);
727 }
else if (name ==
"NC") {
729 if (!o.method.empty())
opt.method = o.method;
730 if (o.tol >= 0.0)
opt.tol = o.tol;
731 if (o.iter_tol >= 0.0)
opt.iter_tol = o.iter_tol;
732 if (o.iter_max >= 0)
opt.iter_max = o.iter_max;
733 if (!o.highvar.empty())
opt.highvar = o.highvar;
734 if (!o.multiserver.empty())
opt.multiserver = o.multiserver;
735 if (!o.fork_join.empty())
opt.fork_join = o.fork_join;
736 if (o.samples)
opt.samples = o.samples;
737 if (o.seed)
opt.seed = o.seed;
742 t.
method = r.actualmethod;
743 fill_table(t,
sn, r);
747 }
else if (name ==
"CTMC") {
753 t.method = r.actualmethod;
754 fill_table(t,
sn, r);
756 }
else if (name ==
"MAM") {
758 if (!o.method.empty())
opt.method = o.method;
759 if (o.tol >= 0.0)
opt.tol = o.tol;
760 if (o.iter_max >= 0)
opt.iter_max = o.iter_max;
762 t.method = r.actualmethod;
763 fill_table(t,
sn, r);
765 }
else if (name ==
"BA") {
773 if (!o.method.empty())
opt.method = o.method;
776 t.method = r.actualmethod;
777 fill_table(t,
sn, r);
779 }
else if (name ==
"SSA") {
781 if (!o.method.empty())
opt.method = o.method;
782 if (o.samples)
opt.samples = o.samples;
783 if (o.events)
opt.samples = o.events;
784 if (o.seed)
opt.seed = o.seed;
785 if (o.cutoff > 0.0)
opt.cutoff = o.cutoff;
786 if (o.warmupfrac >= 0.0)
opt.warmupfrac = o.warmupfrac;
787 if (o.timestep > 0.0)
opt.timestep = o.timestep;
788 if (!o.state_space_gen.empty())
opt.state_space_gen = o.state_space_gen;
789 opt.verbose = o.verbose;
793 std::vector<ssa::SsaCacheRatio> cacheratio;
798 }
else if (name ==
"FLD" || name ==
"FLUID") {
810 t.method = r.actualmethod;
811 fill_table(t,
sn, r);
821 t.iter =
static_cast<int>(r.iters);
822 t.warning = r.warning;
824 const bool has_ref = refreshed.nstations ==
sn.nstations && refreshed.nclasses ==
sn.nclasses;
825 fill_table_sim(t, has_ref ? refreshed :
sn, r);
827 }
else if (name ==
"JMT") {
830 t.method = r.avg.actualmethod;
831 fill_table(t,
sn, r.avg);
832 cache = r.cache_hit_prob.empty() ? r.avg.cache : cache_metrics_of_jmt(
sn, r.cache_hit_prob);
833 if (
fj) *
fj = r.avg.fj;
834 if (o.confint > 0.0 && !r.QCI.empty())
835 fill_table_ci(t,
sn, r.avg.QN, r.avg.UN, r.avg.RN, r.avg.WN, r.avg.AN, r.avg.TN, r.QCI,
836 r.UCI, r.RCI, r.ACI, r.TCI);
837 }
else if (name ==
"LDES") {
840 t.method =
opt.method;
841 fill_table_ldes(t,
sn, r);
842 cache = cache_metrics_of_ldes(
sn, r.cache_metrics);
844 if (o.confint > 0.0 && !r.QNCI.empty())
846 r.TN, r.QNCI, r.UNCI, r.RNCI, r.ANCI, r.TNCI);
847 }
else if (name ==
"AG") {
849 if (!o.method.empty() && o.method !=
"default")
opt.method = o.method;
850 if (o.tol >= 0.0)
opt.tol = o.tol;
851 if (o.iter_max >= 0)
opt.iter_max = o.iter_max;
853 t.method = r.actualmethod;
854 fill_table(t,
sn, r);
856 }
else if (name ==
"LQNS") {
859 if (!o.method.empty())
opt.method = o.method;
860 if (!o.multiserver.empty())
opt.multiserver = o.multiserver;
863 t.method = r.actualmethod;
864 fill_table(t,
sn, r);
884 if (!tok.is_intent) {
885 oo.method = tok.submethod;
886 solve_named(facade_name_of_family(tok.family), oo,
sn, t,
cache,
fj);
890 const std::vector<autosolver::AutoSolver> order =
892 std::string first_error, first_category, first_kind;
893 for (std::size_t i = 0; i < order.size(); ++i) {
895 std::transform(
name.begin(),
name.end(),
name.begin(), ::toupper);
896 if (name ==
"FLUID")
name =
"FLD";
897 oo.method = (i == 0 && !c.method.empty()) ? c.method : std::string(
"default");
902 solve_named(name, oo,
sn, attempt, attempt_cache, &attempt_fj);
904 cache = attempt_cache;
905 if (
fj) *
fj = attempt_fj;
907 }
catch (
const Error& e) {
908 const std::string cat = e.category();
909 if (cat ==
"input" || cat ==
"internal")
throw;
913 if (cat ==
"numerical" && e.kind() ==
"Timeout")
throw;
914 if (first_error.empty()) {
915 first_error =
name +
": " + e.what();
916 first_category = cat;
917 first_kind = e.kind();
919 }
catch (
const std::exception& e) {
920 if (first_error.empty()) first_error =
name +
": " + e.what();
923 const std::string all_failed =
924 "SolverAUTO: every candidate refused this run. The chosen engine reported -- " + first_error;
932void solve_zero_capacity(
const std::string& name,
const SolverOptions& o,
949 for (
const auto& st :
sn.stations)
950 for (
const auto& row : st.switchover_pair)
952 return !d.disabled && d.type != lang::ProcessType::IMMEDIATE;
954 std::cerr <<
"[LINE] Warning: Station " << st.name <<
" declares class-to-class switchover "
955 <<
"times, which no LINE solver simulates at a non-polling queue: every solver "
956 <<
"answers as if they were zero. Only POLLING switchovers are solved." << std::endl;
977 else if (
name_ ==
"AUTO")
1002 const std::size_t M =
sn.nstations, K =
sn.nclasses;
1010 for (std::size_t row = 0; row < t.
size(); ++row)
1011 for (std::size_t i = 0; i < M; ++i) {
1012 if (
sn.stations[i].name != t.
Station[row])
continue;
1013 for (std::size_t c = 0; c < K; ++c) {
1014 if (
sn.classes[c].name != t.
JobClass[row])
continue;
1015 r.
QN(i, c) = t.
QLen[row];
1016 r.
UN(i, c) = t.
Util[row];
1018 r.
TN(i, c) = t.
Tput[row];
1019 r.
AN(i, c) = t.
ArvR[row];
1041void solve_zero_capacity(
const std::string& name,
const SolverOptions& o,
1045 const std::size_t M =
sn.nstations, K =
sn.nclasses;
1046 const double inf = std::numeric_limits<double>::infinity();
1047 std::vector<bool> trappedcls(K,
false);
1048 std::size_t ntrapped = 0;
1049 for (std::size_t c = 0; c <
sn.nchains; ++c)
1050 if (zc.deadstat[c] > 0)
1051 for (std::size_t r = 0; r < K; ++r)
1052 if (
sn.chains[c][r] && !trappedcls[r]) {
1053 trappedcls[r] =
true;
1058 if (ntrapped == K) {
1065 solved.solver =
name;
1066 solved.method = o.method.empty() ? std::string(
"default") : o.method;
1071 for (std::size_t k = 0; k < K; ++k)
1072 if (trappedcls[k]) reduced.classes[k].population = 0.0;
1073 for (std::size_t c = 0; c <
sn.nchains; ++c) {
1074 const std::size_t i = zc.deadstat[c];
1075 if (i > 0 &&
sn.stations[i - 1].nservers == 0.0) reduced.stations[i - 1].nservers = 1.0;
1077 reduced.refresh_struct();
1080 solve_auto(o, reduced, solved,
cache,
fj);
1082 solve_named(name, o, reduced, solved,
cache,
fj);
1083 r = avg_result_of_table(
sn, solved);
1085 std::vector<double> CN(K, 0.0), XN(K, 0.0);
1086 for (std::size_t row = 0; row < solved.SysClass.size(); ++row)
1087 for (std::size_t k = 0; k < K; ++k)
1088 if (
sn.classes[k].name == solved.SysClass[row]) {
1089 CN[k] = solved.SysRespT[row];
1090 XN[k] = solved.SysTput[row];
1092 const std::vector<double> st2sf =
sn.station_to_stateful();
1093 const std::vector<double> njobs =
sn.njobs();
1094 for (std::size_t c = 0; c <
sn.nchains; ++c) {
1095 if (zc.deadstat[c] == 0)
continue;
1096 const std::size_t i = zc.deadstat[c] - 1;
1097 const std::size_t sf =
static_cast<std::size_t
>(st2sf[i]) - 1;
1098 double pop = 0.0, vtot = 0.0;
1099 for (std::size_t k = 0; k < K; ++k)
1100 if (
sn.chains[c][k]) {
1102 vtot +=
sn.visits[c](sf, k);
1104 for (std::size_t k = 0; k < K; ++k) {
1105 if (!
sn.chains[c][k])
continue;
1106 for (std::size_t j = 0; j < M; ++j) {
1114 const double v =
sn.visits[c](sf, k);
1115 r.QN(i, k) = pop * v / vtot;
1126 r.iter = solved.iter;
1127 r.warning = solved.warning;
1128 r.listcost = solved.ListCost;
1129 if (solved.has_lognormconst) r.lognormconst = solved.lognormconst;
1131 t.solver = solved.solver;
1132 t.method = solved.method;
1133 fill_table(t,
sn, r);
1172 for (std::size_t i = 0; i <
sn.nstations; ++i)
1173 for (std::size_t k = 0; k <
sn.nchains; ++k) {
1174 out.
Station.push_back(
sn.stations[i].name);
1175 out.
Chain.push_back(chains[k]);
1177 out.
QLen.push_back(c.
QN(i, k));
1178 out.
Util.push_back(c.
UN(i, k));
1179 out.
RespT.push_back(c.
RN(i, k));
1181 out.
ArvR.push_back(c.
AN(i, k));
1182 out.
Tput.push_back(c.
TN(i, k));
1208 if (
fj.empty())
return out;
1210 for (std::size_t p = 0; p <
fj.npairs(); ++p)
1211 for (std::size_t r = 0; r <
fj.QLen.cols(); ++r) {
1212 const double q =
fj.QLen(p, r), rt =
fj.RespT(p, r), x =
fj.Tput(p, r);
1213 if (!(q > 0.0 || rt > 0.0 || x > 0.0))
continue;
1214 out.
Fork.push_back(
sn.nodes[
fj.forks[p] - 1].name);
1215 out.
Join.push_back(
sn.nodes[
fj.joins[p] - 1].name);
1236 if (info.
empty())
return out;
1242 for (std::size_t j = 0; j < info.
A.
rows(); ++j)
1243 for (std::size_t r = 0; r < info.
A.
cols(); ++r) {
1244 if (!(info.
A(j, r) > 0.0))
continue;
1245 out.
Link.push_back(j < info.
links.size() ? info.
links[j] : std::string());
1248 out.
Demand.push_back(info.
A(j, r));
1260 const std::string&
cache,
bool hit) {
1261 for (std::size_t c = 0; c < cm.
caches.size(); ++c) {
1263 const std::vector<double>& v = hit ? cm.
caches[c].hitprob : cm.
caches[c].missprob;
1266 "Solver" + solver +
" measured no " + (hit ?
"hit" :
"miss") +
1267 " ratio at Cache '" + cache +
"' with this method");
1270 throw InputError(
"'" +
cache +
"' is not a Cache node of this model");
1321 opt.keep_filtration =
true;
1330 const std::size_t ist =
sn.nodes[node - 1].station;
1331 if (ist == 0)
throw InputError(
"prob_aggr: the node is not a station");
1332 const std::size_t K =
sn.nclasses;
1333 if (state.size() != K)
throw InputError(
"prob_aggr: the state must have one entry per class");
1335 for (std::size_t s = 0; s < A.
rows(); ++s) {
1337 for (std::size_t k = 0; k < K && hit; ++k) hit = A(s, (ist - 1) * K + k) == state[k];
1338 if (hit) p += d.
pi[s];
1347 const std::size_t ist =
sn.nodes[node - 1].station;
1348 if (ist == 0)
throw InputError(
"marg_aggr: the node is not a station");
1349 const std::size_t K =
sn.nclasses;
1350 std::size_t nmax = 0;
1351 for (std::size_t s = 0; s < A.
rows(); ++s) {
1353 for (std::size_t k = 0; k < K; ++k) tot += A(s, (ist - 1) * K + k);
1354 nmax = std::max(nmax,
static_cast<std::size_t
>(tot));
1356 std::vector<double> pmf(nmax + 1, 0.0);
1357 for (std::size_t s = 0; s < A.
rows(); ++s) {
1359 for (std::size_t k = 0; k < K; ++k) tot += A(s, (ist - 1) * K + k);
1360 pmf[
static_cast<std::size_t
>(tot)] += d.
pi[s];
1367 std::vector<std::vector<CdfCurve> > out(
sn.nstations, std::vector<CdfCurve>(
sn.nclasses));
1368 const std::vector<std::vector<ctmc::CdfCurve<double> > > R =
1370 for (std::size_t i = 0; i < R.size() && i < out.size(); ++i)
1371 for (std::size_t c = 0; c < R[i].size() && c < out[i].size(); ++c) {
1372 out[i][c].t = R[i][c].t;
1373 out[i][c].F = R[i][c].F;
1380 throw InputError(
"acc_reward: a finite positive options.timespan_end is required");
1389 for (std::size_t i = 0; i < r.
names.size(); ++i) {
1390 if (!name.empty() && r.
names[i] != name)
continue;
1393 out.
avg.push_back(r.
avg[i]);
1395 if (out.
names.empty())
throw InputError(
"acc_reward: no reward named '" + name +
"'");
1405std::size_t StateView::column(std::size_t node, std::size_t cls)
const {
1406 if (node == 0 || node > sn_->
nodes.size())
1407 throw InputError(
"StateView: node index " + std::to_string(node) +
" does not exist");
1408 const std::size_t ist = sn_->
nodes[node - 1].station;
1411 "' is not a station, so the aggregate state holds no count for it");
1412 if (cls == 0 || cls > sn_->
nclasses)
1413 throw InputError(
"StateView: class index " + std::to_string(cls) +
" does not exist");
1414 return (ist - 1) * sn_->
nclasses + (cls - 1);
1418 return (*row_)[column(node, cls)];
1423 for (std::size_t k = 1; k <= sn_->nclasses; ++k) tot += (*row_)[column(node, k)];
1437 if (aggr.
rows() != n)
1438 throw InputError(std::string(
"The aggregated state space has ") +
1439 std::to_string(aggr.
rows()) +
" rows where the generator has " +
1440 std::to_string(n) +
", so the predicate for set " + name +
1441 " cannot be resolved state by state.");
1442 std::vector<double> hit;
1443 std::vector<double> row(aggr.
cols());
1444 for (std::size_t s = 0; s < n; ++s) {
1445 for (std::size_t c = 0; c < aggr.
cols(); ++c) row[c] = aggr(s, c);
1446 if (fn(
StateView(row,
sn))) hit.push_back(
static_cast<double>(s + 1));
1448 Matrix<double> out(hit.size(), hit.empty() ? 0 : 1);
1449 for (std::size_t i = 0; i < hit.size(); ++i) out(i, 0) = hit[i];
1458 out.reachprob = r.reachprob;
1459 out.tabooprob = r.tabooprob;
1460 out.source = r.source;
1461 out.target = r.target;
1462 out.taboo = r.taboo;
1471 out.source = r.source;
1472 out.target = r.target;
1473 out.taboo = r.taboo;
1481 const std::vector<double>& tset) {
1489 const std::vector<double>& tset) {
1494 const std::size_t n = d.
chain.Q.rows();
1496 sn, d, predicate_states(A, ssn, aggr, n,
"A"), predicate_states(B, ssn, aggr, n,
"B"),
1497 predicate_states(C, ssn, aggr, n,
"C"), tset));
1515 const std::size_t n = d.
chain.Q.rows();
1517 sn, d, predicate_states(A, ssn, aggr, n,
"A"), predicate_states(B, ssn, aggr, n,
"B"),
1518 nmax, predicate_states(C, ssn, aggr, n,
"C")));
1536 std::printf(
"%8s %-28s %s\n",
"State",
"Marking",
"Rates (to: rate)");
1537 for (std::size_t i = 0; i < Q.
rows(); ++i) {
1539 if (i < space.
rows()) {
1540 std::ostringstream os;
1542 for (std::size_t c = 0; c < space.
cols(); ++c) os << (c ?
" " :
"") << space(i, c);
1546 std::printf(
"%8zu %-28s", i + 1, mark.c_str());
1547 for (std::size_t j = 0; j < Q.
cols(); ++j)
1548 if (i != j && Q(i, j) != 0.0) std::printf(
" %zu: %.6g", j + 1, Q(i, j));
1559 const std::vector<fluid::FluidTranPoint> pts =
1562 for (std::size_t i = 0; i <
sn.nstations; ++i)
1563 for (std::size_t c = 0; c <
sn.nclasses; ++c)
1564 out.
label.push_back(
sn.stations[i].name +
"/" +
sn.classes[c].name);
1565 for (std::size_t s = 0; s < pts.size(); ++s) {
1566 out.
t.push_back(pts[s].t);
1567 std::vector<double> row;
1568 for (std::size_t i = 0; i <
sn.nstations; ++i)
1569 for (std::size_t c = 0; c <
sn.nclasses; ++c) row.push_back(pts[s].QN(i, c));
1570 out.
QNt.push_back(row);
1577 std::vector<std::vector<CdfCurve> > out(
sn.nstations, std::vector<CdfCurve>(
sn.nclasses));
1578 const std::vector<std::vector<fluid::FluidPassage> > R =
1580 for (std::size_t i = 0; i < R.size() && i < out.size(); ++i)
1581 for (std::size_t c = 0; c < R[i].size() && c < out[i].size(); ++c) {
1582 out[i][c].t = R[i][c].t;
1583 out[i][c].F = R[i][c].cdf;
1598 "SolverLDES::cdf_respt needs the per-job response times the engine records under "
1599 "--respt-samples and the run returned none; raise the samples so completions are observed");
1600 std::vector<std::vector<CdfCurve> > out(
sn.nstations, std::vector<CdfCurve>(
sn.nclasses));
1601 for (std::size_t i = 0; i <
sn.nstations; ++i)
1602 for (std::size_t c = 0; c <
sn.nclasses; ++c) {
1604 for (std::size_t j = 0; j < m.
rows(); ++j) {
1605 out[i][c].F.push_back(m(j, 0));
1606 out[i][c].t.push_back(m(j, 1));
1613 const std::string& method) {
1615 const std::vector<ldes::LdesPercentileResult> rows =
1617 std::vector<PerctRespTCI> out;
1618 out.reserve(rows.size());
1619 for (std::size_t n = 0; n < rows.size(); ++n) {
1624 e.
values = rows[n].values;
1625 e.
lower = rows[n].lower;
1626 e.
upper = rows[n].upper;
1629 e.
level = rows[n].level;
1630 e.
method = rows[n].method;
1639 const std::string& job_class,
const std::string& method) {
1641 for (std::size_t c = 0; c <
sn.nclasses; ++c)
1642 if (
sn.classes[c].name == job_class)
return perct_respt(percentiles,
static_cast<long>(c), method);
1643 throw InputError(
"SolverLDES::perct_respt: no job class named '" + job_class +
"'");
1648 const std::size_t M =
sn.nstations, K =
sn.nclasses;
1656 for (std::size_t row = 0; row < t.
QLen.size(); ++row)
1657 for (std::size_t i = 0; i < M; ++i)
1658 for (std::size_t c = 0; c < K; ++c)
1660 QN(i, c) = t.
QLen[row];
1665 for (std::size_t i = 1; i <= M; ++i) {
1667 std::vector<std::size_t> n(K, 0), ph(K, 1);
1668 for (std::size_t c = 0; c < K; ++c) {
1669 n[c] =
static_cast<std::size_t
>(P(i - 1, c) + 0.5);
1670 ph[c] =
sn.phases_of(i, c + 1);
1674 throw InputError(
"SolverLDES::init_from_solver: station '" +
sn.stations[i - 1].name +
1675 "' admits no state with the warm-start placement");
1677 for (std::size_t r = 0; r < rows.size(); ++r)
1678 for (std::size_t c = 0; c < rows[r].size(); ++c) space(r, c) = rows[r][c];
1679 std::vector<double> prior(rows.size(), 0.0);
1686 jobs_ready_ =
false;
1691 if (jobs.
rows() == 0 || jobs.
cols() < 7)
1692 throw InputError(
"SolverLDES::init_from_jobs needs one row per job with the columns [station, class, "
1693 "remaining, elapsed, qage, sage, order, id], id optional");
1697 jobs_ready_ =
false;
1701void SolverLDES::run_tracked() {
1705 opt.track_jobs =
true;
1719 return job_departures_;
1729 for (std::size_t b = 0; b < s.
block.size(); ++b) {
1730 const std::size_t ind = s.
nodes[b];
1731 const std::string& nm =
sn.nodes[ind - 1].name;
1732 for (std::size_t j = 0; j < s.
block[b].cols(); ++j) {
1735 ? nm +
"/" +
sn.classes[j].name
1736 : nm +
"/" + std::to_string(j + 1));
1739 out.
state.assign(s.
t.size(), std::vector<double>(s.
state.
cols(), 0.0));
1740 for (std::size_t i = 0; i < s.
t.size() && i < s.
state.
rows(); ++i)
1742 for (std::size_t k = 0; k < s.
event.
rows(); ++k) {
1743 std::vector<double> e(6);
1744 for (std::size_t j = 0; j < 6; ++j) e[j] = s.
event(k, j);
1747 out.
event.push_back(e);
1778 const char* who,
bool trajectory =
false) {
1779 std::vector<std::string> flags(1,
"--export-histogram");
1780 if (trajectory) flags.push_back(
"--trajectory");
1784 std::string(
"SolverLDES::") + who +
": the engine returned no state histogram, so no "
1785 "state probability can be read from this run");
1791 if (node == 0 || node >
sn.nodes.size())
1792 throw InputError(
ErrorKind{
"Argument"}, std::string(
"SolverLDES::") + who +
": node index " +
1793 std::to_string(node) +
" is out of range");
1794 const std::size_t ist =
sn.nodes[node - 1].station;
1797 std::string(
"SolverLDES::") + who +
": node " +
sn.nodes[node - 1].name +
1798 " is not a station; the LDES state histogram records station queue lengths only");
1805 std::vector<double> c(
sn.nclasses, 0.0);
1806 for (std::size_t k = 0; k <
sn.nclasses && ist - 1 < nir.rows() && k < nir.cols(); ++k)
1807 c[k] = nir(ist - 1, k);
1814 std::vector<double> row(space.cols());
1815 for (std::size_t c = 0; c < space.cols(); ++c) row[c] = space(s, c);
1816 return sn.reward[l].fn(row);
1823 const std::size_t ist = ldes_station_of(
sn, node,
"prob");
1824 std::vector<std::vector<double> > targets;
1825 if (state.
rows() == 0 || state.
cols() == 0) {
1826 targets.push_back(ldes_current_counts(
sn, ist));
1829 const std::size_t K =
sn.nclasses;
1830 std::vector<std::size_t> ph(K, 1), shift(K, 0);
1832 for (std::size_t k = 0; k < K; ++k) {
1833 ph[k] =
sn.phasessz_of(ist, k + 1);
1837 const std::size_t nvars =
sn.nvars_of(
sn.node_of_station(ist));
1838 for (std::size_t r = 0; r < state.
rows(); ++r) {
1839 std::vector<double> row(state.
cols());
1840 for (std::size_t c = 0; c < state.
cols(); ++c) row[c] = state(r, c);
1842 targets.push_back(m.
nir);
1847 for (std::size_t t = 0; t < targets.size(); ++t) {
1848 std::vector<ldes::LdesStateQuery> q(1);
1850 q[0].counts = targets[t];
1858 const std::size_t ist = ldes_station_of(
sn, node,
"prob_aggr");
1859 std::vector<ldes::LdesStateQuery> q(1);
1861 q[0].counts = counts.empty() ? ldes_current_counts(
sn, ist) : counts;
1868 std::vector<ldes::LdesStateQuery> q;
1869 for (std::size_t ist = 1; ist <=
sn.nstations; ++ist) {
1873 e.
counts = ldes_current_counts(
sn, ist);
1876 if (q.empty())
return 0.0;
1891 "SolverLDES::tran_avg needs a finite positive options.timespan_end: a transient mean "
1892 "over an unstated horizon is not a quantity");
1894 o.has_timespan =
true;
1898 if (r.
t.empty() || r.
QNt.empty())
1900 "SolverLDES::tran_avg: the engine ran but recorded no trajectory over [0, " +
1903 for (std::size_t i = 0; i <
sn.nstations; ++i)
1904 for (std::size_t c = 0; c <
sn.nclasses; ++c)
1905 out.
label.push_back(
sn.stations[i].name +
"/" +
sn.classes[c].name);
1908 for (std::size_t g = 0; g < r.
t.size(); ++g) {
1909 std::vector<double> row;
1910 for (std::size_t i = 0; i <
sn.nstations; ++i)
1911 for (std::size_t c = 0; c <
sn.nclasses; ++c)
1912 row.push_back(i < r.
QNt.size() && c < r.
QNt[i].size() && g < r.
QNt[i][c].rows()
1915 out.QNt.push_back(row);
1922 if (
sn.reward.empty())
1924 "No rewards defined. Use set_reward(name, fn) before calling avg_reward.");
1925 std::vector<double> E(
sn.reward.size(), 0.0);
1928 for (std::size_t l = 0; l <
sn.reward.size(); ++l) names->push_back(
sn.reward[l].name);
1930 std::vector<std::string> flags(1,
"--export-histogram");
1935 for (std::size_t s = 0; s < tm.
rows(); ++s) total += tm(s, 0);
1937 if (space.
rows() == 0 || tm.
rows() == 0 || !(total > 0.0))
return E;
1938 for (std::size_t l = 0; l <
sn.reward.size(); ++l)
1939 for (std::size_t s = 0; s < space.
rows() && s < tm.
rows(); ++s)
1940 E[l] += (tm(s, 0) / total) * ldes_reward_at(
sn, l, space, s);
1946 if (
sn.reward.empty())
1948 "No rewards defined. Use set_reward(name, fn) before calling tran_reward.");
1949 std::vector<std::size_t> which;
1950 for (std::size_t l = 0; l <
sn.reward.size(); ++l)
1951 if (name.empty() ||
sn.reward[l].name == name) {
1953 if (!name.empty())
break;
1957 std::vector<std::string> flags(1,
"--export-histogram");
1958 flags.push_back(
"--trajectory");
1964 for (std::size_t w = 0; w < which.size(); ++w) {
1965 out.
names.push_back(
sn.reward[which[w]].name);
1966 std::vector<double> m(np, 0.0);
1967 for (std::size_t s = 0; s < np; ++s) m[s] = ldes_reward_at(
sn, which[w], r.
traj_space, s);
1974 const std::vector<std::size_t>& orders) {
1976 std::vector<std::size_t> ord = orders.empty() ? std::vector<std::size_t>(1, 1) : orders;
1977 std::size_t nmax = 0;
1978 for (std::size_t j = 0; j < ord.size(); ++j) {
1981 "SolverLDES::avg_busy_period: busy period orders are 1-based");
1982 nmax = std::max(nmax, ord[j]);
1984 for (std::size_t t = 0; t < stations.size(); ++t)
1985 if (stations[t] == 0 || stations[t] >
sn.nstations)
1987 std::to_string(stations[t]) +
" is out of range");
1988 if (job_class >=
static_cast<long>(
sn.nclasses))
1990 std::to_string(job_class) +
" is out of range");
1991 const long cls = job_class < 0 ? -1 : job_class;
1995 if (stations.size() > 1) {
1996 std::vector<std::size_t> sub;
1997 for (std::size_t t = 0; t < stations.size(); ++t) sub.push_back(stations[t] - 1);
2004 const double nan = std::numeric_limits<double>::quiet_NaN();
2006 const std::vector<std::size_t>& cols) {
2007 for (std::size_t j = 0; j < cols.size(); ++j) {
2008 const std::size_t k = cols[j] - 1;
2009 const double cnt = k < tg.count.size() ? tg.count[k] : 0.0;
2010 out.
count(row, j) = cnt;
2011 out.
mean(row, j) = cnt == 0.0 || k >= tg.mean.
size() ? nan : tg.mean[k];
2016 if (stations.empty()) {
2018 for (std::size_t j = 1; j <= nmax; ++j) out.
orders.push_back(j);
2021 for (std::size_t t = 0; t < r.
busy_periods.size(); ++t) {
2027 std::vector<std::size_t> wanted;
2028 for (std::size_t t = 0; t < stations.size(); ++t) wanted.push_back(stations[t] - 1);
2029 std::sort(wanted.begin(), wanted.end());
2030 for (std::size_t t = 0; t < r.
busy_periods.size(); ++t) {
2032 std::vector<std::size_t> st = tg.
stations;
2033 std::sort(st.begin(), st.end());
2034 if (st == wanted &&
static_cast<long>(tg.
job_class) == cls) {
2039 fill_row(out, 0, tg, ord);
2044 "No busy period target matches the requested stations and class.");
2056 std::vector<CdfCurve> out(c.size());
2057 for (std::size_t e = 0; e < c.size(); ++e) {
2066 std::vector<std::string> out;
2067 for (std::size_t i = 0; i < fs.size(); ++i) out.push_back(
qn::feature_name(fs[i]));
2074 static const Feature fs[] = {
2075 Feature::Host, Feature::Processor, Feature::Task, Feature::Entry, Feature::Activity,
2076 Feature::SyncCall, Feature::AsyncCall,
2077 Feature::ActivityPrecedence_PRE_SEQ, Feature::ActivityPrecedence_POST_SEQ,
2078 Feature::ActivityPrecedence_PRE_AND, Feature::ActivityPrecedence_POST_AND,
2079 Feature::ActivityPrecedence_PRE_OR, Feature::ActivityPrecedence_POST_OR,
2080 Feature::SchedStrategy_REF, Feature::SchedStrategy_FCFS, Feature::SchedStrategy_PS,
2081 Feature::SchedStrategy_INF, Feature::SchedStrategy_LCFS, Feature::SchedStrategy_SIRO,
2082 Feature::SchedStrategy_HOL,
2083 Feature::SetupDelayOff, Feature::HeteroServers,
2084 Feature::CacheTask, Feature::ItemEntry, Feature::Cache, Feature::ActivityPrecedence_POST_CACHE,
2085 Feature::ReplacementStrategy_RR, Feature::ReplacementStrategy_FIFO,
2086 Feature::ReplacementStrategy_SFIFO, Feature::ReplacementStrategy_LRU,
2087 Feature::ReplacementStrategy_HLRU, Feature::ReplacementStrategy_CLIMB,
2088 Feature::ReplacementStrategy_QLRU,
2089 Feature::Exp, Feature::Erlang, Feature::HyperExp, Feature::PH, Feature::APH, Feature::Coxian,
2090 Feature::Cox2, Feature::Det, Feature::Uniform, Feature::Gamma, Feature::Lognormal,
2091 Feature::Weibull, Feature::LogLogistic, Feature::MassAtOrigin, Feature::Pareto,
2093 Feature::Geometric, Feature::Bernoulli, Feature::Binomial, Feature::Poisson,
2095 Feature::MAP, Feature::MMPP2, Feature::RAP,
2096 Feature::Replayer, Feature::Trace};
2097 std::vector<std::string> out;
2098 for (std::size_t i = 0; i <
sizeof(fs) /
sizeof(*fs); ++i) out.push_back(
qn::feature_name(fs[i]));
2116 std::vector<std::vector<CdfCurve> > out(
sn.nstations, std::vector<CdfCurve>(
sn.nclasses));
2121 const std::map<std::pair<std::size_t, std::size_t>, std::vector<std::pair<double, double> > >
2123 for (std::map<std::pair<std::size_t, std::size_t>,
2124 std::vector<std::pair<double, double> > >::const_iterator it = rd.begin();
2125 it != rd.end(); ++it) {
2126 const std::size_t i = it->first.first, c = it->first.second;
2127 if (i == 0 || i > out.size() || c == 0 || c >
sn.nclasses)
continue;
2131 for (std::size_t j = 0; j < it->second.size(); ++j) {
2132 out[i - 1][c - 1].F.push_back(it->second[j].first);
2133 out[i - 1][c - 1].t.push_back(it->second[j].second);
2143 for (std::size_t i = 0; i <
sn.nstations; ++i)
2144 for (std::size_t c = 0; c <
sn.nclasses; ++c)
2145 out.
label.push_back(
sn.stations[i].name +
"/" +
sn.classes[c].name);
2147 for (std::size_t g = 0; g < r.
t.size(); ++g) {
2148 std::vector<double> row;
2149 for (std::size_t i = 0; i <
sn.nstations; ++i)
2150 for (std::size_t c = 0; c <
sn.nclasses; ++c)
2151 row.push_back(i < r.
QNt.size() && c < r.
QNt[i].size() && g < r.
QNt[i][c].size()
2154 out.
QNt.push_back(row);
2161 if (node == 0 || node >
sn.nodes.size())
throw InputError(
"prob_aggr: node index out of range");
2162 const std::size_t ist =
sn.nodes[node - 1].station;
2163 if (ist == 0)
throw InputError(
"prob_aggr: the node is not a station");
2173 if (node >
sn.nodes.size() ||
sn.nodes[node - 1].station == 0)
2174 throw InputError(
"sample: the node is not a station, so nothing is logged for it");
2176 for (std::size_t c = 0; c <
sn.nclasses; ++c) out.
label.push_back(
sn.classes[c].name);
2182 for (std::size_t i = 0; i <
sn.nstations; ++i)
2183 for (std::size_t c = 0; c <
sn.nclasses; ++c)
2184 out.
label.push_back(
sn.stations[i].name +
"/" +
sn.classes[c].name);
2186 for (std::size_t g = 0; g <
tr.t.size(); ++g) {
2187 std::vector<double> row;
2188 for (std::size_t i = 0; i <
sn.nstations; ++i)
2189 for (std::size_t c = 0; c <
sn.nclasses; ++c)
2190 row.push_back(i <
tr.state.size() && g <
tr.state[i].size() &&
2191 c <
tr.state[i][g].size()
2194 out.
state.push_back(row);
2211 for (std::size_t i = 0; i <
sn.nstations; ++i)
2212 for (std::size_t c = 0; c <
sn.nclasses; ++c) {
2213 if (i < b.
keep.size() && c < b.
keep[i].size() && !b.
keep[i][c])
continue;
2214 t.
Station.push_back(
sn.stations[i].name);
2233 std::transform(name.begin(), name.end(), name.begin(), ::toupper);
2238std::string family_of_facade_name(
const std::string& tag) {
2239 std::string fam = tag;
2240 std::transform(fam.begin(), fam.end(), fam.begin(), ::tolower);
2249struct AutoDelegatePlan {
2250 bool family =
false;
2251 std::string family_name;
2252 std::vector<std::string> tags;
2253 std::string first_method;
2257 const std::string& getter) {
2258 AutoDelegatePlan plan;
2260 if (!tok.is_intent) {
2262 plan.family_name = tok.family;
2263 plan.tags.push_back(facade_name_of_family(tok.family));
2264 plan.first_method = tok.submethod;
2269 for (std::size_t i = 0; i < order.size(); ++i) plan.tags.push_back(facade_name_of_slot(order[i]));
2270 plan.first_method = c.method.empty() ? std::string(
"default") : c.method;
2280template <
class R,
class Call>
2282 const std::set<std::string>& answers, Call call, std::string& last) {
2284 const AutoDelegatePlan plan = auto_delegate_plan(
sn, o.method, getter);
2285 std::string last_error, last_cat, last_kind, proposed;
2287 for (std::size_t i = 0; i < plan.tags.size(); ++i) {
2288 const std::string& tag = plan.tags[i];
2289 proposed += (proposed.empty() ?
"" :
", ") + tag;
2290 if (!answers.count(tag))
continue;
2293 oo.
method = i == 0 ? plan.first_method : std::string(
"default");
2295 R r = call(tag, model, oo);
2298 }
catch (
const Error& e) {
2299 const std::string cat = e.category();
2300 if (cat ==
"input" || cat ==
"internal")
throw;
2301 if (cat ==
"numerical" && e.kind() ==
"Timeout")
throw;
2302 last_error = tag +
": " + e.what();
2304 last_kind = e.kind();
2310 "SolverAUTO: method family '" + plan.family_name +
"' does not answer " + getter +
2313 "SolverAUTO: none of the solvers proposed for " + getter +
" (" + proposed +
2314 ") answers it in this port");
2316 const std::string msg =
"SolverAUTO: All candidate solvers failed to execute method '" + getter +
2317 "'. Last error: " + last_error;
2324bool facade_is_stochastic(
const std::string& tag,
const std::string& method) {
2325 if (tag ==
"SSA" || tag ==
"LDES")
return true;
2326 if (tag ==
"JMT")
return method.compare(0, 4,
"jmva") != 0;
2347 if (!last_.empty())
return last_;
2351 }
catch (
const Error&) {
2353 return std::string();
2359 return tag.empty() ? std::string() : family_of_facade_name(tag);
2363 std::vector<std::string> out;
2365 for (std::size_t i = 0; i < c.size(); ++i) out.push_back(facade_name_of_slot(c[i]));
2378 if (!last_.empty())
return facade_is_stochastic(last_, std::string());
2381 for (std::size_t i = 0; i < c.size(); ++i)
2382 if (facade_is_stochastic(c[i], std::string()))
return true;
2388 out.push_back(
"auto");
2390 for (std::size_t f = 0; f < fams.size(); ++f) {
2395 tag = facade_name_of_family(fams[f]);
2396 }
catch (
const Error&) {
2400 out.push_back(fams[f]);
2401 std::string key = fams[f];
2402 std::transform(key.begin(), key.end(), key.begin(), ::toupper);
2404 for (std::size_t m = 0; m < declared.size(); ++m) out.push_back(fams[f] +
"." + declared[m]);
2406 std::sort(out.begin(), out.end());
2407 out.erase(std::unique(out.begin(), out.end()), out.end());
2412 const std::vector<autosolver::SolverCandidate> rows =
2414 std::vector<AutoCandidate> out;
2415 for (std::size_t i = 0; i < rows.size(); ++i) {
2417 c.
solver = rows[i].solver;
2418 c.
method = rows[i].method;
2422 c.
reason = rows[i].reason;
2429 std::set<std::string> answers;
2430 answers.insert(
"CTMC");
2431 answers.insert(
"FLD");
2432 answers.insert(
"LDES");
2433 answers.insert(
"JMT");
2434 return auto_delegate<std::vector<std::vector<CdfCurve> > >(
2437 if (tag ==
"CTMC")
return SolverCTMC(m, oo).cdf_respt();
2438 if (tag ==
"FLD")
return SolverFLD(m, oo).cdf_respt();
2439 if (tag ==
"LDES")
return SolverLDES(m, oo).cdf_respt();
2446 std::set<std::string> answers;
2447 answers.insert(
"FLD");
2448 answers.insert(
"JMT");
2449 return auto_delegate<TranAvg>(
2452 if (tag ==
"FLD")
return SolverFLD(m, oo).tran_avg();
2459 std::set<std::string> answers;
2460 answers.insert(
"CTMC");
2461 answers.insert(
"JMT");
2462 return auto_delegate<double>(
2465 if (tag ==
"CTMC")
return SolverCTMC(m, oo).prob_aggr(node, state);
2466 return SolverJMT(m, oo).prob_aggr(node, state);
2478 const std::string& fallback) {
2480 const std::size_t dot = o.
method.find(
'.');
2481 const std::string head = dot == std::string::npos ? o.
method : o.
method.substr(0, dot);
2509 return {
"default",
"heur",
"sim",
"exact",
"fast",
"accurate",
"bound"};
2513 return {
"mva",
"nc",
"ctmc",
"fld",
"mam",
"ag",
"ba",
"ssa",
"ldes",
"jmt",
"ln",
"env",
"lqns",
"uq"};
2534 for (std::size_t s = 0; s <
sizeof(sets) /
sizeof(*sets); ++s) {
2535 const std::vector<qn::Feature> fs = sets[s].
list();
2536 for (std::size_t i = 0; i < fs.size(); ++i) out.set(fs[i]);
2544 const std::vector<qn::Feature> fs = auto_feature_union().list();
2545 std::vector<std::string> out;
2546 for (std::size_t i = 0; i < fs.size(); ++i) out.push_back(
qn::feature_name(fs[i]));
The -s ag entry point: gates, fixed point, mean measures.
SolverAUTO.listValidMethods: the method names THIS MODEL can actually run.
Base error for the multiprecision C++ port.
ExternalError(const std::string &what)
const SolverOptions & options() const
The options this solver was built with.
const solvers::CacheMetrics< double > & cache_metrics()
What the same solve observed at each Cache node, the data behind getAvgCacheTable() and getAvgItemTab...
std::vector< double > miss_ratio(const std::string &cache)
cache.getMissRatio() after the solve, with hit_ratio's conventions.
AvgFJTable avg_fj_table()
getAvgFJTable() (aliases getAvgFJT, fjAvgT, aFJT): the same metrics as a labelled table.
const solvers::FjMetrics< double > & avg_fj()
getAvgFJ(): the fork-join section metrics of the same solve, one row per Fork/Join pair (fj_sorted_pa...
solvers::FjMetrics< double > fj_
const std::string & get_name() const
getName(): the solver's own name, e.g.
AvgChain avg_chain()
getAvgChain(): the station table of the same solve aggregated by chain, (nstations x nchains).
solvers::CacheMetrics< double > cache_
std::string method_used()
getMethodUsed(): the method the solve actually resolved to.
AvgSysTable avg_sys_table()
getAvgSysTable(): per-chain system response time and throughput of the same solve.
std::vector< Matrix< double > > avg_tard()
getAvgTard(): mean class tardiness E[(R - D)^+] against the JobClass deadlines, as {Tard (stations x ...
std::vector< std::string > list_valid_methods() const
listValidMethods(): the methods this solver advertises on this model.
const AvgTable & avg_table()
getAvgTable(): the average table, solving on first demand.
std::vector< double > hit_ratio(const std::string &cache)
cache.getHitRatio() after the solve: the per-class hit probability at the named Cache,...
Network & model() const
The model this solver was built on.
void reset()
reset(): discard the cached solve.
NetworkSolver(Network &m, const std::string &name, const SolverOptions &o)
AvgChainTable avg_chain_table()
getAvgChainTable(): avg_chain() as a labelled table, one row per (station, chain).
solvers::LossnInfo lossn_
result.LossN: loss-network inputs of the last NC solve, else empty
A node of the model: the index it was given, and the model that owns it.
const std::string & get_name() const
getName().
NumericError(const std::string &what)
std::vector< std::string > proposed_solver_names(const std::string &getter="getAvg") const
delegate's retry order for that getter, as facade names; the chosen solver comes first.
static std::vector< std::string > family_names()
familyNames(): the method families, in the order a bare method name is looked up.
std::string choose_solver(const std::string &getter="getAvg") const
chooseSolver(getter): the facade name the configured method picks for that getter.
SolverBA ba_solver() const
baSolver(): the SolverBA the bound calls go to, method 'auto' unless a bound method was named.
static std::vector< std::string > metric_groups()
metricGroups(), metricGroupOf(name) and familyMetrics(family).
std::vector< std::string > list_all_methods() const
listAllMethods(): every method name the constructor accepts, independent of the model.
std::vector< std::vector< CdfCurve > > cdf_respt()
getCdfRespT(), delegated through the 'getCdfRespT' ranking.
static bool supports(Network &model)
supports(model): whether the model uses only features some family declares.
std::vector< std::string > candidate_solver_names() const
getCandidateSolverNames(): the facade names of the feasible candidates, in slot order.
SolverNC nc_solver() const
ncSolver(): the SolverNC the normalizing-constant calls go to.
SolverFLD fld_solver() const
fldSolver(): the SolverFLD the fluid-only calls go to.
std::string selected_solver_name()
getSelectedSolverName(): the facade name ("MVA", "FLD", ...) of the delegate that answered the last r...
SolverCTMC ctmc_solver() const
ctmcSolver(): the SolverCTMC the generator and state-space calls go to, with these options.
static std::vector< std::string > family_metrics(const std::string &family)
static std::string metric_group_of(const std::string &name)
static std::vector< std::string > feature_set()
getFeatureSet(): the union of the feature sets of SolverMVA, NC, CTMC, FLD, MAM, SSA,...
std::vector< AutoCandidate > find_solver(const std::string &metric=std::string(), bool show_all=false) const
findSolver(metric, showAll): which (family, method) pairs answer metric on this model.
std::string selected_method()
getSelectedMethod(): the method FAMILY of that delegate, lowercase ("mva", "fld").
bool is_stochastic()
isStochastic(): by the delegate that ran, else whether any candidate is a simulator.
TranAvg tran_avg()
getTranAvg(), delegated through the 'getTranAvg' ranking.
SolverAUTO(Network &m, const SolverOptions &o=SolverOptions())
double prob_aggr(std::size_t node, const std::vector< double > &state)
getProbAggr(node, state), delegated through the 'getProbAggr' ranking.
static std::vector< std::string > selection_intents()
selectionIntents().
SolverBA: the bounding solver, whose result is a bounds table.
BoundsTable bounds_table()
getBoundsTable(): the per-class queue-length and throughput bounds.
SolverBA(Network &m, const SolverOptions &o=SolverOptions())
SolverCTMC: the average table plus the chain it was computed from.
static void print_inf_gen(const Matrix< double > &Q, const Matrix< double > &space)
CTMC.printInfGen(Q, SS): the generator beside the state it belongs to.
Matrix< double > generator()
getGenerator(): the infinitesimal generator over that space.
double prob_aggr(std::size_t node, const std::vector< double > &state)
getProbAggr(node, state): the aggregate marginal of one state.
Matrix< double > state_space()
getStateSpace(): the aggregate state space, one row per state.
FirstPassage cdf_first_passt(const Matrix< double > &A, const Matrix< double > &B, const Matrix< double > &C=Matrix< double >(), const std::vector< double > &tset=std::vector< double >())
getCdfFirstPassT(A, B, C, tset): the FIRST PASSAGE TIME from the state set A into the state set B.
SolverCTMC(Network &m, const SolverOptions &o=SolverOptions())
SymbolicSolution symbolic_solution()
getSymbolicSolution(): the stationary law over the rate symbols x1..xE.
AccReward acc_reward(const std::string &name=std::string())
getAccReward(name): the reward accumulated over [0, options.timespan_end] by uniformisation (mc::ctmc...
FirstPassageMoments first_passt_moments(const Matrix< double > &A, const Matrix< double > &B, std::size_t nmax=3, const Matrix< double > &C=Matrix< double >())
getFirstPassTMoments(A, B, nmax, C): moments of order 1..nmax of the same passage,...
std::vector< double > marg_aggr(std::size_t node)
getProbStateAggr(node): the marginal over every state of one station.
std::vector< std::vector< CdfCurve > > cdf_respt()
getCdfRespT(): the response-time CDF per (station, class).
Matrix< double > state_space_aggr()
getStateSpaceAggr(): per-(station, class) job counts of every state, in (ist-1)*K + k column order,...
SolverFLD: the fluid solver, which also answers a transient.
std::vector< std::vector< CdfCurve > > cdf_respt()
getCdfRespT(): the response-time CDF per (station, class).
TranAvg tran_avg()
getTranAvg(): the transient mean queue length per station.
SolverFLD(Network &m, const SolverOptions &o=SolverOptions())
TranAvg tran_avg()
getTranAvg(): E[N](t), averaged over options.config.replications (SolverOptions::replications,...
SolverJMT(Network &m, const SolverOptions &o=SolverOptions())
SamplePath sample(std::size_t events=0, std::size_t node=0)
sampleSysAggr(events), or sampleAggr(node, events) when node is given: one logged trajectory.
std::vector< std::vector< CdfCurve > > cdf_respt()
getCdfRespT(): the EMPIRICAL response-time CDF per (station, class).
double prob_aggr(std::size_t node, const std::vector< double > &state)
getProbAggr(node, state): the time the declared state is held for.
TranReward tran_reward(const std::string &name=std::string())
getTranReward(name): the rewards along the sampled path; an empty name gives all of them.
SolverLDES(Network &m, const SolverOptions &o=SolverOptions())
SamplePath sample(std::size_t node, std::size_t events)
sample(node, events): the EXACT sample path of one stateful node (1-based node), from one unaveraged ...
const qn::NetworkStruct< double > & get_struct()
getStruct(): the model's struct, after the named refusal of an uncapped PAS buffer.
double prob_aggr(std::size_t node, const std::vector< double > &counts=std::vector< double >())
getProbAggr(node, counts): the probability of per-class counts at a station node.
SamplePath sample_sys(std::size_t events)
sampleSys(events): the LINE State of every stateful node per step, and every event.
SolverLDES & init_from_jobs(const Matrix< double > &jobs)
initFromJobs(jobs): start from a job-level initial state, one row per job [station,...
static std::vector< std::string > ln_feature_set()
getLNFeatureSet(): the features the layered LDES engine accepts.
std::vector< std::vector< CdfCurve > > tran_cdf_passt()
getTranCdfPassT(): the same measurement under the name the reference gives it.
std::vector< std::vector< CdfCurve > > cdf_respt()
getCdfRespT(): the EMPIRICAL response-time CDF per (station, class), from the per-job samples.
static std::vector< CdfCurve > cdf_respt_ln(const lqn::LqnStruct< double > &lsn, const SolverOptions &o=SolverOptions())
getCdfRespTLN(): the empirical response-time CDF of every entry of a layered model,...
SamplePath sample_aggr(std::size_t node, std::size_t events)
sampleAggr(node, events): the same path as per-class job counts.
const Matrix< double > & job_departures()
The [id, station, class, time] of every departure of a tagged job, from the same run.
SamplePath sample_sys_aggr(std::size_t events)
sampleSysAggr(events): the per-class counts of every stateful node per step.
static std::vector< std::string > feature_set()
getFeatureSet(): the features the LDES engine declares for a Network.
const Matrix< double > & final_jobs()
getFinalJobs(): the jobs present at the end of the run, in the init_from_jobs layout.
double prob_sys_aggr()
getProbSysAggr(): the same quantity, the histogram being aggregate already.
std::vector< PerctRespTCI > perct_respt(const std::vector< double > &percentiles=std::vector< double >(), long job_class=-1, const std::string &method=std::string())
getPerctRespT(percentiles, jobclass, method): steady-state response-time percentiles with confidence ...
TranAvg tran_avg()
getTranAvg(): the transient E[N](t) per (station, class) over [0, options.timespan_end],...
double prob(std::size_t node, const Matrix< double > &state=Matrix< double >())
getProb(node, state): the probability of a DETAILED state of one station node (1-based node),...
SolverLDES & init_from_solver(NetworkSolver &aux)
initFromSolver(initSolver): warm-start from an auxiliary solver's steady state.
BusyPeriodTable avg_busy_period(const std::vector< std::size_t > &stations=std::vector< std::size_t >(), long job_class=-1, const std::vector< std::size_t > &orders=std::vector< std::size_t >())
getAvgBusyPeriod(stations, jobclass, n): the mean busy periods of the given orders.
double prob_sys()
getProbSys(): the joint probability that every station holds its current-state counts.
static bool supports(Network &model)
supports(model): whether the Network uses only features the engine declares.
std::vector< std::vector< CdfCurve > > tran_cdf_respt()
getTranCdfRespT(): the empirical passage law, which is the same ECDF as cdf_respt.
std::vector< double > avg_reward(std::vector< std::string > *names=0)
getAvgReward(): E[r] for every declared reward, exact on the joint-state histogram,...
SolverNC: the normalizing-constant solver.
const solvers::LossnInfo & lossn_info()
The loss-network inputs (nu, A, C, link names, method) of the last solve, the reference's result....
SolverNC(Network &m, const SolverOptions &o=SolverOptions())
AvgLinkTable avg_link_table()
getAvgLinkTable(): per-link Capacity, Demand, Occupancy, LinkBlocking and RouteLoss of a loss network...
double total(std::size_t node) const
s.at(node).total(): jobs of every class at a station node; a handle converts.
double at(std::size_t node, std::size_t cls) const
s.at(node, cls): jobs of class cls (1-based; a handle converts) at a station node.
StateView(const std::vector< double > &row, const qn::NetworkStruct< double > &sn)
UnsupportedError(const std::string &what)
std::vector< NodeDef > nodes
every node, in creation order
A subset of the registry: MATLAB's SolverFeatureSet, whose list is a flag per field.
std::vector< Feature > list() const
The features held, in registry order.
A network plus its refreshed NetworkStruct.
void set_state_prior(std::size_t node, const Matrix< T > &space, const std::vector< T > &prior)
StatefulNode.setStatePrior(space, prior): a distribution over the rows of a DECLARED state space.
const NetworkStruct< T > & get_struct()
The refreshed struct, MATLAB's model.getStruct().
The RAII frame timeout_arm returns.
bool active() const
Whether this scope pushed a frame.
The fluid solver's outermost entry point: @@SolverFLD/runAnalyzer.m's method resolution over solver_f...
The log-driven half of SolverJMT: linkAndLog, parseLogs, parseTranState, parseTranRespT,...
The NATIVE LDES engine for LAYERED (LQN) models, the C++ twin of jline/solvers/ldes/handlers/Solver_s...
The LDES warm start: SolverLDES(model, initSolver) / initFromSolver.
options.timeout: one wall-clock budget per top-level solve, on a per-THREAD deadline stack.
Per-link blocking and occupancy of a loss network.
LayeredNetworkStruct, the flattened description of a layered queueing network.
The flat-Network path of @@SolverLQNS: its qns methods, served by qnsolver of the RADS/LQNS distribut...
Port of @NetworkSolver/mapEnvApprox.m: the solver-agnostic random-environment approximation of a netw...
The stage solvers map_env_approx injects, one per runner that can be a caller.
The method names of each solver, in listing order.
mva::AvgResult< T > solver_ag_run_analyzer(const qn::NetworkStruct< T > &L, const AgOptions &opt)
SolverAG.runAnalyzer: the converged agents as mean measures.
Matrix< T > sn_declared_marginal(const qn::NetworkStruct< T > &sn)
The (nstations x nclasses) per-class job counts of the model's OWN state.
void sn_fj_nodevisits_mmt(qn::NetworkStruct< T > &sn)
Rewrite sn.nodevisits with the MMT correction.
ZeroCapacity sn_zero_capacity(const qn::NetworkStruct< T > &sn)
AutoSolver
The Network candidate slots, in the reference's slot order (SolverAUTO.m:41-50), which is also the or...
std::string auto_metric_group_of(const std::string &name)
The measure group an accessor belongs to, "" when the name belongs to none.
std::string auto_family_alias(const std::string &name)
SolverAUTO.familyAlias: the canonical family of a method name, or "" when the method name names none.
std::vector< std::string > auto_family_metrics(const std::string &family)
The measure groups a method family can answer.
std::vector< std::string > auto_metric_groups()
The measure groups auto_find_solver reports on, in report order.
const char * auto_solver_name(AutoSolver s)
AutoToken auto_resolve_token(const std::string &raw, const qn::NetworkStruct< T > &sn)
resolveMethodToken with its third arm: an intent, a family[.submethod], or else a BARE method name,...
std::vector< AutoSolver > auto_candidates(const qn::NetworkStruct< T > &sn)
The candidate pool in slot order, filtered by supports: what the delegate retries through after the c...
std::vector< AutoSolver > auto_proposed_solvers(const qn::NetworkStruct< T > &sn, const std::string &method, AutoMode mode)
delegate's proposed order: the chosen solver, then every feasible candidate in slot order.
AutoChoice auto_choose_solver_mode(const qn::NetworkStruct< T > &sn, const std::string &method, AutoMode mode)
chooseSolver: the selection mode picks the ranking, and every mode but the two learned ones keeps the...
std::vector< SolverCandidate > auto_find_solver(const qn::NetworkStruct< T > &sn, const std::string &metric=std::string(), bool show_all=false)
SolverAUTO.findSolver: which solvers and solver methods can analyze this model, and for the ones that...
std::vector< std::string > auto_list_valid_methods(const qn::NetworkStruct< T > &sn)
SolverAUTO.listValidMethods: every method name this model can be asked for.
BaBounds< T > ba_bounds(const qn::NetworkStruct< T > &L, const BaOptions &opt)
Port of SolverBA.getBounds.
mva::AvgResult< T > solver_ba_run_analyzer(const qn::NetworkStruct< T > &L, const BaOptions &opt_in)
Port of @@SolverBA/runAnalyzer.m for the lang='matlab' path.
std::vector< std::string > list_valid_methods()
Port of SolverBA.listValidMethods.
CtmcSolution< T > solver_ctmc_analyzer(const NetworkStruct< T > &sn_in, const CtmcOptions &opt, const CtmcStationaryHook< T > &stationary=CtmcStationaryHook< T >())
Port of solver_ctmc_analyzer.m plus the fork-join wrapper of @@SolverCTMC/runAnalyzer....
std::vector< std::string > list_valid_methods()
Port of SolverCTMC.listValidMethods.
CtmcGenerator< T > ctmc_get_infgen(const NetworkStruct< T > &sn, const CtmcSolution< T > &d)
@@SolverCTMC/getInfGen.m, a pure alias of getGenerator in the reference.
std::vector< std::vector< CdfCurve< T > > > solver_ctmc_cdf_respt(const NetworkStruct< T > &sn, const CtmcOptions &opt)
Port of @@SolverCTMC/getCdfRespT.m: the per-(station, class) response-time CDF, indexed [ist-1][r-1].
CtmcStateSpace< T > ctmc_get_state_space(const NetworkStruct< T > &, const CtmcSolution< T > &d)
Port of @@SolverCTMC/getStateSpace.m.
CtmcAccReward< T > solver_ctmc_acc_reward(const NetworkStruct< T > &sn_arg, const CtmcOptions &opt, const T &t0, const T &t1)
Port of @@SolverCTMC/getAccReward: the reward ACCUMULATED over [t0, t], E[int_{t0}...
CtmcFirstPassageMoments< T > ctmc_firstpasst_moments(const NetworkStruct< T > &, const CtmcSolution< T > &d, const Matrix< double > &A, const Matrix< double > &B, std::size_t nmax, const Matrix< double > &C)
Port of @@SolverCTMC/getFirstPassTMoments.m: moments of order 1..nmax of the first passage time from ...
Matrix< T > ctmc_get_state_space_aggr(const NetworkStruct< T > &sn, const CtmcOptions &opt)
Port of @@SolverCTMC/getStateSpaceAggr.m: the per-(station, class) job counts of every state,...
CtmcFirstPassage ctmc_cdf_firstpasst(const NetworkStruct< T > &, const CtmcSolution< T > &d, const Matrix< double > &A, const Matrix< double > &B, const Matrix< double > &C, std::vector< double > tset, const std::string &method="expm")
Port of @@SolverCTMC/getCdfFirstPassT.m: the distribution of the FIRST PASSAGE TIME from state set A ...
mva::AvgResult< T > solver_ctmc_mdd_run_analyzer(const NetworkStruct< T > &sn, const CtmcOptions &opt, const mdd::MddMcdOptions &mcdopt=mdd::MddMcdOptions())
Solve with mdd and format, so a caller with no use for the diagram has one call.
CtmcSymbolicSolution< T > ctmc_symbolic_solution(const NetworkStruct< T > &sn, const CtmcOptions &opt, const CtmcSymbolicOptions &symopt=CtmcSymbolicOptions())
Port of @@SolverCTMC/getSymbolicSolution.m: pi Q = 0 with sum(pi) = 1 over the field of rational func...
bool is_stateless_method(const std::string &method)
True for a method whose analyzer is not the explicit-generator one.
mva::AvgResult< T > solver_ctmc_run_analyzer_any(const NetworkStruct< T > &sn, const CtmcOptions &opt)
Solve on whichever path applies and format, mirroring solver_ctmc_run_analyzer.
std::vector< std::string > fluid_list_valid_methods()
Port of SolverFLD.listValidMethods.
FluidSolution solver_fluid_run_analyzer(const qn::NetworkStruct< T > &sn, const FluidOptions &opt, qn::NetworkStruct< T > *sn_out=nullptr, qn::NetworkStruct< T > *refreshed_out=nullptr, solvers::CacheMetrics< T > *cache_out=nullptr, const qn::NetworkStruct< T > *gate_sn=nullptr)
Port of @@SolverFLD/runAnalyzer.m: resolve the method, route to the function the reference routes to,...
std::vector< FluidTranPoint > solver_fluid_tran_avg(const qn::NetworkStruct< T > &sn, const FluidOptions &opt, std::size_t points=101)
getTranAvg on the first-order closing drift, over that horizon.
std::vector< std::vector< FluidPassage > > solver_fluid_cdf_respt(const qn::NetworkStruct< T > &sn, const FluidOptions &opt, std::size_t points=201)
Port of @@SolverFLD/getCdfRespT: the response-time law of every (station, class) pair,...
void require_finite_pas_buffers(const qn::NetworkStruct< T > &sn)
Refuse an OI/PAS station with no finite buffer before it reaches LDES.
JmtReplication< T > jmt_transient_replications(const qn::NetworkStruct< T > &sn, const JmtOptions &opt)
Port of the transient ensemble of @@SolverJMT/runAnalyzer.m (default over a finite timespan).
JmtSysTrace< T > jmt_sample_sys_aggr(const qn::NetworkStruct< T > &sn, std::size_t num_events, const JmtOptions &opt)
Port of sampleSysAggr: every station's trajectory on one time grid.
JmtNodeTrace< T > jmt_sample_aggr(const qn::NetworkStruct< T > &sn, std::size_t node, std::size_t num_events, const JmtOptions &opt)
Port of sampleAggr: the queue-length trajectory of one node.
std::vector< std::string > jmt_list_valid_methods()
Port of SolverJMT.listValidMethods.
JmtResult< T > solver_jmt_run_analyzer(const qn::NetworkStruct< T > &sn, const JmtOptions &opt_in)
Port of @@SolverJMT/runAnalyzer.m, the jsim and jmva arms.
std::map< std::pair< std::size_t, std::size_t >, std::vector< std::pair< double, double > > > jmt_get_cdf_resp_t(const qn::NetworkStruct< T > &sn, const JmtOptions &opt, bool seed_from_steady=true)
Port of getCdfRespT: the empirical response-time distribution per (station, class),...
JmtProbAggr jmt_prob_aggr(const qn::NetworkStruct< T > &sn, const JmtOptions &opt, std::size_t target_station=0, const std::vector< double > &target=std::vector< double >())
Port of getProbAggr and getProbSysAggr, both off ONE instrumented run.
std::vector< LnEntryCdf > ldes_ln_cdf_respt(const LnResult &r, std::size_t nentries)
The empirical response time CDF of every ENTRY, the getCdfRespTLN of the other codebases: one [F(t),...
LdesSample ldes_sample_aggr(const qn::NetworkStruct< T > &sn, const LdesOptions &o, std::size_t ind, std::size_t events)
sampleAggr(node, events): the same path as per-class counts, always available.
std::vector< LdesPercentileResult > ldes_perct_respt(const LdesResult &r, const std::vector< double > &percentiles, int replications, const std::string &method=std::string(), double level=0.95, long job_class=-1)
Port of @SolverLDES/getPerctRespT: steady-state response-time p-quantiles with confidence intervals,...
solvers::FjMetrics< double > ldes_fj_metrics(const qn::NetworkStruct< T > &sn, const LdesResult &r)
ldesParseForkJoin: the engine's "forkJoin" rows mapped onto the Fork/Join pairs of sn by (fork name,...
LdesSample ldes_sample_sys(const qn::NetworkStruct< T > &sn, const LdesOptions &o, std::size_t events)
sampleSys(events): the LINE State of every stateful node at each step, and every event of the run.
double ldes_prob_from_histogram(const LdesResult &r, std::size_t nclasses, const std::vector< LdesStateQuery > &query)
Residence-time probability of an aggregate joint state, from a parsed result.
engine::LnResult ldes_ln_engine_solve(const lqn::LqnStruct< T > &lsn, const LdesOptions &o)
Simulate a layered model in process.
bool ldes_is_available()
True when this machine can run the engine at all, by either image.
std::vector< std::string > list_valid_methods()
Port of SolverLDES.listValidMethods.
Matrix< double > warm_start_placement_from_qlen(const qn::NetworkStruct< T > &sn, const Matrix< T > &QN)
Port of placementFromMeanQLen: an integer placement from mean queue lengths.
LdesSample ldes_sample_sys_aggr(const qn::NetworkStruct< T > &sn, const LdesOptions &o, std::size_t events)
sampleSysAggr(events): the per-class counts of every stateful node at each step.
Matrix< double > ldes_cdf_respt(const LdesResult &r, std::size_t station, std::size_t job_class)
Port of getCdfRespT: the EMPIRICAL response time CDF of one (station, class) pair,...
LdesSample ldes_sample(const qn::NetworkStruct< T > &sn, const LdesOptions &o, std::size_t ind, std::size_t events)
sample(node, events): the exact path of one stateful node (1-based ind), one LINE State row per step ...
std::string ldes_ln_refusal(const lqn::LqnStruct< T > &lsn)
Port of ldes_ln_refusal: why SolverLDES.supports declines a layered model, or an empty string when it...
Matrix< double > warm_start_placement_from_ctmc(const qn::NetworkStruct< T > &sn, const ctmc::CtmcOptions &opt)
Port of placementFromCtmcSteadyState: the mode of the aggregate stationary law.
int ldes_replications(const LdesOptions &o)
The replication count a run asks the engine for: replications when it is above one,...
LdesResult solver_ldes(const qn::NetworkStruct< T > &sn, const LdesOptions &o, const std::vector< std::string > &extra_flags=std::vector< std::string >())
std::string ldes_perct_method(int replications, const std::string &method)
The quantile procedure a replication count calls for: 'fquest' on one path (R <= 1),...
LossnLinksResult< T > lossn_links(const std::vector< T > &nu, const Matrix< T > &A, const std::vector< T > &C, const std::string &method="exact", const LossnMciOptions< T > &mciopt=LossnMciOptions< T >(), std::uint64_t seed=0)
Per-link blocking and occupancy of a loss network.
std::string name(const Element *el, const std::string &key="name")
mva::AvgResult< T > solve_network_run_analyzer(const qn::NetworkStruct< T > &L, const QnsOptions &opt)
Port of @@SolverLQNS/runAnalyzerNetwork.m and solver_qns.m: SolverLQNS on a flat Network.
bool qnsolver_is_available()
Port of SolverLQNS.hasQnsolver: a native qnsolver binary on the PATH.
std::vector< std::string > list_valid_methods()
Port of SolverMAM.listValidMethods.
mva::AvgResult< T > solver_mam_run_analyzer(const qn::NetworkStruct< T > &L, const MamOptions &opt)
Port of @@SolverMAM/runAnalyzer.m for the lang='matlab' path: solve, then apply the metric filter @@N...
std::vector< std::string > methods(const std::string &solver)
Every method name the solver can be asked for, in listing order.
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.
QsysPrioTardiness solver_mva_qsys_prio_tardiness(const qn::NetworkStruct< double > &L, std::string actualmethod)
std::string resolve_method(const qn::NetworkStruct< T > &L, const std::string &method)
Port of SolverMVA.resolveMethod: the feature-driven default -> rqna upgrade for a bursty single-class...
std::vector< std::string > list_valid_methods(const qn::NetworkStruct< T > &L)
Port of SolverMVA.listValidMethods.
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...
AvgResult< T > solver_mva_run_analyzer(const qn::NetworkStruct< T > &L, const MvaOptions &opt_in, const Matrix< T > &init_sol)
Port of @@SolverMVA/runAnalyzer.m for the lang='matlab' path: gate, solve, convert,...
mva::AvgResult< T > solver_nc_run_analyzer(const qn::NetworkStruct< T > &L_in, const NcSolverOptions &opt_in)
std::vector< std::string > list_valid_methods()
Port of SolverNC.listValidMethods.
std::vector< std::vector< T > > from_marginal(const NetworkStruct< T > &sn, std::size_t ist, const std::vector< std::size_t > &n, const std::vector< std::size_t > &phases)
FeatureSet ldes_feature_set(const std::string &)
SolverLDES.getFeatureSet, transcribed WHOLE.
FeatureSet fluid_feature_set(const std::string &method)
Marginal< T > to_marginal(const NetworkStruct< T > &sn, std::size_t ist, const std::vector< T > &state_i, const std::vector< std::size_t > &phasesz, const std::vector< std::size_t > &phaseshift, std::size_t nvar=0)
Port of State.toMarginal for a STATION, one state row at a time.
FeatureSet ssa_feature_set(const std::string &method)
FeatureSet jmt_feature_set(const std::string &method)
Port of SolverJMT.getFeatureSet (@@SolverJMT/SolverJMT.m:180-290).
FeatureSet used_lang_features(const NetworkStruct< T > &sn)
FeatureSet nc_feature_set(const std::string &method)
SolverNC.getFeatureSet, 48 names, transcribed unchanged.
Feature
One language feature.
FeatureSet fluid_class_feature_set()
SolverFLD.getFeatureSet, transcribed, MINUS what the requested method cannot evaluate – the port of @...
FeatureSet ctmc_feature_set(const std::string &method)
SolverCTMC.getFeatureSet, the reference's 104 MATLAB names in full.
SupportResult feature_set_supports(const std::string &solver, const FeatureSet &declared, const FeatureSet &used)
SolverFeatureSet.supports: is every feature the model uses declared?
FeatureSet mam_feature_set(const std::string &method)
SolverMAM.getFeatureSet, the union of its four setTrue calls: 55 MATLAB names, WIDENED for 'default'/...
FeatureSet mva_feature_set(const std::string &raw_method)
SolverMVA.getFeatureSet, plus getMethodFeatureSet's per-method deltas.
const char * feature_name(Feature f)
The canonical registry name, byte for byte the MATLAB field name.
MapEnvDecision needs_map_env(const qn::FeatureSet &declared, const qn::NetworkStruct< T > &sn, const MapEnvConfig &cfg=MapEnvConfig())
needsMapEnv: does this model need the environment image, and would the image make it solvable?
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.
void cache_mark_nonreading(const qn::NetworkStruct< T > &sn, CacheNodeMetrics< T > &m)
A CLASS THAT DOES NOT READ THE CACHE READS NaN, in every solver and every codebase (BUG-101): NaN is ...
std::vector< std::string > chain_class_labels(const qn::NetworkStruct< T > &sn)
(ClassA ClassB), the JobClasses column: which classes a chain holds.
env::EnvStageAvgFn< double > nc_stage_fn(const nc::NcSolverOptions &opt)
NC stages, bound to the caller's own NcSolverOptions.
SysResult< T > solver_get_avg_sys(const qn::NetworkStruct< T > &sn, const mva::AvgResult< T > &r)
Port of @@NetworkSolver/getAvgSys.m.
mva::AvgResult< T > run_avg(const qn::NetworkStruct< T > &sn, const std::string &solver, const qn::FeatureSet &declared, const MapEnvConfig &cfg, Run run, StageFn stage_fn, const std::string &requested_method="default")
The getAvg funnel: run the model, or its environment image when the ONLY thing in the way is a non-re...
ChainResult< T > solver_get_avg_chain(const qn::NetworkStruct< T > &sn, const mva::AvgResult< T > &r)
Port of @@NetworkSolver/getAvgChain.m: the station table aggregated by chain.
mva::AvgResult< T > map_env_approx(const qn::NetworkStruct< T > &sn, const std::string &solver, const MapEnvConfig &cfg, StageFn stage_fn, const std::string &requested_method="default")
mapEnvApprox: solve the model through the random-environment image of its non-renewal processes.
std::vector< std::string > chain_names(std::size_t nchains)
Chain1, Chain2, ... – the reference's own chain labels.
env::EnvStageAvgFn< double > fluid_stage_fn(const fluid::FluidOptions &opt)
Fluid stages, bound to the caller's own FluidOptions.
env::EnvStageAvgFn< double > mva_stage_fn(const mva::MvaOptions &opt)
MVA stages, bound to the caller's own MvaOptions.
std::vector< std::string > list_valid_methods()
Port of SolverSSA.listValidMethods.
SsaSolution solver_ssa(const qn::NetworkStruct< T > &sn, const SsaOptions &opt, std::vector< SsaCacheRatio > *cache=nullptr)
qn::NetworkStruct< T > sn_with_ssa_cache_split(const qn::NetworkStruct< T > &base, const std::vector< SsaCacheRatio > &cache)
@@SolverSSA/runAnalyzer itself: the engine the method selects, then the result assembly the reference...
solvers::CacheMetrics< T > cache_metrics_of_ssa(const qn::NetworkStruct< T > &sn, const std::vector< SsaCacheRatio > &cache)
CacheMetrics from the serial engine's cache write-back.
TimeoutScope timeout_arm(double budget)
Arm budget seconds for the scope's lifetime, capped by the outer frame's remaining time.
bool timeout_tripped()
Whether the innermost budget was tripped by a checkpoint or by timeout_trip.
void timeout_warn(const std::string &solver, double budget)
The one warning a solve that stopped on its budget prints, MATLAB's flagTimeout text,...
Conservation laws of a layered queueing network, enumerated from its structure.
qn::Network< double > Network
Network as a user names it: the double model, Python's Network.
std::ostream & operator<<(std::ostream &out, const AvgTable &table)
std::function< bool(const StateView &)> StatePredicate
A STATE SET named by a predicate, the reference's function-handle form, e.g.
The model API a user writes, spelled as its Python twin.
Post-MMT node visits of a fork-join model.
Ports of matlab/src/api/sn/sn_get_state_aggr.m and sn_is_state_valid.m.
Port of matlab/src/api/sn/sn_zero_capacity.m: the closed chains trapped at a zero-capacity station.
The solver API a user writes, spelled as its Python twin.
The SolverAUTO chooser: which solver a model is handed to.
The SolverBA class surface: @@SolverBA/runAnalyzer.m, listValidMethods, getBounds and getBoundsTable.
The CHAIN-level and SYSTEM-level views of a solved model.
Port of solver_ctmc_analyzer.m and the parts of @@SolverCTMC/runAnalyzer.m that surround one solve: t...
Port of @@SolverCTMC/getCdfRespT.m and @@SolverCTMC/getCdfSysRespT.m: the exact distribution of the r...
The remaining @@SolverCTMC accessors: getGenerator / getInfGen, getStateSpace / getStateSpaceAggr and...
The mdd method of SolverCTMC: stationary analysis of a closed single-class network whose state space ...
The SolverCTMC probability family: solver_ctmc_joint, _jointaggr, _marg, _margaggr,...
Port of solver_ctmc_reward.m and the @@SolverCTMC reward surface (runRewardAnalyzer,...
Port of @@SolverCTMC/getSymbolicGenerator and getSymbolicSolution.
Port of solver_ctmc_fcr_waitq.m: the reachability-built generator of a model whose finite capacity re...
SolverFluid: the closing method, a port of solver_fluid.m, solver_fluid_iteration....
Port of SolverJMT, the Java Modelling Tools client.
Port of SolverLDES, the discrete-event simulator, as its C++ client.
The SolverMAM class surface: @@SolverMAM/runAnalyzer.m and the gates around it.
Port of solver_mva_qsys_prio_tardiness.m: the exact class-deadline tardiness E[(R - D)^+] of the sing...
The SolverMVA class surface: @@SolverMVA/runAnalyzer.m and the gates around it.
The SolverNC class surface: @@SolverNC/runAnalyzer.m and the gates around it.
The SolverSSA entry surface: a port of @@SolverSSA/runAnalyzer.m's method whitelist,...
Port of the MATLAB +State package: the encoding that turns a station's state row into marginal job co...
getAccReward(name): the reward accumulated over [t0, t], one row per reward.
std::vector< double > t
the absolute time grid, t[0] = t0
std::vector< std::vector< double > > avg
(nrewards x nt) time-averaged reward
std::vector< std::vector< double > > metric
(nrewards x nt) accumulated reward
std::vector< std::string > names
the reward names, in declaration order
One row of SolverAUTO::find_solver: a (family, method) pair and whether this model can run it.
bool runnable
the model passes this method's own support gate
std::string solver
the method family: "mva", "ctmc", "ldes", ...
std::string method
the qualified method name to pass, "mva.exact"
std::string method_class
"exact", "approx", "bound" or "simulation"
std::string reason
why a refused pair was refused, "" when runnable
std::string metrics
the measure groups the family answers, comma-joined
getAvgChainTable: the station table aggregated by CHAIN, one row per (station, chain),...
std::vector< double > QLen
std::vector< double > ArvR
std::vector< double > RespT
std::vector< double > Util
std::vector< double > ResidT
void print(std::ostream &out) const
Print the station-chain table.
std::vector< std::string > Chain
std::vector< std::string > JobClasses
std::vector< std::string > Station
std::vector< double > Tput
getAvgChain(): the station x chain matrices, @NetworkSolver/getAvgChain.m's outputs.
getAvgFJTable(): one row per (Fork/Join pair, class) with a nonzero metric, the fork-join SECTION met...
std::vector< std::string > Fork
void print(std::ostream &out) const
Print the labelled pair-class table.
std::vector< double > FJTput
std::vector< std::string > JobClass
std::vector< double > FJRespT
std::vector< double > FJQLen
std::vector< std::string > Join
SolverNC.getAvgLinkTable(): the per-link measures of a loss network (an open model whose single Delay...
std::vector< double > LinkBlocking
std::vector< double > Capacity
void print(std::ostream &out) const
Print the labelled link-class table.
std::vector< double > Occupancy
std::vector< std::string > JobClass
std::vector< std::string > Link
std::vector< double > Demand
std::vector< double > RouteLoss
getAvgSysTable(): one row per CHAIN, the cycle time and the completing throughput at the chain's refe...
std::vector< double > SysRespT
void print(std::ostream &out) const
Print the chain table.
std::vector< std::string > JobClasses
std::vector< double > SysTput
std::vector< std::string > Chain
getAvgTable, one row per (station, class) that carries a metric.
std::vector< double > ArvR
bool timed_out
Whether the solve stopped early on SolverOptions::timeout, read from the budget's TRIPPED latch (line...
std::vector< double > TputCI
std::vector< double > UtilCI
std::vector< double > Tput
std::vector< double > ResidT
void print(std::ostream &out) const
Print the labelled station-class table.
std::vector< double > RespT
std::size_t size() const
The number of rows the table carries.
std::vector< double > Util
std::vector< std::string > Station
std::vector< double > column(const std::string &column) const
A complete metric column.
std::vector< double > SysTput
bool has_ci() const
Whether the half-width columns are filled.
std::vector< double > ResidTCI
std::vector< std::string > JobClass
std::string warning
The reference's own warning text, empty when it did not warn.
double get(const std::string &column, const std::string &station, const std::string &jobclass) const
One cell of the table, by station and class NAME; NaN when absent.
std::vector< double > QLenCI
Confidence half-widths of the six metric columns, row for row; EMPTY unless SolverOptions::confint as...
AvgTable tget(const Node &node) const
AvgTable filter_by(const std::string &name) const
Rows whose station or class has name, MATLAB's one-argument filterBy.
std::vector< double > RespTCI
std::vector< double > ArvRCI
AvgTable operator()(const Node &node) const
Direct object indexing: table(queue, jobs).
std::vector< double > ListCost
getAvgCacheTable's ListCost column; empty on a model without item sizes.
std::vector< double > SysRespT
std::vector< std::string > SysClass
getAvgSysTable: system response time and throughput, per class.
std::vector< double > QLen
SolverBA(model, method).getBoundsTable().
std::vector< double > Tlower
std::vector< double > Qupper
std::vector< std::string > Station
std::vector< double > Qlower
std::vector< std::string > JobClass
std::vector< double > Tupper
SolverLDES: the discrete-event simulator, which also answers the empirical response-time law.
std::vector< std::size_t > orders
the busy period order of each column, 1-based
std::vector< std::string > names
The <kind> part of a LINE:<category>:<kind> identifier (see _kb/17-error-vocabulary....
getFirstPassTMoments(A, B, nmax, C): [m, mall, p] with the resolved sets.
std::vector< double > m
moments 1..nmax from A (conditional on B before C)
getCdfFirstPassT(A, B, C, tset): the curve, the reach probabilities and the resolved sets.
std::vector< double > t
the grid: the caller's, else 1000 points to the horizon
One (station, class) row of SolverLDES::perct_respt: steady-state response-time percentiles with conf...
std::vector< double > values
std::vector< double > halfwidth
std::vector< bool > heuristic
std::vector< double > upper
std::vector< double > percentiles
std::vector< double > lower
sampleSysAggr / sampleAggr: ONE simulated trajectory, not a mean.
std::vector< std::vector< double > > state
[step][column]
std::vector< std::string > label
what each column counts
std::vector< double > t
event times, ascending
bool aggregate
Per-class counts (true) or LINE State rows (false, SolverLDES sample/sample_sys).
std::vector< std::size_t > column_node
The 1-based node each column of state belongs to (SolverLDES only).
std::vector< std::vector< double > > event
The events of the path, one row each, [time, node, type, class, jobId, phase]: node and class 1-based...
The knobs a solver reads; a negative or empty field keeps the engine default.
double warmupfrac
options.warmupfrac, in [0,1): LDES under tranfilter=fixed, and SSA's discarded prefix.
Matrix< double > init_jobs
LDES options.init_jobs: one row per job, [station, class, remaining, elapsed, qage,...
double timeout
options.timeout, seconds: the wall-clock budget of the whole top-level solve (line/util/line_timeout....
int level
SolverBA options.level.
double timespan_end
Fluid options.timespan(2) and warm start.
bool track_jobs
LDES options.track_jobs: return the end-of-run job state; implied by init_jobs.
bool cache
options.cache: reuse the solved tables on later calls to the same solver object.
std::string tranfilter
LDES options.tranfilter: mser5 | fixed | none; empty keeps mser5.
getSymbolicSolution: the stationary law as a function of the rate symbols.
std::vector< double > rate0
nominal value of each symbol
std::string den
common denominator of the vector
std::vector< std::string > pi
stationary probability of each state
std::vector< std::string > symbols
x1..xE, empty where an event has no positive rate
std::string engine
backend that answered, e.g. "sage"
std::vector< std::string > num
numerator of each entry over den
getTranAvg: the transient mean queue length per (station, class).
std::vector< std::string > label
the (station, class) of each column
std::vector< std::vector< double > > QNt
[step][station*class]
std::vector< double > t
the time axis
getTranReward(name): each reward evaluated along the sampled state path, one row per reward.
std::vector< double > t
the time of each path point
std::vector< std::vector< double > > metric
(nrewards x nt) the reward at each point
std::vector< std::string > names
the reward names, in declaration order
What sn_zero_capacity reports.
std::string reason
Non-empty when the model has no steady state of this form: an open class reaches a zero-capacity stat...
bool any() const
True when some chain is trapped.
What a ranking resolved to, and what it had to skip to get there.
resolveMethodToken, minus the unqualified-algorithm-name arm.
Port of SolverBA.getBounds: the {lower,upper} bracket of a family.
std::vector< std::vector< bool > > keep
getBoundsTable's row filter, (M x K): whether the (station, class) pair earns a row.
Matrix< T > Qupper
(M x K), all-NaN on a side the family lacks
The options SolverBA reads.
What solver_ctmc_acc_reward produces.
std::vector< T > t
absolute time points, t[0] = t0
std::vector< std::string > names
std::vector< std::vector< T > > metric
metric[r][i] = E[int_{t0}^{t_i} r(X(s)) ds]
std::vector< std::vector< T > > avg
metric / (t_i - t0); E[r(X(t0))] at t_i = t0
The answer of @@SolverCTMC/getFirstPassTMoments.m.
The answer of @@SolverCTMC/getCdfFirstPassT.m: the [F(t), t] curve with its grid, density and resolve...
The SolverCTMC knobs this port honours.
Everything one CTMC solve produces.
std::shared_ptr< const NetworkStruct< T > > solved_sn
The struct the chain was built on, when it differs from the caller's in its state LAYOUT: set when he...
std::vector< T > pi
stationary distribution over chain.space
Backend selection, mirroring options.config.symbolic and its timeout.
std::string backend
auto to search, a URL, an image name, or none to stay local.
What @@SolverCTMC/getSymbolicSolution.m returns, plus the engine that answered.
std::string engine
backend that solved it, e.g. sage
std::vector< T > rate0
Nominal value of each symbol, i.e.
std::vector< std::string > symbols
x1..xE, empty for an event with no positive rate.
std::vector< std::string > num
numerator of each entry over den
std::vector< std::string > pi
stationary probability of each state
std::string den
common denominator of the vector
Controls, defaulting to SolverOptions('Fluid') in the reference.
What the analyzer returns, in the same shape as the MVA solver's result.
The per-class queue-length trajectory of one node, plus its event stream.
The options of one JMT solve, SolverOptions('JMT') restricted to what is read.
std::string method
default | jsim | jmva | jmva.<alg>
What jmt_prob_aggr reports: the system probability and the per-station ones.
std::vector< double > station
P(station i holds its declared per-class counts).
Transient averages over independent replications, on one time grid.
std::vector< std::vector< std::vector< double > > > QNt
QNt[ist-1][r] over t.
The result of a JMT solve: the shared AvgResult plus what only JMT reports.
The system trajectory: one per-class block per station, on a common grid.
The knobs of one LDES run.
std::vector< std::vector< std::size_t > > busy_period_subnets
–busyperiod-subnet, zero-based station indexes, one flag per set.
int busy_period_orders
–busyperiod: highest busy period order measured, 0 disabling the measurement.
One measured busy period target (–busyperiod): a station, a station-class pair, or a declared station...
std::vector< std::size_t > stations
station indexes, zero-based
One ldes-result document, parsed.
std::vector< std::vector< Matrix< double > > > QNt
[STATION][class] -> (npoints x 2), columns [value, time].
std::vector< std::vector< std::vector< double > > > respTimeSamples
[station][class] -> the per-job response times the engine recorded, in departure order.
Matrix< double > traj_space
Matrix< double > histogram_space
The exact joint-state residence-time histogram (–export-histogram).
Matrix< double > traj_time
std::vector< BusyPeriodTarget > busy_periods
Matrix< double > jobDepartures
[id, station, class, time] of every departure of a tagged init_jobs job (track_jobs).
Matrix< double > histogram_time
std::vector< double > t
the time vector, empty on a steady-state run
Matrix< double > finalJobs
The jobs present at the end of the run, in the init_jobs layout (track_jobs).
One exact sample path as sample, sampleAggr, sampleSys and sampleSysAggr return it,...
Matrix< double > state
The blocks side by side, the single matrix ssa::SsaSamplePath::state is.
std::vector< Matrix< double > > block
per node, rows aligned with t
std::vector< std::size_t > nodes
1-based node index of each block of state
Matrix< double > event
One row per event, [time, node, type, class, jobId, phase]: node and class 0-based as on the wire,...
bool aggregate
per-class counts rather than LINE State rows
std::vector< double > t
the step times, one per row
One constraint of a joint-state query: a station and the per-class job counts it is required to hold.
std::vector< double > counts
The layered result: per element, the mean measures.
std::vector< T > Loss
(R) route loss probability, as the chosen method gives it
Matrix< T > E
(J x R) blocking of route r by link j alone; 0 where A(j,r) = 0
std::vector< T > Occ
(J) mean number of busy units on link j
Options of lossn_mci, MATLAB's options struct.
SolverLQNS.defaultOptions on a flat Network plus the knobs the JMVA document carries.
The options SolverMAM reads.
The metrics getAvg returns, after filtering.
Matrix< T > RN
response time, per visit
Matrix< T > UN
utilization
Matrix< T > WN
residence time, per job
std::string method
the method asked for
Matrix< T > QN
queue length
Matrix< T > AN
arrival rate
The options SolverMVA reads.
Avg.Tard (stations x classes, queue row filled) and Avg.SysTard (1 x classes).
Controls, defaulting to SolverOptions('NC') in the reference.
What State.toMarginal returns for one station and one state row.
std::vector< T > nir
jobs per class
Every Cache node of the model, in node order; empty on a model with none.
std::vector< CacheNodeMetrics< T > > caches
One Cache node's measured behaviour.
std::vector< T > hitprob
(K) TRUE hit fraction, EMPTY = not computed
The station- or node-level table aggregated by chain.
Matrix< T > TN
(rows x nchains), rows = stations or nodes
self.result.FJ: one row per Fork/Join pair, one column per class.
std::string method
chosen method: exact, rec, erlangfp, asy or mci
std::uint64_t seed
mci seed of the run
std::vector< std::string > links
(J) link names, in row order
Matrix< double > A
(J x K) rows of the admission rule
std::vector< double > C
(J) capacities
std::size_t samples
mci sample count of the run (0 = not mci)
std::vector< double > nu
(K) offered load per class
The caller-facing map_env knobs, options.config.map_env and friends.
What the gate decided, and what it decided it about.
@@NetworkSolver/getAvgSys: one response time and one throughput per chain.
std::vector< T > XN
(nchains) system throughput at the reference station
std::vector< T > CN
(nchains) system response time, i.e. the cycle time
Controls, defaulting to SolverOptions('SSA') in the reference.
What the analyzer returns, in the same shape as the MVA and fluid results.