![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
The language-feature gate: what a MODEL uses against what a SOLVER declares. More...
#include <cmath>#include <cstddef>#include <algorithm>#include <initializer_list>#include <sstream>#include <string>#include <vector>#include "line/lang/lang_types.h"#include "line/lang/qn/network_struct.h"#include "line/util/error.h"Go to the source code of this file.
Classes | |
| class | line::qn::FeatureSet |
| A subset of the registry: MATLAB's SolverFeatureSet, whose list is a flag per field. More... | |
| struct | line::qn::SupportResult |
| The outcome of the gate: the verdict, the offending features, the message. More... | |
Namespaces | |
| namespace | line |
| namespace | line::qn |
Macros | |
| #define | LINE_QN_FEATURE_LIST(X) |
| SolverFeatureSet.fields, in its order, as an X-list. | |
| #define | LINE_QN_FEATURE_ENUM(id) |
| #define | LINE_QN_FEATURE_NAME(id) |
Enumerations | |
| enum class | line::qn::Feature : int { line::qn::COUNT } |
| One language feature. More... | |
Functions | |
| constexpr std::size_t | line::qn::feature_count () |
| The number of registered features, MATLAB numel(SolverFeatureSet.fields). | |
| const char * | line::qn::feature_name (Feature f) |
| The canonical registry name, byte for byte the MATLAB field name. | |
| std::string | line::qn::feature_phrase (Feature f) |
| A human-readable phrase for the reason string, e.g. | |
| Feature | line::qn::feature_generalization (Feature f) |
| The registry name a specialization falls back to when it is not declared. | |
| SupportResult | line::qn::feature_set_supports (const std::string &solver, const FeatureSet &declared, const FeatureSet &used) |
| SolverFeatureSet.supports: is every feature the model uses declared? | |
| Feature | line::qn::feature_of_process (ProcessType p) |
| The feature name of a distribution, MATLAB serviceProcess{r}{3}.name. | |
| Feature | line::qn::feature_of_sched (SchedStrategy s) |
| SchedStrategy.toFeature. | |
| Feature | line::qn::feature_of_routing (RoutingStrategy r) |
| RoutingStrategy.toFeature. | |
| Feature | line::qn::feature_of_replacement (ReplacementStrategy s) |
| ReplacementStrategy.toFeature. | |
| Feature | line::qn::feature_of_server_section (SchedStrategy s) |
| The SERVER section a Queue gets for a discipline, MATLAB Queue.m:79-108. | |
| template<class T> | |
| bool | line::qn::has_binding_capacity (const NetworkStruct< T > &sn) |
| getUsedLangFeatures: the features the MODEL uses. | |
| template<class T> | |
| FeatureSet | line::qn::used_lang_features (const NetworkStruct< T > &sn) |
| template<class T> | |
| void | line::qn::feature_gate (const std::string &solver, const FeatureSet &declared, const NetworkStruct< T > &sn, const std::string &requested_method="", const std::string &resolved_method="") |
| runAnalyzerChecks: refuse a model the solver does not declare, by name. | |
| std::string | line::qn::capacity_str (double v) |
| g for a capacity, so the message reads 2 and not 2.000000. | |
| std::string | line::qn::capacity_fallback_advice (bool is_open_class) |
| NetworkSolver.checkBindingCapacity (NetworkSolver.m:1172-1228): the shared structural gate for finite station capacity (setCapacity) and finite per-class buffers (classCap), used by the product-form solvers. | |
| template<class T> | |
| std::string | line::qn::binding_capacity_reason (const std::string &solver, const NetworkStruct< T > &sn) |
| The refusal check_binding_capacity raises, as a string, or empty when no buffer binds. | |
| template<class T> | |
| void | line::qn::check_binding_capacity (const std::string &solver, const NetworkStruct< T > &sn) |
The language-feature gate: what a MODEL uses against what a SOLVER declares.
SCOPE. This is the port of three MATLAB pieces that together form the single universal check every runAnalyzer performs before it computes anything:
matlab/src/solvers/SolverFeatureSet.m the canonical name registry and the SUPPORTS comparison matlab/src/lang/@MNetwork/getUsedLangFeatures.m the USED side matlab/src/solvers/@NetworkSolver/NetworkSolver.m:169-216 runAnalyzerChecks, which raises line_error naming the offending feature
WHY IT EXISTS. Without it, every refusal is ad hoc and per solver, and the constructs nobody wrote a refusal for are neither handled nor rejected: the solver returns numbers for a model the user did not describe. A finite capacity region silently ignored is not a small error, it is a different model. A generic "unsupported model" is nearly as bad, because the user cannot tell which construct to remove, so supports returns the offending FEATURES and a reason naming them.
THE ASYMMETRY THAT MATTERS. A feature DECLARED but not implemented is worse than one left undeclared: the undeclared one produces a clean refusal, the over-declared one produces a wrong number. So a C++ solver's declared set is what its C++ code actually handles, never a transcription of the MATLAB set.
WHAT THE REGISTRY IS FOR. Feature lists every name in SolverFeatureSet.fields, including names this port can never emit. That is deliberate and is the reference's own convention: SUPPORTS iterates the registry, so a capability name MISSING from the registry is invisible to the gate and passes as if the capability were absent. Keeping the registry complete keeps that failure mode out.
WHAT NetworkStruct CANNOT EXPRESS. used_lang_features derives each feature from a field that exists. Where MATLAB has a feature and NetworkStruct has no field for it, the feature is NEVER emitted, and that is recorded by name at the point where it would have been derived rather than faked from a proxy. The list is SetupDelayOff, Reneging, Balking, QueueingPlace and CacheRetrieval's MATLAB-only cousins; see the comments in used_lang_features. Breakdown LEFT that list on 2026-08-15, when NetworkStruct::breakdownparam gave it a field to be derived from.
Definition in file feature_set.h.
| #define LINE_QN_FEATURE_ENUM | ( | id | ) |
Definition at line 290 of file feature_set.h.
| #define LINE_QN_FEATURE_LIST | ( | X | ) |
SolverFeatureSet.fields, in its order, as an X-list.
The order is the reference's and is kept so that the two lists can be diffed entry by entry; supports reports in this order too, which makes the reason string reproducible.
Definition at line 80 of file feature_set.h.
Referenced by line::qn::feature_name().
| #define LINE_QN_FEATURE_NAME | ( | id | ) |
Referenced by line::qn::feature_name().