LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
solver_auto.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2012-2026, QORE Lab, Imperial College London
3 * All rights reserved.
4 */
5#ifndef LINE_SOLVERS_AUTO_SOLVER_AUTO_H
6#define LINE_SOLVERS_AUTO_SOLVER_AUTO_H
7
8/**
9 * @file
10 * @ingroup line_solvers
11 * The SolverAUTO chooser: which solver a model is handed to.
12 *
13 * WHAT THIS PORTS. `matlab/src/solvers/AUTO/@@SolverAUTO/` selects in two
14 * layers, and both are here:
15 *
16 * solverTraits.m computes the structural traits ONCE per call, so that the
17 * choosers stay tables of rankings rather than a second place where model
18 * inspection is written. `auto_traits` is that function.
19 *
20 * chooseSolverRanked.m walks a list of candidate slots and returns the FIRST
21 * that exists and whose feature set accepts the model, or nothing, so the
22 * caller can fall back rather than hand an infeasible solver to the
23 * delegate. `auto_ranked` is that function, and it is what makes every
24 * ranking below a preference rather than a claim.
25 *
26 * chooseSolverHeur.m / chooseAvgSolverHeur.m / chooseSolverExact.m /
27 * chooseSolverSim.m and the `fast` and `accurate` arms of chooseSolver.m
28 * are the rankings themselves, ported list for list, in the reference's own
29 * order. The Network, LayeredNetwork and Environment arms all have a
30 * counterpart here.
31 *
32 * THE FEATURE-SET GATE IS THE WHOLE POINT OF THE REWRITE. The previous port
33 * transcribed the SUPERSEDED feature cascade (population thresholds 30/10/5
34 * over a first-match tree) and consulted no feature set at all, so it named a
35 * solver that could then refuse the model. Here `auto_supports` asks the same
36 * question `Solver.supports` asks -- is every feature the model uses declared
37 * by that solver? -- from `used_lang_features` and the per-solver sets in
38 * `solver_feature_sets.h`, and the answer decides.
39 *
40 * TWO GATES ARE FINER THAN A FLAT FEATURE SET, and the reference states both
41 * outside `getFeatureSet` for that reason:
42 *
43 * 'exact' needs a product-form solution (SolverMVA.supportsExactness,
44 * SolverNC.supportsModelMethod), with the order-independent and
45 * pass-and-swap stations exempt for MVA because solver_mva_oi is exact for
46 * them regardless. Reproduced in `auto_supports`.
47 *
48 * CTMC needs its chain to FIT. The reference screens the slot with
49 * SolverCTMC.isStateSpaceTractable, which prices the worst-case state space
50 * against host memory through a profiled power law. This port has no such
51 * calibration and its generator has a hard cap instead, so the screen here
52 * compares the SAME estimator -- `ctmc_state_space_logsize`, ported
53 * factor for factor -- against that cap. The gate is therefore
54 * host-independent where the reference's is host-dependent: the estimate is
55 * identical, the budget it is compared to is this port's own.
56 *
57 * AN ABSENT ENGINE IS SKIPPED, AND SAID SO. In the reference an unavailable
58 * candidate is an empty slot and chooseSolverRanked skips it silently; that is
59 * how SolverLQNS behaves when the binary is not installed. The MAM layer engine
60 * is absent from this port in exactly that sense, and LDES and LQNS are absent
61 * only where their engines are not installed, so all three are skipped the same
62 * way -- but skipping changes which engine answers, so every choice carries
63 * `skipped`, the slots that outranked the winner and had no engine behind them.
64 * The CLI prints it. Silence there would report the second choice as if it had
65 * been the first.
66 *
67 * JMT IS NOT A CANDIDATE AT ALL, in the reference either (SolverAUTO.m:45-47):
68 * LDES subsumes its feature set, so automatic selection never dispatches to the
69 * external simulator and SolverJMT stays reachable only through an explicit
70 * token. The enum has no JMT slot for that reason.
71 *
72 * THE HOMOGENEOUS-SCHEDULING PREDICATE. `has_homogeneous_scheduling` is true
73 * when every station uses the given discipline (see NetworkStruct; it used to
74 * collapse to `nstations == 1`). Only the response-time-CDF branch and one
75 * avgOrder arm consult it, and both are written as the reference writes them.
76 *
77 */
78
79#include <algorithm>
80#include <cmath>
81#include <cstddef>
82#include <string>
83#include <vector>
84
90#include "line/util/error.h"
91
92namespace line {
93namespace autosolver {
94
95/**
96 * The Network candidate slots, in the reference's slot order (SolverAUTO.m:41-50),
97 * which is also the order the delegate retries in. There is no JMT slot: the
98 * reference removed it as a candidate.
99 */
100enum class AutoSolver { MVA = 0, NC, MAM, FLUID, SSA, CTMC, LDES };
101
102/** The LayeredNetwork candidate slots (SolverAUTO.m:52-56). */
104
105/** The Environment candidate slots (SolverAUTO.m:58-60). */
106enum class AutoEnv { ENV_MVA = 0, ENV_NC, ENV_FLUID };
107
108/** The selection intents of `SolverAUTO.selectionIntents`, less 'bound'. */
109enum class AutoMode { HEUR, EXACT, SIM, FAST, ACCURATE };
110
111/** Population at or below which an exact solver is preferred (EXACT_POPULATION_MAX). */
112const double kAutoExactPopulationMax = 5.0;
113
114inline const char* auto_solver_name(AutoSolver s) {
115 switch (s) {
116 case AutoSolver::MVA: return "mva";
117 case AutoSolver::NC: return "nc";
118 case AutoSolver::MAM: return "mam";
119 case AutoSolver::FLUID: return "fld";
120 case AutoSolver::SSA: return "ssa";
121 case AutoSolver::CTMC: return "ctmc";
122 case AutoSolver::LDES: return "ldes";
123 }
124 return "";
125}
126
127/**
128 * The layered names are the CLI's own tokens, because that is what the choice
129 * is spent on: `ln.comom` runs the layers under NC and `ln.mva` under MVA.
130 */
131inline const char* auto_layered_name(AutoLayered s) {
132 switch (s) {
133 case AutoLayered::LQNS: return "lqns";
134 case AutoLayered::LN_NC: return "ln.comom";
135 case AutoLayered::LN_MVA: return "ln.mva";
136 case AutoLayered::LN_MAM: return "ln.mam";
137 case AutoLayered::LN_FLUID: return "ln.fld";
138 }
139 return "";
140}
141
142inline const char* auto_env_name(AutoEnv s) {
143 switch (s) {
144 case AutoEnv::ENV_MVA: return "env.mva";
145 case AutoEnv::ENV_NC: return "env.nc";
146 case AutoEnv::ENV_FLUID: return "env.fld";
147 }
148 return "";
149}
150
151/**
152 * True when this port has an engine behind the slot at all.
153 *
154 * THE LDES SLOT IS MACHINE-DEPENDENT, like the LQNS one below and for the same
155 * reason: the simulator is a client of an engine LINE ships beside the binary
156 * (`common/ldes`, `common/ldes.jar`), and `ldes_is_available` answers whether
157 * this machine has one. A port that answered "never" would silently disagree
158 * with the reference wherever the engine IS present -- LDES leads the
159 * loss-metric, aggregate-sampling and `sim` rankings, so the disagreement would
160 * be a different engine answering, not a missing option.
161 */
163 if (s == AutoSolver::LDES) return ldes::ldes_is_available();
164 return true;
165}
166
167/**
168 * Every LN layer engine the ranking names is one `--layer-solver` takes (mva,
169 * nc, fluid, ssa, mam, ctmc), so each `ln.*` candidate is available.
170 *
171 * LQNS IS AVAILABLE ONLY WHERE ITS BINARY IS. That makes this choice
172 * machine-dependent, and deliberately so: `chooseAvgSolverHeur.m` gates its
173 * LQNS candidate on `SolverLQNS.isAvailable()` for the same reason, because
174 * LINE ships no LQNS binary. A port that answered "never" here would silently
175 * disagree with the reference on every machine that has one installed.
176 */
179 return true;
180}
181
182/**
183 * All three candidate ensembles are built here (`EnvOptions::stage_solver` =
184 * `fluid`, `mva`, `nc`). As in the reference, an MVA or NC ensemble is
185 * then refused by the mean-field coupling for want of a transient, and the
186 * retry list moves on to the next candidate.
187 */
188inline bool auto_env_is_available(AutoEnv) { return true; }
189
190/** The `EnvOptions::stage_solver` (and `--stage-solver`) name of a candidate ensemble. */
191inline const char* auto_env_stage_solver(AutoEnv s) {
192 switch (s) {
193 case AutoEnv::ENV_MVA: return "mva";
194 case AutoEnv::ENV_NC: return "nc";
195 case AutoEnv::ENV_FLUID: return "fluid";
196 }
197 return "fluid";
198}
199
200// ---------------------------------------------------------------------------
201// Method method names: a selection intent, or a method family
202// ---------------------------------------------------------------------------
203
204/**
205 * `SolverAUTO.selectionIntents`, less 'bound'.
206 *
207 * 'bound' IS accepted, but it is not a ranking mode: the reference sets
208 * selectionMode='bound' and options.method='auto', i.e. it names SolverBA
209 * outright. `auto_resolve_token` therefore rewrites it to the 'ba' family
210 * before this test runs, which is why it is absent here.
211 */
212inline bool auto_is_selection_intent(const std::string& token) {
213 return token.empty() || token == "default" || token == "auto" || token == "heur" ||
214 token == "sim" || token == "exact" || token == "fast" ||
215 token == "accurate";
216}
217
218inline AutoMode auto_mode_of_token(const std::string& token) {
219 if (token.empty() || token == "default" || token == "auto" || token == "heur")
220 return AutoMode::HEUR;
221 if (token == "exact") return AutoMode::EXACT;
222 if (token == "sim") return AutoMode::SIM;
223 if (token == "fast") return AutoMode::FAST;
224 if (token == "accurate") return AutoMode::ACCURATE;
225 throw InputError("SolverAUTO: '" + token + "' is not a selection intent");
226}
227
228/**
229 * `SolverAUTO.familyAlias`: the canonical family of a method name, or "" when the
230 * method name names none. A family method name is not a selection intent -- it asks for a
231 * named engine and bypasses the ranking, as `-s auto --method nc.comom` does.
232 */
233inline std::string auto_family_alias(const std::string& name) {
234 if (name == "mam") return "mam";
235 if (name == "ag") return "ag";
236 if (name == "mva") return "mva";
237 if (name == "nc") return "nc";
238 if (name == "fluid" || name == "fld") return "fld";
239 if (name == "jmt") return "jmt";
240 if (name == "ssa") return "ssa";
241 if (name == "ctmc") return "ctmc";
242 if (name == "ldes" || name == "des") return "ldes";
243 if (name == "ba") return "ba";
244 if (name == "env") return "env";
245 if (name == "ln") return "ln";
246 if (name == "lqns" || name == "lqsim") return "lqns";
247 if (name == "qns") return "lqns";
248 if (name == "uq") return "uq";
249 return "";
250}
251
252/**
253 * `resolveMethodToken`, minus the unqualified-algorithm-name arm.
254 *
255 * A method name is an intent, or `family[.submethod]`. The reference has a third form
256 * -- a bare algorithm name such as `comom`, resolved by asking every family for
257 * its `listValidMethods` -- which needs the model; it is refused here as an
258 * InputError, and `auto_resolve_token(raw, sn)` (auto_methods.h) carries that arm.
259 */
260struct AutoToken {
261 bool is_intent = true;
263 std::string family; ///< empty when is_intent
264 std::string submethod; ///< the method handed to the family, "default" when bare
265};
266
267inline AutoToken auto_resolve_token(const std::string& raw) {
268 AutoToken t;
269 const std::string token = raw.empty() ? std::string("default") : raw;
270 // 'bound' is a selection intent in the reference's own list, and it selects
271 // SolverBA with method 'auto' rather than picking a ranking
272 // (SolverAUTO.m:116-121). Rewriting it to the family method name here reuses the
273 // family path below and keeps the intent spelling usable, which is what the
274 // other three codebases accept.
275 if (token == "bound") {
276 t.is_intent = false;
277 t.family = "ba";
278 t.submethod = "auto";
279 return t;
280 }
281 if (auto_is_selection_intent(token)) {
282 t.is_intent = true;
283 t.mode = auto_mode_of_token(token);
284 return t;
285 }
286 const std::size_t dot = token.find('.');
287 const std::string head = dot == std::string::npos ? token : token.substr(0, dot);
288 const std::string rest = dot == std::string::npos ? std::string() : token.substr(dot + 1);
289 // bare "fluid" is an input alias of the "fld" family; the qualified spelling is "fld.<m>" only
290 const std::string fam =
291 (!rest.empty() && head == "fluid") ? std::string() : auto_family_alias(head);
292 if (fam.empty())
293 throw InputError(
294 "SolverAUTO: '" + token +
295 "' is neither a selection intent (default, heur, exact, sim, fast, accurate, "
296 "bound) "
297 "nor a method family (mva, nc, ctmc, fld, mam, ag, ba, ssa, ldes, jmt, ln, "
298 "env, lqns, uq). A bare algorithm name must be qualified by its family here, as in "
299 "'nc.comom': resolving it needs the per-family method registry "
300 "(listValidMethods) that this port does not carry");
301 t.is_intent = false;
302 t.family = fam;
303 t.submethod = rest.empty() ? std::string("default") : rest;
304 // `qns` and `qns.NAME` are SolverLQNS method names on a flat Network, so the
305 // whole token is the submethod and `lqns` the family.
306 if (head == "qns") t.submethod = token;
307 return t;
308}
309
310// ---------------------------------------------------------------------------
311// solverTraits.m
312// ---------------------------------------------------------------------------
313
314/** The structural traits the rankings are keyed on. Port of `solverTraits.m`. */
316 bool has_cache = false;
317 bool has_fcr = false;
318 bool has_fork = false;
319 bool has_map = false;
320 /** "none", "preempt", "ps" or "hol", in the reference's own precedence. */
321 std::string prio = "none";
322 bool is_closed = false;
323 bool is_open = false;
324 bool is_mixed = false;
325 bool has_multi_server = false;
326 bool is_product_form = false;
327 double pop_per_chain = 0.0;
328 double total_jobs = 0.0;
329 bool single_chain = false;
330};
331
332template <class T>
334 using qn::NodeType;
335 using lang::ProcessType;
337
338 AutoTraits t;
339 for (const qn::NodeDef& nd : sn.nodes)
340 if (nd.nodetype == NodeType::Cache) t.has_cache = true;
341 t.has_fcr = !sn.regions.empty();
342 t.has_fork = sn.has_fork();
343 t.has_multi_server = sn.has_multi_server();
344 t.is_product_form = sn.has_product_form();
345 t.single_chain = sn.nchains == 1;
346
347 bool has_open = false, has_closed = false;
348 for (const qn::JobClass& c : sn.classes) {
349 if (std::isinf(c.population)) has_open = true;
350 else has_closed = true;
351 }
352 t.is_open = has_open && !has_closed;
353 t.is_closed = has_closed && !has_open;
354 t.is_mixed = has_open && has_closed;
355
356 t.total_jobs = sn.total_jobs();
357 if (sn.nchains > 0) t.pop_per_chain = t.total_jobs / static_cast<double>(sn.nchains);
358
359 // Autocorrelated arrival or service: only MAM keeps the correlation, every
360 // other analytical solver sees the marginal only.
361 for (std::size_t i = 1; i <= sn.nstations && !t.has_map; ++i)
362 for (std::size_t r = 1; r <= sn.nclasses; ++r) {
363 const ProcessType p = sn.procid(i, r);
364 if (p == ProcessType::MAP || p == ProcessType::MMPP2) {
365 t.has_map = true;
366 break;
367 }
368 }
369
370 // Preemptive priority is a strictly narrower capability than HOL, so the
371 // two rank differently and are distinguished here rather than downstream.
372 bool preempt = false, psprio = false, hol = false;
373 for (const qn::Station<T>& s : sn.stations) {
374 if (s.sched == SchedStrategy::FCFSPRPRIO || s.sched == SchedStrategy::FCFSPIPRIO ||
375 s.sched == SchedStrategy::LCFSPRPRIO || s.sched == SchedStrategy::LCFSPIPRIO)
376 preempt = true;
377 if (s.sched == SchedStrategy::PSPRIO || s.sched == SchedStrategy::DPSPRIO ||
378 s.sched == SchedStrategy::GPSPRIO)
379 psprio = true;
380 if (s.sched == SchedStrategy::HOL || s.sched == SchedStrategy::LCFSPRIO ||
381 s.sched == SchedStrategy::SRPTPRIO)
382 hol = true;
383 }
384 if (preempt) t.prio = "preempt";
385 else if (psprio) t.prio = "ps";
386 else if (hol) t.prio = "hol";
387 return t;
388}
389
390// ---------------------------------------------------------------------------
391// The CTMC screen: ctmc_state_space_logsize.m
392// ---------------------------------------------------------------------------
393
394/**
395 * Worst-case log-size of the CTMC state space induced by `sn`: the SAME
396 * estimator SolverCTMC's memory gate uses, `mc::ctmc_state_space_logsize`
397 * (port of `ctmc_state_space_logsize.m`), not a copy of it.
398 *
399 * This used to be a second, older implementation, and it drifted: it priced a
400 * closed chain whose jobs switch class per class instead of as one population
401 * unit, had no factor for a cache's content or in-transit slot, and kept the
402 * pre-DP class-sequence bound for ordered buffers. So the AUTO screen and the
403 * CTMC gate could disagree on the same model (fix J1, 2026-10-16).
404 *
405 * `cutoff` negative selects the analyzer's own default for open and mixed
406 * models, `ceil(6000^(1/(M*K)))`.
407 */
408template <class T>
409double auto_ctmc_state_space_logsize(const qn::NetworkStruct<T>& sn, double cutoff = -1.0) {
411 o.cutoff = cutoff;
413}
414
415/**
416 * The cap `reachable_space_generator` enforces (solver_ctmc.h, `maxst`). It is
417 * this port's budget, standing in for the reference's memory model.
418 */
419const double kAutoCtmcStateCap = 3000000.0;
420
421template <class T>
422bool auto_ctmc_is_tractable(const qn::NetworkStruct<T>& sn, double cutoff = -1.0) {
423 return auto_ctmc_state_space_logsize(sn, cutoff) <= std::log(kAutoCtmcStateCap);
424}
425
426// ---------------------------------------------------------------------------
427// chooseSolverRanked.m
428// ---------------------------------------------------------------------------
429
430/**
431 * `Solver.supports(model)` for a candidate slot, tightened by the two
432 * method-level rules a flat feature set cannot express.
433 *
434 * `method name` is the method the slot would run: "" or "default" for the solver's
435 * own default, "exact" for the exactness-gated request.
436 */
437template <class T>
438bool auto_supports(AutoSolver s, const qn::NetworkStruct<T>& sn, const std::string& token) {
440 if (!auto_solver_is_available(s)) return false;
441 const std::string method = token.empty() ? std::string("default") : token;
442
443 qn::FeatureSet declared;
444 switch (s) {
445 case AutoSolver::MVA: declared = qn::mva_feature_set(method); break;
446 case AutoSolver::NC: declared = qn::nc_feature_set(method); break;
447 case AutoSolver::MAM: declared = qn::mam_feature_set(method); break;
448 // An UNQUALIFIED slot asks the static `SolverFLD.supports(model)`, which reads the class envelope;
449 // 'default' narrows HOL, GPS and LoadDependence away (chooseSolverRanked.m, SolverAUTO.m:166).
451 declared = token.empty() ? qn::fluid_class_feature_set() : qn::fluid_feature_set(method);
452 break;
453 case AutoSolver::SSA: declared = qn::ssa_feature_set(method); break;
454 case AutoSolver::CTMC: declared = qn::ctmc_feature_set(method); break;
455 // The LDES slot is gated like any other now that an engine can stand
456 // behind it: `auto_solver_is_available` has already answered whether
457 // this machine has one, and what remains is the reference's own
458 // declaration, which the client honours by forwarding the model to the
459 // engine that implements it.
460 case AutoSolver::LDES: declared = qn::ldes_feature_set(method); break;
461 }
463 return false;
464
465 if (method == "exact" && (s == AutoSolver::MVA || s == AutoSolver::NC)) {
466 if (!sn.has_product_form()) {
467 // solver_mva_oi is exact for the order-independent and
468 // pass-and-swap stations whatever the product-form test says; NC
469 // has no such exemption.
470 bool oi = false;
471 if (s == AutoSolver::MVA)
472 for (const qn::Station<T>& st : sn.stations)
473 if (st.sched == SchedStrategy::OI || st.sched == SchedStrategy::PAS) oi = true;
474 if (!oi) return false;
475 }
476 }
477 // The state-space screen prices the explicit generator, which only default/exact build. `mdd` enumerates no
478 // generator and is exempt, as SolverCTMC.supportsModelMethod exempts it in the reference (cftp lives in NC).
479 if (s == AutoSolver::CTMC && method != "mdd" && !auto_ctmc_is_tractable(sn)) return false;
480 return true;
481}
482
483/**
484 * True for a pure stochastic Petri net with an open class: every node is a
485 * Place, a Transition, a Source or a Sink, at least one is a Place, and some
486 * class is open, so some place may grow without bound. That is the shape the
487 * 'ispn' method of SolverMAM solves exactly (Haverkort 1998, ch. 17); its
488 * structural requirements are checked by spn_ispn when it runs, and a net that
489 * breaks one is refused as unsupported, so the delegate's retry list moves on.
490 *
491 * An explicit rule rather than a feature-set grant: `mam_feature_set` stays the
492 * queueing envelope, so `auto_supports(MAM, ...)` keeps refusing a Place model
493 * and only this rule routes one there. Mirrors MATLAB SolverAUTO.ispnPreferred,
494 * Java SolverAUTO.ispnPreferred and Python SolverAUTO._ispn_preferred.
495 */
496template <class T>
498 using qn::NodeType;
499 bool has_place = false;
500 for (const qn::NodeDef& nd : sn.nodes) {
501 if (nd.nodetype == NodeType::Place) has_place = true;
502 else if (nd.nodetype != NodeType::Transition && nd.nodetype != NodeType::Source &&
503 nd.nodetype != NodeType::Sink)
504 return false;
505 }
506 if (!has_place) return false;
507 for (const qn::JobClass& c : sn.classes)
508 if (std::isinf(c.population)) return true;
509 return false;
510}
511
512/** What a ranking resolved to, and what it had to skip to get there. */
515 /** Slots that outranked `solver` and have no engine in this port. */
516 std::vector<AutoSolver> skipped;
517 /** The method the choice was gated on: "" for the default, "exact". */
518 std::string method;
519};
520
521/**
522 * `chooseSolverRanked`: the first slot in ORDER that exists and accepts the
523 * model. Returns false when none qualifies, so the caller can fall back.
524 */
525template <class T>
526bool auto_ranked(const std::vector<AutoSolver>& order, const qn::NetworkStruct<T>& sn,
527 const std::string& token, AutoChoice& out) {
528 std::vector<AutoSolver> skipped;
529 for (std::size_t k = 0; k < order.size(); ++k) {
530 if (!auto_solver_is_available(order[k])) {
531 skipped.push_back(order[k]);
532 continue;
533 }
534 if (!auto_supports(order[k], sn, token)) continue;
535 out.solver = order[k];
536 out.skipped = skipped;
537 out.method = (token == "default") ? std::string() : token;
538 return true;
539 }
540 return false;
541}
542
543/**
544 * The candidate pool in slot order, filtered by `supports`: what the delegate
545 * retries through after the chosen solver fails (SolverAUTO.m:139-147).
546 */
547template <class T>
548std::vector<AutoSolver> auto_candidates(const qn::NetworkStruct<T>& sn) {
549 static const AutoSolver kSlots[] = {AutoSolver::MVA, AutoSolver::NC, AutoSolver::MAM,
552 std::vector<AutoSolver> out;
553 for (std::size_t i = 0; i < sizeof(kSlots) / sizeof(*kSlots); ++i)
554 if (auto_solver_is_available(kSlots[i]) && auto_supports(kSlots[i], sn, std::string()))
555 out.push_back(kSlots[i]);
556 return out;
557}
558
559// ---------------------------------------------------------------------------
560// chooseAvgSolverHeur.m, the Network arm
561// ---------------------------------------------------------------------------
562
563namespace detail {
564
565/**
566 * `avgOrder` in chooseAvgSolverHeur.m, arm for arm and in its order. The arms
567 * OVERLAP, so the first match wins and reordering silently rehomes models.
568 *
569 * `homogeneous_inf` is the penultimate arm's predicate, passed in because it
570 * needs the struct and this table does not otherwise.
571 */
572inline std::vector<AutoSolver> avg_order(const AutoTraits& t, bool homogeneous_inf) {
573 if (t.has_cache)
576 if (t.has_fcr) {
577 if (t.total_jobs <= 10.0) return {AutoSolver::NC, AutoSolver::CTMC, AutoSolver::LDES};
579 }
580 if (t.prio == "preempt")
582 if (t.prio == "ps") return {AutoSolver::CTMC, AutoSolver::LDES, AutoSolver::SSA};
583 if (t.has_map)
585 if (t.prio == "hol")
588 if (t.pop_per_chain > 30.0) return {AutoSolver::FLUID, AutoSolver::MVA, AutoSolver::NC};
589 // No exact solver was available at this population (the exact-first pass
590 // above tried), so keep the exact-leaning approximate order.
591 if (t.total_jobs > 0.0 && t.total_jobs <= kAutoExactPopulationMax)
593 if (homogeneous_inf) return {AutoSolver::MVA, AutoSolver::NC, AutoSolver::FLUID};
595}
596
597inline UnsupportedError no_solver(const std::string& what,
598 const std::vector<AutoSolver>& skipped) {
599 std::string msg = "SolverAUTO: no solver supports this model" + what;
600 if (!skipped.empty()) {
601 msg += " (the ranking preferred ";
602 for (std::size_t i = 0; i < skipped.size(); ++i) {
603 if (i) msg += ", ";
604 msg += auto_solver_name(skipped[i]);
605 }
606 msg += ", which this port does not build)";
607 }
608 return UnsupportedError(ErrorKind{"Model"}, msg);
609}
610
611} // namespace detail
612
613/**
614 * `chooseAvgSolverHeur`, the Network arm: exact first at small populations,
615 * then the trait-keyed ranking, then the whole pool in the global order.
616 *
617 * The INF branch of avgOrder consults `has_homogeneous_scheduling`, true when
618 * every station is a delay; see the header note.
619 */
620template <class T>
623 const AutoTraits t = auto_traits(sn);
624 AutoChoice out;
625
626 // A stochastic Petri net with an open class goes to the iSPN analyzer of
627 // SolverMAM, the one exact solver of an unbounded net (auto_ispn_preferred).
630 out.method = "ispn";
631 return out;
632 }
633
634 // Small populations: an approximation buys nothing there, so take an exact
635 // solver whenever one is available. The 'exact' method name is what makes this a
636 // claim rather than a preference -- MVA and NC reject it without a
637 // product-form solution, and CTMC is screened for a chain that fits.
638 if (t.total_jobs > 0.0 && t.total_jobs <= kAutoExactPopulationMax) {
639 const std::vector<AutoSolver> exact_order =
640 t.has_cache
641 ? std::vector<AutoSolver>{AutoSolver::NC, AutoSolver::MVA, AutoSolver::CTMC}
642 : std::vector<AutoSolver>{AutoSolver::MVA, AutoSolver::NC, AutoSolver::CTMC};
643 if (auto_ranked(exact_order, sn, "exact", out)) return out;
644 }
645
646 const std::vector<AutoSolver> order =
647 detail::avg_order(t, sn.has_homogeneous_scheduling(SchedStrategy::INF));
648 if (auto_ranked(order, sn, std::string(), out)) return out;
649
650 // Nothing in the ranked list is feasible: fall back to the whole pool in
651 // the global order rather than returning nothing.
652 const std::vector<AutoSolver> pool = {AutoSolver::MVA, AutoSolver::NC, AutoSolver::MAM,
655 if (auto_ranked(pool, sn, std::string(), out)) return out;
656 throw detail::no_solver("", pool);
657}
658
659template <class T>
663
664// ---------------------------------------------------------------------------
665// chooseSolverHeur.m, the Network arm
666// ---------------------------------------------------------------------------
667
668namespace detail {
669
670inline bool in_list(const std::string& m, const char* const* tab, std::size_t n) {
671 for (std::size_t i = 0; i < n; ++i)
672 if (m == tab[i]) return true;
673 return false;
674}
675
676/** The average-metric getters, which defer to the feature tree. */
677inline bool is_avg_method(const std::string& m) {
678 static const char* kAvg[] = {
679 "getAvgChainTable", "getAvgTputTable", "getAvgRespTTable", "getAvgUtilTable",
680 "getAvgSysTable", "getAvgNodeTable", "getAvgTable", "getAvgTableLayered", "getAvg",
681 "getAvgChain", "getAvgSys", "getAvgNode", "getAvgNodeChain", "getAvgArvRChain",
682 "getAvgQLenChain", "getAvgUtilChain", "getAvgRespTChain", "getAvgTputChain",
683 "getAvgSysRespT", "getAvgSysTput", "getAvgQLen", "getAvgUtil", "getAvgRespT",
684 "getAvgResidT", "getAvgWaitT", "getAvgTput", "getAvgArvR", "getAvgQLenTable",
685 "getAvgResidTChain", "getAvgNodeQLenChain", "getAvgNodeUtilChain",
686 "getAvgNodeRespTChain", "getAvgNodeResidTChain", "getAvgNodeTputChain",
687 "getAvgNodeArvRChain", "getAvgNodeChainTable", "getResults", "hasResults",
688 "getAvgHandles", "getTranHandles", "getAvgQLenHandles", "getAvgUtilHandles",
689 "getAvgRespTHandles", "getAvgTputHandles", "getAvgArvRHandles", "getAvgResidTHandles",
690 "getMethodFeatureSet", "supportsModelMethod", "isStochasticMethod", "libraries",
691 "showLibraryAttribution", "citations"};
692 return in_list(m, kAvg, sizeof(kAvg) / sizeof(*kAvg));
693}
694
695/** The ensemble getters, which exist for LayeredNetwork models only. */
696inline bool is_ensemble_method(const std::string& m) {
697 static const char* kEns[] = {"getEnsembleAvg", "getEnsembleAvgTables", "getSolver",
698 "setSolver", "getNumberOfModels", "getIteration",
699 "get_state", "set_state", "update_solver"};
700 return in_list(m, kEns, sizeof(kEns) / sizeof(*kEns));
701}
702
703inline bool is_cdf_method(const std::string& m) {
704 return m == "getCdfRespT" || m == "getCdfPassT" || m == "getPerctRespT";
705}
706
707inline bool is_tran_prob_method(const std::string& m) {
708 return m == "getTranProb" || m == "getTranProbSys" || m == "getTranProbAggr" ||
709 m == "getTranProbSysAggr";
710}
711
712inline bool is_prob_method(const std::string& m) {
713 return m == "getProb" || m == "getProbAggr" || m == "getProbSys" || m == "getProbSysAggr" ||
714 m == "getProbMarg" || m == "getProbNormConstAggr";
715}
716
717inline bool is_sample_method(const std::string& m) { return m == "sample" || m == "sampleSys"; }
718
719inline bool is_sample_aggr_method(const std::string& m) {
720 return m == "sampleAggr" || m == "sampleSysAggr";
721}
722
723inline bool is_cache_metric_method(const std::string& m) {
724 static const char* kTab[] = {"getAvgCacheTable", "getAvgCacheT", "getAvgItemTable",
725 "getAvgItemT", "cacheAvgT", "itemAvgT", "aCaT", "aIT"};
726 return in_list(m, kTab, sizeof(kTab) / sizeof(*kTab));
727}
728
729inline bool is_loss_metric_method(const std::string& m) {
730 static const char* kTab[] = {"getAvgLossTable", "getAvgLossT", "getAvgRegionLossTable",
731 "getAvgRegionLossT", "lossAvgT", "regionLossAvgT",
732 "aLT", "aRLT"};
733 return in_list(m, kTab, sizeof(kTab) / sizeof(*kTab));
734}
735
736inline bool is_orbit_metric_method(const std::string& m) {
737 static const char* kTab[] = {"getAvgOrbitTable", "getAvgOrbitT", "getAvgOrbit", "orbitAvgT",
738 "aOT"};
739 return in_list(m, kTab, sizeof(kTab) / sizeof(*kTab));
740}
741
742inline bool is_moment_method(const std::string& m) {
743 static const char* kTab[] = {"getMomentTable", "getMomentChainTable", "getMomentStationTable",
744 "getMomentT", "getMomentChainT", "getMomentStationT",
745 "momentT", "momentChainT", "momentStationT",
746 "mT", "mCT", "mST"};
747 return in_list(m, kTab, sizeof(kTab) / sizeof(*kTab));
748}
749
750inline bool is_sens_method(const std::string& m) {
751 static const char* kTab[] = {"getSensitivityTable", "getSensitivityT", "sensitivityT", "sT",
752 "supportsExactSensitivity"};
753 return in_list(m, kTab, sizeof(kTab) / sizeof(*kTab));
754}
755
756} // namespace detail
757
758/**
759 * `chooseNetworkSolver` in chooseSolverHeur.m: the getter names the metric
760 * family, the family names a ranking, and the average family alone consults the
761 * feature tree. A ranking that yields nothing falls back to the average
762 * heuristic, as the reference does, rather than refusing.
763 */
764template <class T>
765AutoChoice auto_choose_solver_heur(const qn::NetworkStruct<T>& sn, const std::string& method) {
767 if (detail::is_avg_method(method)) return auto_choose_avg_solver_ex(sn);
768 if (detail::is_ensemble_method(method))
769 throw InputError(ErrorKind{"Argument"}, "SolverAUTO: method '" + method +
770 "' is only available for LayeredNetwork models");
771
772 std::vector<AutoSolver> order;
773 if (method == "getTranAvg") {
775 } else if (detail::is_cdf_method(method)) {
776 // NC gives the exact passage-time distribution on FCFS product form;
777 // otherwise Fluid is the smooth approximation, then the simulators.
778 if (sn.has_homogeneous_scheduling(SchedStrategy::FCFS) && sn.has_product_form())
780 else
782 } else if (method == "getTranCdfPassT" || method == "getTranCdfRespT") {
784 } else if (detail::is_tran_prob_method(method)) {
785 order = {AutoSolver::CTMC};
786 } else if (detail::is_sample_method(method)) {
788 } else if (detail::is_sample_aggr_method(method)) {
790 } else if (detail::is_prob_method(method)) {
791 if (sn.has_product_form())
793 else
795 } else if (detail::is_cache_metric_method(method)) {
798 } else if (detail::is_loss_metric_method(method)) {
800 } else if (detail::is_orbit_metric_method(method)) {
802 } else if (detail::is_moment_method(method)) {
804 } else if (detail::is_sens_method(method)) {
806 } else {
808 }
809
810 AutoChoice out;
811 if (auto_ranked(order, sn, std::string(), out)) return out;
812 // No solver in the metric's ranking supports the model: the average
813 // heuristic is the floor.
815}
816
817/** `chooseSolverExact`: the ranking restricted to solvers that answer exactly. */
818template <class T>
819AutoChoice auto_choose_solver_exact(const qn::NetworkStruct<T>& sn, const std::string& method) {
820 const AutoTraits t = auto_traits(sn);
821 std::vector<AutoSolver> order;
822 if (detail::is_tran_prob_method(method) || detail::is_cdf_method(method) ||
823 method == "getTranCdfPassT" || method == "getTranCdfRespT" || method == "getTranAvg") {
824 order = {AutoSolver::CTMC};
825 } else if (detail::is_sample_method(method) || detail::is_sample_aggr_method(method)) {
826 // A sample path is exact in distribution, not in the mean.
828 } else if (detail::is_prob_method(method)) {
830 else order = {AutoSolver::CTMC};
831 } else {
834 else
836 // chooseSolverExact.m: an open class leaves CTMC no finite chain to solve exactly, and the exact
837 // open product-form answer is MVA's, so it leads the ranking there.
838 bool any_open = false;
839 for (const qn::JobClass& c : sn.classes)
840 if (std::isinf(c.population)) any_open = true;
841 if (any_open) {
842 order.erase(std::remove(order.begin(), order.end(), AutoSolver::CTMC), order.end());
843 if (t.is_product_form) order.insert(order.begin(), AutoSolver::MVA);
844 }
845 }
846 AutoChoice out;
847 if (auto_ranked(order, sn, "exact", out)) return out;
848 throw detail::no_solver(" exactly for method '" + method +
849 "'; use the default heuristic for the approximation",
850 order);
851}
852
853/** `chooseSolverSim`: the ranking restricted to simulators. */
854template <class T>
855AutoChoice auto_choose_solver_sim(const qn::NetworkStruct<T>& sn, const std::string& method) {
856 const std::vector<AutoSolver> order =
857 detail::is_sample_method(method)
858 ? std::vector<AutoSolver>{AutoSolver::SSA, AutoSolver::LDES}
859 : std::vector<AutoSolver>{AutoSolver::LDES, AutoSolver::SSA};
860 AutoChoice out;
861 if (auto_ranked(order, sn, std::string(), out)) return out;
862 throw detail::no_solver(" by simulation", order);
863}
864
865/**
866 * `chooseSolver`: the selection mode picks the ranking, and every mode but the
867 * two learned ones keeps the heuristic as its floor.
868 */
869template <class T>
871 AutoMode mode) {
872 AutoChoice out;
873 switch (mode) {
874 case AutoMode::EXACT: return auto_choose_solver_exact(sn, method);
875 case AutoMode::SIM: return auto_choose_solver_sim(sn, method);
876 case AutoMode::FAST:
877 // Cheapest analytical answer; the heuristic is the floor for
878 // metrics no mean-value solver can serve.
880 sn, std::string(), out))
881 return out;
882 return auto_choose_solver_heur(sn, method);
884 // A smooth or matrix-analytic answer preferred over the fastest.
887 sn, std::string(), out))
888 return out;
889 return auto_choose_solver_heur(sn, method);
890 case AutoMode::HEUR: break;
891 }
892 return auto_choose_solver_heur(sn, method);
893}
894
895/** The heuristic Network arm, by getter name. */
896template <class T>
897AutoSolver auto_choose_solver(const qn::NetworkStruct<T>& sn, const std::string& method) {
898 return auto_choose_solver_heur(sn, method).solver;
899}
900
901/**
902 * `delegate`'s proposed order: the chosen solver, then every feasible candidate
903 * in slot order. Duplicates are dropped, since the reference retries the chosen
904 * solver only once in practice.
905 */
906template <class T>
907std::vector<AutoSolver> auto_proposed_solvers(const qn::NetworkStruct<T>& sn,
908 const std::string& method, AutoMode mode) {
909 const AutoChoice chosen = auto_choose_solver_mode(sn, method, mode);
910 std::vector<AutoSolver> out(1, chosen.solver);
911 const std::vector<AutoSolver> cand = auto_candidates(sn);
912 for (std::size_t i = 0; i < cand.size(); ++i)
913 if (std::find(out.begin(), out.end(), cand[i]) == out.end()) out.push_back(cand[i]);
914 return out;
915}
916
917// ---------------------------------------------------------------------------
918// The LayeredNetwork and Environment arms
919// ---------------------------------------------------------------------------
920
923 std::vector<AutoLayered> skipped;
924};
925
926namespace detail {
927
928inline bool layered_ranked(const std::vector<AutoLayered>& order, AutoLayeredChoice& out) {
929 std::vector<AutoLayered> skipped;
930 for (std::size_t k = 0; k < order.size(); ++k) {
931 if (!auto_layered_is_available(order[k])) {
932 skipped.push_back(order[k]);
933 continue;
934 }
935 out.solver = order[k];
936 out.skipped = skipped;
937 return true;
938 }
939 return false;
940}
941
942} // namespace detail
943
944/**
945 * `chooseLayeredSolver` plus the LayeredNetwork arm of `chooseAvgSolverHeur`.
946 *
947 * There is no feature-set gate on this path: the reference gates a layered
948 * candidate with `SolverLN.supports(model)`, a LayeredNetwork-level check this
949 * port does not carry, so availability is the only screen. A cache task is what
950 * inverts the analytical order -- the cache layer is where NC beats MVA.
951 */
952inline AutoLayeredChoice auto_choose_layered_solver(const std::string& method,
953 bool has_cache_task,
954 AutoMode mode = AutoMode::HEUR) {
956 std::vector<AutoLayered> order;
957 if (mode == AutoMode::EXACT) {
958 // No layered solver is exact; NC layers are the closest available.
960 } else if (mode == AutoMode::SIM) {
961 // lqsim is the layered simulator; the LN solvers are the fallback.
963 } else if (method == "getTranAvg" || detail::is_cdf_method(method) ||
964 method == "getTranCdfPassT" || method == "getTranCdfRespT") {
966 } else if (detail::is_sample_method(method) || detail::is_sample_aggr_method(method)) {
968 } else if (detail::is_prob_method(method) || detail::is_tran_prob_method(method)) {
970 } else if (detail::is_ensemble_method(method)) {
973 } else if (has_cache_task) {
974 // The LayeredNetwork arm of chooseAvgSolverHeur, which returns the NC
975 // layer solver outright on a cache task.
977 return out;
978 } else {
981 }
982 if (has_cache_task && mode != AutoMode::SIM) {
983 // A layered cache model needs the NC layer solver whichever metric was
984 // asked for: it is the only one that solves the cache layer.
985 std::vector<AutoLayered> promoted(1, AutoLayered::LN_NC);
986 for (std::size_t i = 0; i < order.size(); ++i)
987 if (order[i] != AutoLayered::LN_NC) promoted.push_back(order[i]);
988 order = promoted;
989 }
990 if (detail::layered_ranked(order, out)) return out;
991 throw UnsupportedError(ErrorKind{"Method"},
992 "SolverAUTO: no LayeredNetwork solver in this port serves method '" + method +
993 "'; the reference's ranking is served by SolverLQNS, which shells out to an external "
994 "binary this port does not wrap");
995}
996
999 std::vector<AutoEnv> skipped;
1000 /**
1001 * `delegate.m`'s proposed list: the chosen ensemble, then every candidate in
1002 * slot order (MVA, NC, FLUID) not already on it. The mean-field coupling
1003 * refuses an MVA or NC ensemble for want of a transient, so an EXACT run,
1004 * ranked [NC, MVA], still ends on the fluid ensemble as the reference's does.
1005 */
1006 std::vector<AutoEnv> retry;
1007};
1008
1009/**
1010 * The Environment arm of `chooseSolverHeur` / `chooseSolverExact` /
1011 * `chooseSolverSim`.
1012 *
1013 * Fluid leads the heuristic ranking because the blending method is transient:
1014 * it restarts each stage from the mean state the previous one left, and an
1015 * inner solver without a transient analysis is refused by that coupling.
1016 */
1017inline AutoEnvChoice auto_choose_env_solver(const std::string& method,
1018 AutoMode mode = AutoMode::HEUR) {
1019 std::vector<AutoEnv> order;
1020 if (mode == AutoMode::EXACT) order = {AutoEnv::ENV_NC, AutoEnv::ENV_MVA};
1023
1024 AutoEnvChoice out;
1025 std::vector<AutoEnv> skipped;
1026 for (std::size_t k = 0; k < order.size(); ++k) {
1027 if (!auto_env_is_available(order[k])) {
1028 skipped.push_back(order[k]);
1029 continue;
1030 }
1031 out.solver = order[k];
1032 out.skipped = skipped;
1033 out.retry.push_back(order[k]);
1035 for (std::size_t j = 0; j < 3; ++j)
1036 if (slots[j] != order[k] && auto_env_is_available(slots[j]))
1037 out.retry.push_back(slots[j]);
1038 return out;
1039 }
1040 throw UnsupportedError(ErrorKind{"Method"},
1041 "SolverAUTO: no Environment stage solver in this port serves method '" + method + "'");
1042}
1043
1044} // namespace autosolver
1045} // namespace line
1046
1047#endif // LINE_SOLVERS_AUTO_SOLVER_AUTO_H
InputError(const std::string &what)
Definition error.h:105
UnsupportedError(const std::string &what)
Definition error.h:119
A subset of the registry: MATLAB's SolverFeatureSet, whose list is a flag per field.
A network plus its refreshed NetworkStruct.
Worst-case log-size of the CTMC state space induced by a NetworkStruct.
The exception types the port throws.
Where the LDES engine is, and whether this machine can run it.
Is a usable lqns installed on this machine?
bool auto_ispn_preferred(const qn::NetworkStruct< T > &sn)
True for a pure stochastic Petri net with an open class: every node is a Place, a Transition,...
bool auto_supports(AutoSolver s, const qn::NetworkStruct< T > &sn, const std::string &token)
Solver.supports(model) for a candidate slot, tightened by the two method-level rules a flat feature s...
bool auto_layered_is_available(AutoLayered s)
Every LN layer engine the ranking names is one --layer-solver takes (mva, nc, fluid,...
AutoEnvChoice auto_choose_env_solver(const std::string &method, AutoMode mode=AutoMode::HEUR)
The Environment arm of chooseSolverHeur / chooseSolverExact / chooseSolverSim.
AutoSolver
The Network candidate slots, in the reference's slot order (SolverAUTO.m:41-50), which is also the or...
bool auto_ctmc_is_tractable(const qn::NetworkStruct< T > &sn, double cutoff=-1.0)
double auto_ctmc_state_space_logsize(const qn::NetworkStruct< T > &sn, double cutoff=-1.0)
Worst-case log-size of the CTMC state space induced by sn: the SAME estimator SolverCTMC's memory gat...
AutoChoice auto_choose_solver_exact(const qn::NetworkStruct< T > &sn, const std::string &method)
chooseSolverExact: the ranking restricted to solvers that answer exactly.
AutoSolver auto_choose_solver(const qn::NetworkStruct< T > &sn, const std::string &method)
The heuristic Network arm, by getter name.
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.
AutoTraits auto_traits(const qn::NetworkStruct< T > &sn)
bool auto_solver_is_available(AutoSolver s)
True when this port has an engine behind the slot at all.
bool auto_is_selection_intent(const std::string &token)
SolverAUTO.selectionIntents, less 'bound'.
const double kAutoExactPopulationMax
Population at or below which an exact solver is preferred (EXACT_POPULATION_MAX).
AutoSolver auto_choose_avg_solver(const qn::NetworkStruct< T > &sn)
AutoChoice auto_choose_avg_solver_ex(const qn::NetworkStruct< T > &sn)
chooseAvgSolverHeur, the Network arm: exact first at small populations, then the trait-keyed ranking,...
AutoLayeredChoice auto_choose_layered_solver(const std::string &method, bool has_cache_task, AutoMode mode=AutoMode::HEUR)
chooseLayeredSolver plus the LayeredNetwork arm of chooseAvgSolverHeur.
AutoMode auto_mode_of_token(const std::string &token)
const char * auto_env_stage_solver(AutoEnv s)
The EnvOptions::stage_solver (and --stage-solver) name of a candidate ensemble.
const double kAutoCtmcStateCap
The cap reachable_space_generator enforces (solver_ctmc.h, maxst).
AutoChoice auto_choose_solver_sim(const qn::NetworkStruct< T > &sn, const std::string &method)
chooseSolverSim: the ranking restricted to simulators.
bool auto_env_is_available(AutoEnv)
All three candidate ensembles are built here (EnvOptions::stage_solver = fluid, mva,...
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...
const char * auto_env_name(AutoEnv s)
AutoChoice auto_choose_solver_heur(const qn::NetworkStruct< T > &sn, const std::string &method)
chooseNetworkSolver in chooseSolverHeur.m: the getter names the metric family, the family names a ran...
bool auto_ranked(const std::vector< AutoSolver > &order, const qn::NetworkStruct< T > &sn, const std::string &token, AutoChoice &out)
chooseSolverRanked: the first slot in ORDER that exists and accepts the model.
AutoEnv
The Environment candidate slots (SolverAUTO.m:58-60).
AutoLayered
The LayeredNetwork candidate slots (SolverAUTO.m:52-56).
AutoMode
The selection intents of SolverAUTO.selectionIntents, less 'bound'.
const char * auto_layered_name(AutoLayered s)
The layered names are the CLI's own tokens, because that is what the choice is spent on: ln....
SchedStrategy
Scheduling disciplines, with the values of MATLAB SchedStrategy.
Definition lang_types.h:194
ProcessType
Distribution kinds, with the values of MATLAB ProcessType.
Definition lang_types.h:524
NodeType
Node kinds, with the values of MATLAB NodeType.
Definition lang_types.h:345
bool ldes_is_available()
True when this machine can run the engine at all, by either image.
Definition ldes_probe.h:253
bool lqns_is_available()
True when lqns is installed AND is a release this port speaks.
Definition lqns_probe.h:69
double ctmc_state_space_logsize(const qn::NetworkStruct< T > &sn, const CtmcSizeOptions &opt=CtmcSizeOptions())
Worst-case log state-space size of sn.
FeatureSet ldes_feature_set(const std::string &)
SolverLDES.getFeatureSet, transcribed WHOLE.
FeatureSet fluid_feature_set(const std::string &method)
FeatureSet ssa_feature_set(const std::string &method)
FeatureSet used_lang_features(const NetworkStruct< T > &sn)
FeatureSet nc_feature_set(const std::string &method)
SolverNC.getFeatureSet, 48 names, transcribed unchanged.
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.
Conservation laws of a layered queueing network, enumerated from its structure.
Definition aoi_dist2ph.h:51
SolverSSA SSA
Definition solver.h:750
SolverMAM MAM
Definition solver.h:753
SolverLDES LDES
Definition solver.h:755
SolverNC NC
Definition solver.h:748
SolverCTMC CTMC
Definition solver.h:749
SolverMVA MVA
Definition solver.h:747
A queueing network and its refreshed NetworkStruct.
The DECLARED side of the gate: one feature set per solver.
The <kind> part of a LINE:<category>:<kind> identifier (see _kb/17-error-vocabulary....
Definition error.h:37
What a ranking resolved to, and what it had to skip to get there.
std::string method
The method the choice was gated on: "" for the default, "exact".
std::vector< AutoSolver > skipped
Slots that outranked solver and have no engine in this port.
std::vector< AutoEnv > retry
delegate.m's proposed list: the chosen ensemble, then every candidate in slot order (MVA,...
std::vector< AutoEnv > skipped
std::vector< AutoLayered > skipped
resolveMethodToken, minus the unqualified-algorithm-name arm.
std::string submethod
the method handed to the family, "default" when bare
std::string family
empty when is_intent
The structural traits the rankings are keyed on.
std::string prio
"none", "preempt", "ps" or "hol", in the reference's own precedence.
Options the estimator reads; only the cutoff matters.
double cutoff
< 0 or non-finite = not given, take the solver default
One job class of the network.
double population
infinite for an open class
A node of the network.
One station of the network.
SchedStrategy sched