LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
line::ldes::ssj Namespace Reference

Functions

double exponential_inverse (double lambda, double u)
 ExponentialDist.inverseF(lambda, u), SSJ's log1p spelling.
double uniform_inverse (double a, double b, double u)
 UniformDist.inverseF(a, b, u).
double uniform_int_inverse (double lo, double width, double u)
 UniformIntDist.inverseF(i, j, u), written over the lower bound and the WIDTH w = j - i + 1 so that a lattice shifted off the integers keeps its offset.
double pareto_inverse (double alpha, double beta, double u)
 ParetoDist.inverseF(alpha, beta, u) = beta (1-u)^(-1/alpha).
double weibull_inverse (double alpha, double lambda, double delta, double u)
 WeibullDist.inverseF(alpha, lambda, delta, u).
double bernoulli_inverse (double p, double u)
 BernoulliDist.inverseF(p, u): 1 when u exceeds 1 - p.
double normal_inverse01 (double u)
 NormalDist.inverseF(0, 1, u) by Wichura's AS 241 (Applied Statistics 37, 1988), the algorithm SSJ's inverseF01 implements.
double normal_inverse (double mu, double sigma, double u)
 NormalDist.inverseF(mu, sigma, u).
double lognormal_inverse (double mu, double sigma, double u)
 LognormalDist.inverseF(mu, sigma, u) = exp(mu + sigma Phi^-1(u)).
double gamma_inverse (double alpha, double lambda, double u)
 GammaDist.inverseF(alpha, lambda, u): the quantile of a Gamma of shape alpha and RATE lambda, so the mean is alpha/lambda, which is SSJ's convention.
double erlang_inverse (int k, double lambda, double u)
 ErlangGen(k, lambda): the Gamma of integer shape k and rate lambda.
double poisson_inverse (double lambda, double u)
 PoissonDist.inverseF(lambda, u): the smallest k whose cdf reaches u.
double binomial_inverse (int n, double p, double u)
 BinomialDist.inverseF(n, p, u), by the same forward inversion.

Function Documentation

◆ bernoulli_inverse()

double line::ldes::ssj::bernoulli_inverse ( double p,
double u )
inline

BernoulliDist.inverseF(p, u): 1 when u exceeds 1 - p.

Definition at line 117 of file ldes_ssj_variates.h.

References bernoulli_inverse(), and line::InputError::InputError().

Referenced by bernoulli_inverse().

◆ binomial_inverse()

double line::ldes::ssj::binomial_inverse ( int n,
double p,
double u )
inline

BinomialDist.inverseF(n, p, u), by the same forward inversion.

Definition at line 311 of file ldes_ssj_variates.h.

References binomial_inverse(), and line::InputError::InputError().

Referenced by binomial_inverse().

◆ erlang_inverse()

double line::ldes::ssj::erlang_inverse ( int k,
double lambda,
double u )
inline

ErlangGen(k, lambda): the Gamma of integer shape k and rate lambda.

SSJ's ErlangGen inverts the Gamma rather than summing k exponentials, which is why it costs ONE uniform and not k – the measurement above pinned that.

Definition at line 279 of file ldes_ssj_variates.h.

References erlang_inverse(), gamma_inverse(), and line::InputError::InputError().

Referenced by erlang_inverse().

◆ exponential_inverse()

double line::ldes::ssj::exponential_inverse ( double lambda,
double u )
inline

ExponentialDist.inverseF(lambda, u), SSJ's log1p spelling.

Definition at line 69 of file ldes_ssj_variates.h.

References exponential_inverse(), and line::InputError::InputError().

Referenced by exponential_inverse().

◆ gamma_inverse()

double line::ldes::ssj::gamma_inverse ( double alpha,
double lambda,
double u )
inline

GammaDist.inverseF(alpha, lambda, u): the quantile of a Gamma of shape alpha and RATE lambda, so the mean is alpha/lambda, which is SSJ's convention.

