![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
Sampled McKenna-Mitra integral form of the normalizing constant of a repairman (single-queue plus delay) model. More...
#include <algorithm>#include <cmath>#include <cstddef>#include <limits>#include <vector>#include "line/api/pfqn/pfqn_ca.h"#include "line/api/pfqn/pfqn_mc_common.h"#include "line/num/number.h"#include "line/util/error.h"#include "line/util/matrix.h"Go to the source code of this file.
Namespaces | |
| namespace | line |
| Conservation laws of a layered queueing network, enumerated from its structure. | |
| namespace | line::pfqn |
Functions | |
| template<class T> | |
| NcResult< T > | line::pfqn::pfqn_mmsample2 (const Matrix< T > &L, const std::vector< int > &N, const std::vector< T > &Z, std::size_t samples, McRng &rng) |
| Sampled McKenna-Mitra integral form of the normalizing constant of a repairman (single-queue plus delay) model. | |
| template<class T> | |
| NcResult< T > | line::pfqn::pfqn_mmsample2 (const Matrix< T > &L, const std::vector< int > &N, const std::vector< T > &Z, McRng &rng) |
| Reference call shape with an explicit grid size. | |
Sampled McKenna-Mitra integral form of the normalizing constant of a repairman (single-queue plus delay) model.
Templated port of matlab/src/api/pfqn/pfqn_mmsample2.m, cross-checked against jar/src/main/java/jline/api/pfqn/nc/Pfqn_mmsample2.java.
For a single queue the McKenna-Mitra form collapses to the one-dimensional integral
G(N) = 1/prod_r N_r! int_0^inf e^{-u} prod_r (Z_r + L_r u)^{N_r} du,
whose log-integrand at the grid point u is
f(u) = -u + sum_r N_r log(Z_r + L_r u).
The reference lays a grid of ceil(samples/2) uniform points on [0,1) plus ceil(samples/2) points log-spaced over [1, 1e5], SORTS it, rescales the demands so that every coefficient is at least one, takes the panel widths du = [v(1), diff(v)] (the first panel covering [0, v(1)]) and reports the quadrature sum in the log domain,
lG = log sum_i du_i exp(f(v_i)) - sum_r log N_r! + sum(N) log(scaleFactor).
(An earlier reference took the maximum of the weighted log-integrand over an unsorted grid with the integrand (Z_r + L_r) u; MATLAB has since been corrected and this port follows the corrected estimator.)
Only the FIRST row of L is read, matching the reference: this is a single-queue model and additional rows are ignored.
Arithmetic: INEXACT BY CONSTRUCTION. The grid is random, the integrand is evaluated in the log domain, and the log-spaced block is generated by exponentiation.
RNG contract: see pfqn_mc_common.h. Comparable to MATLAB only in distribution, never stream for stream; reproducible within this port only when the generator is passed in the same state.
Definition in file pfqn_mmsample2.h.