![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
Service demands and visit ratios of an isolated subnetwork, from the stochastic complement of its routing matrix. More...
#include <cmath>#include <cstddef>#include <vector>#include "line/num/number.h"#include "line/util/error.h"#include "line/util/linalg.h"#include "line/util/lu.h"#include "line/util/matrix.h"Go to the source code of this file.
Classes | |
| struct | line::fes::FesIsolated< T > |
| Demands and visit ratios of the isolated subnetwork. More... | |
Namespaces | |
| namespace | line |
| namespace | line::fes |
Functions | |
| template<class T> | |
| FesIsolated< T > | line::fes::fes_build_isolated (const Matrix< T > &rates, const Matrix< T > &stochCompS) |
| Build the isolated subnetwork's demands and visit ratios. | |
Service demands and visit ratios of an isolated subnetwork, from the stochastic complement of its routing matrix.
Templated port of matlab/src/api/fes/fes_build_isolated.m. Given the stochastic complement S of the routing chain restricted to a subset of stations, the per-class visit ratios are the stationary distribution of the embedded DTMC of that class,
v_k P_k = v_k, sum_i v_k(i) = 1,
and the demands follow as L(i,k) = v_k(i) / rate(i,k), renormalized so that the first station of the subset is visited once, which is the MVA convention the flow-equivalent-server construction expects.
THE sn DEPENDENCY IS LIFTED INTO THE SIGNATURE. The MATLAB entry point takes (sn, subsetIndices, stochCompS) and opens with a loop that plucks five fields out of sn – nclasses, stationToNode, nodetype, nservers, rates – to produce the per-station server counts, the delay flags and the service rates of the subset. Nothing after that loop reads sn, and the routing already arrives as a plain matrix argument. The extraction is therefore not part of the algorithm: this port takes the extracted quantities directly, in the same spirit as npfqn_sqd.
Note in particular that mi and isDelay are PURE PASS-THROUGH in the reference: they are assembled from sn and returned, and no later line reads them. They are not arguments here for that reason – a caller that wants them holds them already. The numeric core needs only the service rates and the stochastic complement.
INDEXING. stochCompS is indexed (station-1)*K + class over the SUBSET, so it is (M_sub K x M_sub K); the reference forms it that way and indexes it with the subset position i, not the original station id. Its class-k block is read at rows and columns (i-1)*K + k.
ARITHMETIC. Exact at Rational. The stationary distribution is obtained from the singular system (I - P_k' + e e'/M) x = e/M, one linear solve per class, which is a finite sequence of field operations; there is no iteration and no tolerance in the solve itself. The two guards that DO carry a tolerance are reproduced from the reference and are structural rather than numerical: a row of P_k whose sum is below FineTol = 1e-8 is treated as "no routing defined" and made a self-loop, and a row whose sum differs from one by more than FineTol is renormalized. At Rational a caller supplying an exactly stochastic complement never reaches either branch.
DIVERGENCE, stated because it changes which inputs take the fallback path. The reference guards the solve with rank(A) == M_sub and substitutes the uniform distribution when the rank is deficient. A rank test is a singular value decomposition, which is double-only in this tree and has no exact instantiation (util/eig.h documents why). The port instead attempts the solve and takes the same uniform fallback when the factorization finds an exactly zero pivot. The two agree on every non-degenerate input: A is nonsingular precisely when the class-k chain has a unique stationary distribution, which is when the solve succeeds. They can differ only for a matrix that is numerically rank deficient yet still factorizable, where the reference falls back and the port returns the (ill-conditioned) solve; that is the direction that preserves information rather than discarding it.
Definition in file fes_build_isolated.h.