LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
fj_xmax_erlang.h File Reference

Expected maximum of K i.i.d. More...

Include dependency graph for fj_xmax_erlang.h:

Go to the source code of this file.

Namespaces

namespace  line
namespace  line::fj

Functions

template<class T>
line::fj::fj_xmax_erlang (unsigned K, unsigned k, const T &mu)
 Expected maximum of K i.i.d.

Detailed Description

Expected maximum of K i.i.d.

Erlang-k service times.

Templated port of matlab/src/api/fj/fj_xmax_erlang.m, cross-checked against FJ_xmax.fj_xmax_erlang in jar/src/main/java/jline/api/fj/FJ_xmax.java (identical formulas; the JAR replaces MATLAB's adaptive integral with a 10001-point composite Simpson rule, which this port also does).

MIXED ARITHMETIC. At k = 2 the MATLAB file uses the closed form

X_K^max = (1/mu) sum_{n=1..K} C(K,n) (-1)^{n-1} sum_{m=1..n} C(n,m) m! / (2 n^{m+1})

which is rational and therefore exact in any field, cancellation included: the alternating outer sum is exactly the kind that double cannot carry past about K = 25. For any other k the mean is a quadrature of 1 - F(t)^K against the Erlang CDF and needs exp, so it is only available when T carries transcendental functions; asking for it at exact arithmetic throws UnsupportedError rather than silently substituting something else.

Definition in file fj_xmax_erlang.h.