![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
Expected maximum of K M/E_k/1 branch response times. More...
#include "line/api/fj/fj_types.h"#include "line/api/fj/fj_xmax_erlang.h"#include "line/num/number.h"#include "line/util/error.h"Go to the source code of this file.
Namespaces | |
| namespace | line |
| namespace | line::fj |
Functions | |
| template<class T> | |
| T | line::fj::fj_rmax_erlang (unsigned K, unsigned k, const T &lambda, const T &mu) |
| Expected maximum of K M/E_k/1 branch response times. | |
Expected maximum of K M/E_k/1 branch response times.
Templated port of matlab/src/api/fj/fj_rmax_erlang.m.
The branch mean response time comes from Pollaczek-Khinchine with the Erlang-k SCV 1/k,
R = (k/mu) [1 + rho (1 + 1/k) / (2 (1 - rho))], rho = lambda k / mu
At K = 2 the maximum has the closed form (Thomasian 2014, Eq. 34)
R_2^max = 2 R - sum_{m,n < k} C(m+n,m) mu_R^{m+n} / (2 mu_R)^{m+n+1}
with mu_R = k / R the rate that matches the response-time mean. For any other K the MATLAB file moment-matches the response time to an Erlang and integrates 1 - F(t)^K numerically.
MIXED ARITHMETIC. The K = 2 branch is rational and exact in any field; the general-K branch needs exp and a quadrature and throws UnsupportedError at exact arithmetic.
REFERENCE DEFECT: FJ_rmax.fj_rmax_erlang in jar/src/main/java/jline/api/fj/FJ_rmax.java drops the mu_R^{m+n} numerator from the K = 2 correction, computing C(m+n,m)/(2 mu_R)^{m+n+1} instead. The two agree only at mu_R = 1. MATLAB is ground truth and is what this port follows. Note also that the MATLAB correction simplifies to sum C(m+n,m) / (2^{m+n+1} mu_R), which is how it is evaluated here.
Definition in file fj_rmax_erlang.h.