![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
One conditional Lindley moment for exponential primitives. 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.
Namespaces | |
| namespace | line |
| namespace | line::qsys |
Functions | |
| template<class T> | |
| std::vector< T > | line::qsys::qsys_lindley_moment (const T &lambda, const T &mu, const std::vector< T > &Wn, unsigned m) |
| One conditional Lindley moment for exponential primitives. | |
| template<class T> | |
| T | line::qsys::qsys_lindley_moment (const T &lambda, const T &mu, const T &Wn, unsigned m) |
| Scalar overload of the same expression. | |
One conditional Lindley moment for exponential primitives.
Templated port of matlab/src/api/qsys/qsys_lindley_moment.m. No JAR counterpart. Returns E[max(Wn + S - A, 0)^m] with A ~ Exp(lambda), S ~ Exp(mu) and m >= 1, evaluated at every entry of Wn.
This is the algorithm shared by qsys_mm1_lindley, which calls it once per moment order, and qsys_hh1_lindley, which mixes it over the arrival and service phases. The density of S - A is the asymmetric Laplace density lambda mu/(lambda+mu) times e^{-mu x} on x > 0 and e^{lambda x} on x < 0, which splits the expectation into
S = sum_{k=0}^{m} C(m,k) w^k (m-k)! / mu^(m-k+1) T = (-1)^m m! ( sum_{k=0}^{m} (-lambda w)^k/k! - e^{-lambda w} ) / lambda^(m+1)
with the value lambda mu/(lambda+mu) (S + T). The T term is the upper incomplete gamma Gamma(m+1, -lambda w), which for integer m+1 has the finite form m! e^{-x} sum_k x^k/k! valid at the negative argument needed here. Substituting it cancels the growing exponential, so no incomplete gamma routine is needed and nothing overflows at large w.
ARITHMETIC: exp() is the only transcendental step, and it appears once per evaluation point rather than inside the sum, so the exact instantiation is refused rather than silently rounded. Everything else is a finite sum of rational terms and is exact whenever the arithmetic is.
Definition in file qsys_lindley_moment.h.