Newton on P(alpha, lambda x) = u from a Wilson-Hilferty start, with a bisection guard: the density vanishes at the origin for alpha > 1 and Newton alone can step negative there. Converges to about 1e-14 relative, which is below the resolution at which a service time can reorder two events.

Definition at line 240 of file ldes_ssj_variates.h.

References gamma_inverse(), line::InputError::InputError(), and normal_inverse01().

Referenced by erlang_inverse(), and gamma_inverse().

◆ lognormal_inverse()

double line::ldes::ssj::lognormal_inverse ( double mu,
double sigma,
double u )
inline

LognormalDist.inverseF(mu, sigma, u) = exp(mu + sigma Phi^-1(u)).

Definition at line 184 of file ldes_ssj_variates.h.

References lognormal_inverse(), and normal_inverse().

Referenced by lognormal_inverse().

◆ normal_inverse()

double line::ldes::ssj::normal_inverse ( double mu,
double sigma,
double u )
inline

NormalDist.inverseF(mu, sigma, u).

Definition at line 178 of file ldes_ssj_variates.h.

References line::InputError::InputError(), normal_inverse(), and normal_inverse01().

Referenced by lognormal_inverse(), and normal_inverse().

◆ normal_inverse01()

double line::ldes::ssj::normal_inverse01 ( double u)
inline

NormalDist.inverseF(0, 1, u) by Wichura's AS 241 (Applied Statistics 37, 1988), the algorithm SSJ's inverseF01 implements.

Accurate to about 1e-16 over the whole range, which is what makes the Lognormal agree with SSJ to the last few bits rather than only to a plotting tolerance.

Definition at line 132 of file ldes_ssj_variates.h.

References normal_inverse01().

Referenced by gamma_inverse(), normal_inverse(), and normal_inverse01().

◆ pareto_inverse()

double line::ldes::ssj::pareto_inverse ( double alpha,
double beta,
double u )
inline

ParetoDist.inverseF(alpha, beta, u) = beta (1-u)^(-1/alpha).

Definition at line 96 of file ldes_ssj_variates.h.

References line::InputError::InputError(), and pareto_inverse().

Referenced by pareto_inverse().

◆ poisson_inverse()

double line::ldes::ssj::poisson_inverse ( double lambda,
double u )
inline

PoissonDist.inverseF(lambda, u): the smallest k whose cdf reaches u.

Summed forward from k = 0 with the pmf carried recursively. The result is an INTEGER, so it agrees with SSJ exactly whenever the two cdfs put u on the same side of a step, which no test has yet found a counterexample to.

Definition at line 295 of file ldes_ssj_variates.h.

References line::InputError::InputError(), and poisson_inverse().

Referenced by poisson_inverse().

◆ uniform_int_inverse()

double line::ldes::ssj::uniform_int_inverse ( double lo,
double width,
double u )
inline

UniformIntDist.inverseF(i, j, u), written over the lower bound and the WIDTH w = j - i + 1 so that a lattice shifted off the integers keeps its offset.

SSJ computes i + (int)(u*(j - i + 1.0)), clamping the two open ends, and the cast truncates toward zero on a non-negative product, which is the floor.

Definition at line 88 of file ldes_ssj_variates.h.

References line::InputError::InputError(), and uniform_int_inverse().

Referenced by uniform_int_inverse().

◆ uniform_inverse()

double line::ldes::ssj::uniform_inverse ( double a,
double b,
double u )
inline

UniformDist.inverseF(a, b, u).

Definition at line 77 of file ldes_ssj_variates.h.

References uniform_inverse().

Referenced by uniform_inverse().

◆ weibull_inverse()

double line::ldes::ssj::weibull_inverse ( double alpha,
double lambda,
double delta,
double u )
inline

WeibullDist.inverseF(alpha, lambda, delta, u).

SSJ parameterises the scale as lambda with the variate delta + (1/lambda) (-log(1-u))^(1/alpha).

Definition at line 108 of file ldes_ssj_variates.h.

References line::InputError::InputError(), and weibull_inverse().

Referenced by weibull_inverse().