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 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 103 of file ldes_ssj_variates.h.

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

Referenced by bernoulli_inverse(), and line::ldes::engine::Sampler::next().

◆ 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 297 of file ldes_ssj_variates.h.

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

Referenced by binomial_inverse(), and line::ldes::engine::Sampler::next().

◆ 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 265 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(), and line::ldes::engine::Sampler::next().

◆ 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 226 of file ldes_ssj_variates.h.

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

Referenced by erlang_inverse(), gamma_inverse(), and line::ldes::engine::Sampler::next().

◆ 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 170 of file ldes_ssj_variates.h.

References lognormal_inverse(), and normal_inverse().

Referenced by lognormal_inverse(), and line::ldes::engine::Sampler::next().

◆ normal_inverse()

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

NormalDist.inverseF(mu, sigma, u).

Definition at line 164 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 118 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 82 of file ldes_ssj_variates.h.

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

Referenced by line::ldes::engine::Sampler::next(), and 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 281 of file ldes_ssj_variates.h.

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

Referenced by line::ldes::engine::Sampler::next(), and poisson_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 line::ldes::engine::Sampler::next(), and 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 94 of file ldes_ssj_variates.h.

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

Referenced by line::ldes::engine::Sampler::next(), and weibull_inverse().