![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
Robust Queueing (RQ) approximation of a G/GI/1 queue characterized by its arrival index of dispersion and the first two service moments. More...
#include <cstddef>#include <vector>#include "line/api/qsys/qsys_types.h"#include "line/num/number.h"#include "line/util/error.h"Go to the source code of this file.
Classes | |
| struct | line::qsys::Gig1RqResult< T > |
Namespaces | |
| namespace | line |
| namespace | line::qsys |
Functions | |
| template<class T, class IaFun> | |
| Gig1RqResult< T > | line::qsys::qsys_gig1_rq (const T &rho, const T &mu, const T &cs2, IaFun &&IaFun_) |
| Robust Queueing (RQ) approximation of a G/GI/1 queue characterized by its arrival index of dispersion and the first two service moments. | |
Robust Queueing (RQ) approximation of a G/GI/1 queue characterized by its arrival index of dispersion and the first two service moments.
Templated port of matlab/src/api/qsys/qsys_gig1_rq.m, cross-checked against jar/src/main/java/jline/api/qsys/Qsys_gig1_rq.java.
The mean steady-state workload is the value of a one-dimensional variational problem (Whitt and You 2018, eqs. (13), (16)-(18)):
Zstar = sup_{x>=0} [ -(1-rho) x + sqrt( 2 rho x (I_a(x) + c_s^2)/mu ) ] W = max(0, Zstar/rho - (c_s^2+1)/(2 mu)) Q = lambda W the mean number waiting X = Q + rho the mean number in system
The objective is unimodal in practice but not guaranteed to be, so MATLAB brackets it with a 200-point log-spaced scan over [1e-6, 1e8] and refines the best bracket with fminbnd at TolX 1e-10, keeping the better of the scan value and the refined value. The port keeps the same scan and refines with golden-section search on the same bracket at the same TolX. fminbnd is golden section with parabolic acceleration, so on a bracket containing a single interior maximum the two locate the same point to within TolX; and because MATLAB and the port both return max(scan, refined), a refinement that lands short can never fall below the scan value. Where the objective really is multimodal both are equally at the mercy of the scan, and neither claims a global optimum.
ARITHMETIC. The square root and the tolerance-driven search make this transcendental.
The arrival process enters only through the callable I_a(x), so the caller supplies whatever index-of-dispersion model applies; for a renewal arrival stream I_a is the constant c_a^2.
At rho <= 0 all four measures are zero, as in MATLAB. At rho >= 1 MATLAB returns Inf; the port raises instead, since the exact instantiations have no infinity and a silent Inf propagates into whatever consumes the result.
Definition in file qsys_gig1_rq.h.