![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
Reduction heuristic (RD) for the normalizing constant of a closed LOAD-DEPENDENT product-form network. More...
#include <cmath>#include <cstddef>#include <limits>#include <vector>#include "line/api/pfqn/pfqn_lldsingle.h"#include "line/api/pfqn/pfqn_mva.h"#include "line/api/pfqn/pfqn_nc.h"#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::pfqn::RdResult< T > |
| Return value of pfqn_rd, mirroring [lGN, Cgamma]. More... | |
Namespaces | |
| namespace | line |
| namespace | line::pfqn |
Functions | |
| template<class T> | |
| RdResult< T > | line::pfqn::pfqn_rd (const Matrix< T > &L0, const std::vector< int > &N, const Matrix< T > &Z, const Matrix< T > &mu0, double tol, NcMethod method) |
| Reduction heuristic (RD) for the normalizing constant of a closed LOAD-DEPENDENT product-form network. | |
| template<class T> | |
| RdResult< T > | line::pfqn::pfqn_rd (const Matrix< T > &L, const std::vector< int > &N, const Matrix< T > &Z, const Matrix< T > &mu) |
| Reference defaults: tol 1e-6, and the exact convolution for the reduced load-independent constant. | |
Reduction heuristic (RD) for the normalizing constant of a closed LOAD-DEPENDENT product-form network.
Templated port of matlab/src/api/pfqn/pfqn_rd.m. MATLAB is the ONLY usable reference here: jar/src/main/java/jline/api/pfqn/nc/Pfqn_rd.java carries four recorded defects (the load-independent flag is not reset per station, the rate comparison runs over the wrong axis, the demand division skips class 0, and the rate matrix is not reset), so it was not used to adjudicate anything in this port.
Method. Each station's rate profile mu_i(k) is split into a constant part and a residual. Let s_i be the first population at which the rate reaches its terminal value mu_i(sum N), so that mu_i(k) = mu_i(s_i) for k >= s_i. The demands are rescaled by that terminal rate, y = L / mu_i(s_i), which turns the station load independent above s_i, and the residual profile
gamma_i(k) = mu_i(k) / mu_i(s_i), beta_i(1) = gamma_i(1) / (1 - gamma_i(1)), beta_i(j) = (1 - gamma_i(j-1)) gamma_i(j) / (1 - gamma_i(j))
carries what the rescaling threw away. The heuristic then writes
G(N) = G_LI(y, N, Z) * Cgamma, Cgamma = sum_{v=0}^{vmax} (sum(N) - max(0, v-1))/sum(N) * E_v,
with E_v the single-class load-dependent constant pfqn_lldsingle(rho, v, beta) evaluated at the single-class utilizations rho = y X, X the exact MVA throughput of the rescaled model, and vmax = min(sum_i (s_i - 1), sum(N)) over the stations that are genuinely load dependent. A station whose rate is already constant is folded into the demands up front and contributes nothing.
Reference behaviour preserved verbatim: a not-a-number rate becomes infinite, an infinite terminal rate pushes s_i back to the last finite column, a not-a-number beta becomes infinite (this is the 0 * Inf that every column past s_i produces), and an all-infinite beta means the residual is empty and the plain load-independent constant is returned unchanged. The reference also relies on MATLAB auto-growing lEN so that its first entry is zero, i.e. E_0 = 1; that is written explicitly here. THAT RELIANCE HOLDS ONLY FOR vmax >= 1, where the first assignment lands at index 2 and index 1 is filled with zero as a side effect. At vmax = 0 the assigning loop never runs, so nothing auto-grows and the read raises "Unrecognized function or variable 'lEN'"; the explicit zeros here are what make that case defined, and the reference has been corrected to preallocate the same way.
pfqn_lldsingle is called on beta, which can be negative, so its linear (non-logarithmic) recursion is the one that applies; the reference wraps the call in real() for exactly that reason. The port has only the linear recursion, so no wrapper is needed.
Arithmetic: INEXACT BY CONSTRUCTION. This is a heuristic reduction, not an identity: Cgamma is a truncated and reweighted correction series, the comparison that locates s_i is against a tolerance, and the result is reported as a log. Gated on has_transcendental accordingly.
Definition in file pfqn_rd.h.