![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
Smith Queue Decomposition (SQD): approximate MVA for closed networks under Blocking-After-Service (manufacturing / transfer blocking). More...
#include <cmath>#include <cstddef>#include <limits>#include <string>#include <vector>#include "line/num/number.h"#include "line/util/error.h"#include "line/util/matrix.h"Go to the source code of this file.
Classes | |
| struct | line::npfqn::SqdResult< T > |
| Return value of npfqn_sqd, mirroring [X, Q, U, R]. More... | |
| struct | line::npfqn::SqdOptions< T > |
| The four option switches of the reference, with its defaults. More... | |
Namespaces | |
| namespace | line |
| namespace | line::npfqn |
Functions | |
| template<class T> | |
| SqdResult< T > | line::npfqn::npfqn_sqd (const std::vector< T > &ST, const std::vector< T > &V, const std::vector< T > &cap, const std::vector< bool > &isDelay, const Matrix< T > &rt, const std::vector< std::size_t > &stationToStateful, std::size_t nclasses, int N, const SqdOptions< T > &opt) |
| Smith Queue Decomposition (SQD): approximate MVA for closed networks under Blocking-After-Service (manufacturing / transfer blocking). | |
| template<class T> | |
| SqdResult< T > | line::npfqn::npfqn_sqd (const std::vector< T > &ST, const std::vector< T > &V, const std::vector< T > &cap, const std::vector< bool > &isDelay, const Matrix< T > &rt, const std::vector< std::size_t > &stationToStateful, std::size_t nclasses, int N) |
| Overload with the reference's default option switches. | |
Smith Queue Decomposition (SQD): approximate MVA for closed networks under Blocking-After-Service (manufacturing / transfer blocking).
Templated port of matlab/src/api/npfqn/npfqn_sqd.m. Each finite-buffer station is described by a load-dependent EFFECTIVE service rate calibrated from an M/M/1/K blocking probability, and downstream blocking is propagated through the effective routing between service stations. The recursion is an AMVA-style sweep over the population 1..N:
mu_i(n) = n V1_i exp( -[ max(0, (n-1)/beta_i) ]^{gamma_i} ) (13) W^buf_i = (1 + n) / mu_i(n) (18) W^svr_i = ST_i (1 + L^svr_i) + (server blocking time) (17) X = pop / sum_i V_i (W^buf_i + W^svr_i) L^buf_i = X V_i W^buf_i, L^svr_i = X V_i W^svr_i
with V1_i deflated by the blocking probability after every population step. Delay (INF / EXT) stations are infinite-capacity pure delays. The method is single-chain: it consumes the CHAIN-AGGREGATED demands, i.e. the first column of MATLAB's sn_get_demands_chain output.
SIGNATURE. MATLAB's entry point is npfqn_sqd(sn, N, ...) and its first act is to unpack sn into six plain arrays; after that line the routine is pure numerics with no reference to the model layer at all. The port therefore takes those arrays directly, exactly as the whole pfqn_* family takes L, N, Z rather than a Network. THE NAME IS UNCHANGED so that the registry keeps its one-to-one mapping to the MATLAB source. To reconstruct the MATLAB call, a caller unpacks:
ST = STchain(:,1) from sn_get_demands_chain(sn) V = Vchain(:,1) from sn_get_demands_chain(sn) isDelay(i) = sn.sched(i) is SchedStrategy.INF or .EXT cap(i) = infinity when isDelay(i), else sn.cap(i), with any sn.cap(i) > 1e14 also treated as infinite rt = sn.rt (stateful-indexed routing matrix) stationToStateful = sn.stationToStateful (ONE-based, as MATLAB stores it) nclasses = sn.nclasses N = sn.nclosedjobs when the caller passes nothing
computeEffectiveRouting is NOT hoisted out: collapsing pass-through delay nodes into a station-to-station chain is algorithm content, not unpacking, so it is ported here and reads rt in the same class-1 slice the reference does, rt((sf_i-1) nclasses + 1, (sf_j-1) nclasses + 1).
NO ARITY-COLLIDING OVERLOAD. MATLAB accepts one to seven positional arguments; every overload here takes eight or nine, and of unrelated types, so a call transcribed from MATLAB cannot bind to one of them and silently solve a different model.
Arithmetic: TRANSCENDENTAL, double and Real only. exp in (13), log in the (beta, gamma) calibration, and real powers in both the calibration and the M/M/1/K blocking probability rho^K / (1 - rho^{K+1}).
UNEXPLAINED CONSTANTS, reproduced verbatim and NOT rationalized here. INITIAL_V1 = 692.192 is the default initial value of the effective-rate scale V1_i, and CALIBRATION_EPSILON = 0.05 is the target V_b of the fixed heuristic calibration (mode 1). Neither is derived anywhere in the reference; both arrive from the original SolverDBT contribution (Avinash Bommareddy, Imperial College London FYP, 2026). 692.192 in particular has no stated units or provenance, and the results DO depend on it whenever the population sweep is short enough that the deflation V1 <- V1 (1 - pBlock) has not washed the initial value out. Treat it as an inherited magic number pending an answer from the contributor, not as a tuned parameter.
REFERENCE DEFECTS: none found. Reproduces MATLAB to 1e-15 relative on every combination of the four option switches tried.
Definition in file npfqn_sqd.h.