![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
Expected maximum of K i.i.d. More...
Go to the source code of this file.
Namespaces | |
| namespace | line |
| namespace | line::fj |
Functions | |
| template<class T> | |
| T | line::fj::fj_xmax_hyperexp (unsigned K, const T &p1, const T &mu1, const T &mu2) |
| Expected maximum of K i.i.d. | |
Expected maximum of K i.i.d.
two-phase hyperexponential service times.
Templated port of matlab/src/api/fj/fj_xmax_hyperexp.m.
X_K^max = sum_{n=1..K} (-1)^{n+1} sum_{m=0..n} C(n,m) p1^m p2^{n-m} / (m mu1 + (n-m) mu2)
from the inclusion-exclusion expansion of 1 - F(x)^K. Every term is rational, so the sum is exact in the field – which is the point, because it alternates: the terms grow like 2^K while the result stays O(log K/mu), so in double the answer is destroyed by cancellation somewhere around K = 25 and is pure noise by K = 40.
REFERENCE DEFECT: FJ_xmax.fj_xmax_hyperexp in jar/src/main/java/jline/api/fj/FJ_xmax.java drops the p1^m p2^{n-m} factor from the inner sum, so the JAR computes a different quantity and ignores p1 entirely except in its validation. MATLAB is ground truth and is what this port follows.
Definition in file fj_xmax_hyperexp.h.