![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
The SolverAUTO chooser: which solver a model is handed to. More...
#include <algorithm>#include <cmath>#include <cstddef>#include <string>#include <vector>#include "line/lang/qn/network_struct.h"#include "line/lang/qn/solver_feature_sets.h"#include "line/solvers/wrappers/ldes/ldes_probe.h"#include "line/solvers/wrappers/lqns/lqns_probe.h"#include "line/util/error.h"Go to the source code of this file.
Classes | |
| struct | line::autosolver::AutoToken |
| resolveMethodToken, minus the unqualified-algorithm-name arm. More... | |
| struct | line::autosolver::AutoTraits |
| The structural traits the rankings are keyed on. More... | |
| struct | line::autosolver::AutoChoice |
| What a ranking resolved to, and what it had to skip to get there. More... | |
| struct | line::autosolver::AutoLayeredChoice |
| struct | line::autosolver::AutoEnvChoice |
Namespaces | |
| namespace | line |
| namespace | line::autosolver |
Functions | |
| const char * | line::autosolver::auto_solver_name (AutoSolver s) |
| const char * | line::autosolver::auto_layered_name (AutoLayered s) |
| The layered names are the CLI's own tokens, because that is what the choice is spent on: ln.comom runs the layers under NC and ln.mva under MVA. | |
| const char * | line::autosolver::auto_env_name (AutoEnv s) |
| bool | line::autosolver::auto_solver_is_available (AutoSolver s) |
| True when this port has an engine behind the slot at all. | |
| bool | line::autosolver::auto_layered_is_available (AutoLayered s) |
| The LN layer engines are the four --layer-solver takes (mva, nc, fluid, ssa), so there is no MAM-layer engine to select. | |
| bool | line::autosolver::auto_env_is_available (AutoEnv s) |
| SolverENV solves a stage with the fluid analyzer under every coupling but the state-vector one, which uniformizes a CTMC; neither an MVA nor an NC stage solver exists here, so those two slots have no engine. | |
| bool | line::autosolver::auto_is_selection_intent (const std::string &token) |
| SolverAUTO.selectionIntents, less 'bound'. | |
| AutoMode | line::autosolver::auto_mode_of_token (const std::string &token) |
| std::string | line::autosolver::auto_family_alias (const std::string &name) |
| SolverAUTO.familyAlias: the canonical family of a method name, or "" when the method name names none. | |
| AutoToken | line::autosolver::auto_resolve_token (const std::string &raw) |
| template<class T> | |
| AutoTraits | line::autosolver::auto_traits (const qn::NetworkStruct< T > &sn) |
| template<class T> | |
| double | line::autosolver::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, summed in log space over the reference's four factors: job placements (stars and bars, per class, open classes truncated at the cutoff, over the stations that keep no ordered buffer), the class-sequence multiplicity of every order-preserving buffer, service phases, and one routing pointer per round-robin (node, class). | |
| template<class T> | |
| bool | line::autosolver::auto_ctmc_is_tractable (const qn::NetworkStruct< T > &sn, double cutoff=-1.0) |
| template<class T> | |
| bool | line::autosolver::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 set cannot express. | |
| template<class T> | |
| bool | line::autosolver::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. | |
| template<class T> | |
| std::vector< AutoSolver > | line::autosolver::auto_candidates (const qn::NetworkStruct< T > &sn) |
| The candidate pool in slot order, filtered by supports: what the delegate retries through after the chosen solver fails (SolverAUTO.m:139-147). | |
| template<class T> | |
| AutoChoice | line::autosolver::auto_choose_avg_solver_ex (const qn::NetworkStruct< T > &sn) |
| chooseAvgSolverHeur, the Network arm: exact first at small populations, then the trait-keyed ranking, then the whole pool in the global order. | |
| template<class T> | |
| AutoSolver | line::autosolver::auto_choose_avg_solver (const qn::NetworkStruct< T > &sn) |
| template<class T> | |
| AutoChoice | line::autosolver::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 ranking, and the average family alone consults the feature tree. | |
| template<class T> | |
| AutoChoice | line::autosolver::auto_choose_solver_exact (const qn::NetworkStruct< T > &sn, const std::string &method) |
| chooseSolverExact: the ranking restricted to solvers that answer exactly. | |
| template<class T> | |
| AutoChoice | line::autosolver::auto_choose_solver_sim (const qn::NetworkStruct< T > &sn, const std::string &method) |
| chooseSolverSim: the ranking restricted to simulators. | |
| template<class T> | |
| AutoChoice | line::autosolver::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 heuristic as its floor. | |
| template<class T> | |
| AutoSolver | line::autosolver::auto_choose_solver (const qn::NetworkStruct< T > &sn, const std::string &method) |
| The heuristic Network arm, by getter name. | |
| template<class T> | |
| std::vector< AutoSolver > | line::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. | |
| AutoLayeredChoice | line::autosolver::auto_choose_layered_solver (const std::string &method, bool has_cache_task, AutoMode mode=AutoMode::HEUR) |
| chooseLayeredSolver plus the LayeredNetwork arm of chooseAvgSolverHeur. | |
| AutoEnvChoice | line::autosolver::auto_choose_env_solver (const std::string &method, AutoMode mode=AutoMode::HEUR) |
| The Environment arm of chooseSolverHeur / chooseSolverExact / chooseSolverSim. | |
Variables | |
| const double | line::autosolver::kAutoExactPopulationMax = 5.0 |
| Population at or below which an exact solver is preferred (EXACT_POPULATION_MAX). | |
| const double | line::autosolver::kAutoCtmcStateCap = 3000000.0 |
| The cap reachable_space_generator enforces (solver_ctmc.h, maxst). | |
The SolverAUTO chooser: which solver a model is handed to.
WHAT THIS PORTS. matlab/src/solvers/AUTO/@@SolverAUTO/ selects in two layers, and both are here:
solverTraits.m computes the structural traits ONCE per call, so that the choosers stay tables of rankings rather than a second place where model inspection is written. auto_traits is that function.
chooseSolverRanked.m walks a list of candidate slots and returns the FIRST that exists and whose feature set accepts the model, or nothing, so the caller can fall back rather than hand an infeasible solver to the delegate. auto_ranked is that function, and it is what makes every ranking below a preference rather than a claim.
chooseSolverHeur.m / chooseAvgSolverHeur.m / chooseSolverExact.m / chooseSolverSim.m and the fast and accurate arms of chooseSolver.m are the rankings themselves, ported list for list, in the reference's own order. The Network, LayeredNetwork and Environment arms all have a counterpart here.
THE FEATURE-SET GATE IS THE WHOLE POINT OF THE REWRITE. The previous port transcribed the SUPERSEDED feature cascade (population thresholds 30/10/5 over a first-match tree) and consulted no feature set at all, so it named a solver that could then refuse the model. Here auto_supports asks the same question Solver.supports asks – is every feature the model uses declared by that solver? – from used_lang_features and the per-solver sets in solver_feature_sets.h, and the answer decides.
TWO GATES ARE FINER THAN A FLAT FEATURE SET, and the reference states both outside getFeatureSet for that reason:
'exact' needs a product-form solution (SolverMVA.supportsExactness, SolverNC.supportsModelMethod), with the order-independent and pass-and-swap stations exempt for MVA because solver_mva_oi is exact for them regardless. Reproduced in auto_supports.
CTMC needs its chain to FIT. The reference screens the slot with SolverCTMC.isStateSpaceTractable, which prices the worst-case state space against host memory through a profiled power law. This port has no such calibration and its generator has a hard cap instead, so the screen here compares the SAME estimator – ctmc_state_space_logsize, ported factor for factor – against that cap. The gate is therefore host-independent where the reference's is host-dependent: the estimate is identical, the budget it is compared to is this port's own.
AN ABSENT ENGINE IS SKIPPED, AND SAID SO. In the reference an unavailable candidate is an empty slot and chooseSolverRanked skips it silently; that is how SolverLQNS behaves when the binary is not installed. The MAM layer engine is absent from this port in exactly that sense, and LDES and LQNS are absent only where their engines are not installed, so all three are skipped the same way – but skipping changes which engine answers, so every choice carries skipped, the slots that outranked the winner and had no engine behind them. The CLI prints it. Silence there would report the second choice as if it had been the first.
JMT IS NOT A CANDIDATE AT ALL, in the reference either (SolverAUTO.m:45-47): LDES subsumes its feature set, so automatic selection never dispatches to the external simulator and SolverJMT stays reachable only through an explicit token. The enum has no JMT slot for that reason.
THE HOMOGENEOUS-SCHEDULING PREDICATE COLLAPSES. has_homogeneous_scheduling reproduces the reference's findstring defect and degenerates to nstations == 1 for every discipline (see NetworkStruct). Only the response-time-CDF branch and one avgOrder arm consult it now, and both are written as the reference writes them.
Definition in file solver_auto.h.