Class Qsys_mm1_lindley

java.lang.Object
jline.api.qsys.Qsys_mm1_lindley

public final class Qsys_mm1_lindley extends Object
Conditional waiting-time moments of the M/M/1 Lindley recursion.

One step of Lindley's recursion W_{n+1} = max(W_n + S_n - A_n, 0) with A_n ~ Exp(lambda) and S_n ~ Exp(mu): given the waiting time of customer n, the exact conditional moments of the waiting time of customer n+1. Unlike every other qsys_* algorithm these are conditional on the current state rather than stationary, so they are defined and finite for any load, including lambda >= mu.

The m-th conditional moment is

   E[W_{n+1}^m | W_n] = lambda mu/(lambda+mu) [ S + T ],
   S = sum_{k=0}^{m} C(m,k) W_n^k (m-k)! / mu^(m-k+1),
   T = (-1)^m e^{-lambda W_n} (Gamma(m+1,-lambda W_n) - m!) / lambda^(m+1),
 

where the density of S_n - A_n is the asymmetric Laplace density lambda mu/(lambda+mu) times e^{-mu x} for x > 0 and e^{lambda x} for x < 0. Because m+1 is a positive integer, the upper incomplete gamma function admits the finite form Gamma(m+1,x) = m! e^{-x} sum_{k=0}^{m} x^k/k!, valid at the negative argument -lambda W_n needed here. Substituting it cancels the growing exponential and leaves the numerically stable

   T = (-1)^m m! ( sum_{k=0}^{m} (-lambda W_n)^k/k! - e^{-lambda W_n} ) / lambda^(m+1),
 

which is what this class evaluates. No incomplete gamma routine is needed. The mean is returned from the equivalent explicit form W_n + (lambda-mu)/(lambda mu) + mu e^{-lambda W_n}/(lambda(lambda+mu)), and the variance as the second moment less the squared mean.

Port of MATLAB qsys_mm1_lindley.m. Verified against 4e6 Monte Carlo replications to 5e-4 relative error for m = 1, 2, 3.

Reference: S. Palomo, J. Pender, "Learning the Tandem Network Lindley Recursion", Proc. Winter Simulation Conference, 2021, theorem 1 and corollary 2.

Since:
LINE 3.1.0
  • Method Details

    • qsys_mm1_lindley

      public static QsysLindleyResult qsys_mm1_lindley(double lambda, double mu, double[] Wn)
      Conditional mean and variance of the next waiting time.
      Parameters:
      lambda - arrival rate, positive
      mu - service rate, positive
      Wn - current waiting times, finite and nonnegative
      Returns:
      the conditional moments up to order 2
    • qsys_mm1_lindley

      public static QsysLindleyResult qsys_mm1_lindley(double lambda, double mu, double[] Wn, int mmax)
      Conditional raw moments of the next waiting time.
      Parameters:
      lambda - arrival rate, positive
      mu - service rate, positive
      Wn - current waiting times, finite and nonnegative
      mmax - highest moment order, at least 1; raised to 2 so the variance is always available
      Returns:
      the conditional moments