![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
Classes | |
| struct | AsymVarResult |
| Second-order description of a steady-state estimator. More... | |
| struct | QuestInterval |
| A confidence interval, asymmetric about the point estimate in general. More... | |
| struct | QuestOptions |
| Procedure constants shared by sim_fquest and sim_firquest. More... | |
| struct | QuestResult |
| Point estimate and interval delivered by the QUEST procedures. More... | |
| struct | RunLengthPlan |
| The plan of sim_runlength_plan: what the run should have been. More... | |
| struct | RunLengthResult |
| Outcome of the run-length plan. More... | |
| struct | ShapiroWilkResult |
| Outcome of the Shapiro-Wilk normality test. More... | |
| struct | StsQuantileStats |
| Batched-quantile statistics of one sample path. More... | |
| struct | VonNeumannResult |
| Outcome of the von Neumann randomness test. More... | |
Functions | |
| double | sim_normcdf (double z) |
| Standard normal cumulative distribution function. | |
| double | sim_norminv (double p) |
| Standard normal quantile function. | |
| double | sim_tinv (double p, double nu) |
| Quantile function of Student's t distribution. | |
| std::vector< long > | sim_firquest_batchcounts (std::size_t R) |
| The article's batch counts as a function of the replication count, chosen so that R*b pooled statistics remain enough to test while every replication still contributes at least one batch. | |
| QuestOptions | sim_firquest_options (std::size_t R) |
| The FIRQUEST defaults at R replications: b0 = 25 and the R-dependent ladder, every other constant as in FQUEST. | |
| template<class T> | |
| QuestResult< T > | sim_firquest (const std::vector< std::vector< T > > &Y, double p, double alpha=0.05, const QuestOptions *options=nullptr) |
| Fixed-sample-size quantile interval from independent replications. | |
| template<class T> | |
| QuestResult< T > | sim_fquest (const std::vector< T > &Y, double p, double alpha=0.05, const QuestOptions &options=QuestOptions()) |
| Fixed-sample-size confidence interval for a steady-state quantile. | |
| template<class T> | |
| QuestInterval< T > | sim_quest_heuristic_ci (const std::vector< T > &bqe, const T ¢re, const T &Ap, const T &Np, std::size_t nstar, double alpha, bool useAutocorr) |
| Fallback interval used when a QUEST stage test fails. | |
| QuestOptions | sim_quest_options (const QuestOptions &options=QuestOptions()) |
| Validates an option set and returns it. | |
| template<class T> | |
| AsymVarResult< T > | sim_asymvar_mm1 (const T &lambda, const T &mu) |
| Asymptotic variance of the M/M/1 number-in-system process. | |
| template<class T> | |
| AsymVarResult< T > | sim_asymvar_ctmc (const Matrix< T > &A, const std::vector< T > &f, const std::vector< T > &pi=std::vector< T >()) |
| Asymptotic variance of a reward on a CTMC: 2 sum_x pi(x)g(x)d(x) with g = f - E_pi[f] and A d = -g, pi d = 0. | |
| template<class T> | |
| RunLengthResult< T > | sim_runlength (const T &mean, const T &asymVar, const T &relPrecision=num_traits< T >::from_rational(1, 20), const T &confidence=num_traits< T >::from_rational(19, 20), const T &runLength=num_traits< T >::from_int(0)) |
| Run length for a steady-state estimate of a given relative precision. | |
| template<class T> | |
| RunLengthPlan< T > | sim_runlength_plan (const Matrix< T > &means, const Matrix< T > &ciHalfWidth, const T &samplesUsed, const T &relPrecision=num_traits< T >::from_rational(1, 20), const T &confidence=num_traits< T >::from_rational(19, 20)) |
| How long a simulation run should have been, from the one it already did. | |
| template<class T> | |
| ShapiroWilkResult< T > | sim_shapirowilk (const std::vector< T > &x, double alpha=0.05) |
| Shapiro-Wilk test for univariate normality. | |
| template<class T> | |
| StsQuantileStats< T > | sim_sts_quantile_areas (const std::vector< T > &Y, std::size_t b, std::size_t m, double p, double weight=std::sqrt(12.0)) |
| Standardized time series areas of the batched quantile process. | |
| template<class T> | |
| VonNeumannResult< T > | sim_vonneumann (const std::vector< T > &x, double alpha=0.05) |
| Von Neumann ratio test for randomness of a sequence. | |
| AsymVarResult< T > line::sim::sim_asymvar_ctmc | ( | const Matrix< T > & | A, |
| const std::vector< T > & | f, | ||
| const std::vector< T > & | pi = std::vector<T>() ) |
Asymptotic variance of a reward on a CTMC: 2 sum_x pi(x)g(x)d(x) with g = f - E_pi[f] and A d = -g, pi d = 0.
The normalization is what pins d: A alone is singular, since a constant may be added without changing sigma^2.
| A | the generator, rows summing to zero |
| f | the reward attached to each state |
| pi | the stationary distribution; solved for when empty |
Definition at line 105 of file sim_runlength.h.
References line::sim::AsymVarResult< T >::asymptoticVariance, line::Matrix< T >::cols(), line::sim::AsymVarResult< T >::deviation, line::InputError::InputError(), line::sim::AsymVarResult< T >::mean, line::num_abs(), line::sim::AsymVarResult< T >::relaxationTime, line::Matrix< T >::rows(), sim_asymvar_ctmc(), line::solve(), and line::sim::AsymVarResult< T >::variance.
Referenced by line::ctmc::ctmc_get_asymptotic_variance(), and sim_asymvar_ctmc().
| AsymVarResult< T > line::sim::sim_asymvar_mm1 | ( | const T & | lambda, |
| const T & | mu ) |
Asymptotic variance of the M/M/1 number-in-system process.
| lambda | arrival rate |
| mu | service rate |
Definition at line 78 of file sim_runlength.h.
References line::sim::AsymVarResult< T >::asymptoticVariance, line::InputError::InputError(), line::sim::AsymVarResult< T >::mean, line::sim::AsymVarResult< T >::relaxationTime, sim_asymvar_mm1(), and line::sim::AsymVarResult< T >::variance.
Referenced by sim_asymvar_mm1().
| QuestResult< T > line::sim::sim_firquest | ( | const std::vector< std::vector< T > > & | Y, |
| double | p, | ||
| double | alpha = 0.05, | ||
| const QuestOptions * | options = nullptr ) |
Fixed-sample-size quantile interval from independent replications.
| Y | R replicate sample paths of equal length, finite |
| p | quantile order in (0,1) |
| alpha | nominal non-coverage, 0.05 by default |
| options | procedure constants, nullptr for the FIRQUEST defaults at this R |
Definition at line 176 of file sim_firquest.h.
References line::sim::QuestResult< T >::Ap, line::sim::StsQuantileStats< T >::Ap, line::sim::StsQuantileStats< T >::areas, line::sim::QuestResult< T >::b, line::sim::StsQuantileStats< T >::bqe, line::sim::QuestResult< T >::estimate, line::sim::QuestResult< T >::halfwidth, line::sim::QuestResult< T >::heuristic, line::InputError::InputError(), line::sim::QuestInterval< T >::lower, line::sim::QuestResult< T >::lower, line::sim::QuestResult< T >::m, line::sim::QuestResult< T >::n, line::sim::StsQuantileStats< T >::n, line::sim::QuestResult< T >::Np, line::sim::StsQuantileStats< T >::Np, line::sim::StsQuantileStats< T >::quantile, line::sim::QuestResult< T >::R, sim_firquest(), sim_firquest_options(), sim_quest_heuristic_ci(), sim_quest_options(), sim_shapirowilk(), sim_sts_quantile_areas(), sim_tinv(), sim_vonneumann(), line::sim::QuestResult< T >::truncated, line::sim::QuestInterval< T >::upper, line::sim::QuestResult< T >::upper, line::sim::QuestResult< T >::Vp, line::sim::StsQuantileStats< T >::Vp, and line::sim::QuestResult< T >::warnings.
Referenced by sim_firquest().
|
inline |
The article's batch counts as a function of the replication count, chosen so that R*b pooled statistics remain enough to test while every replication still contributes at least one batch.
| R | number of replications |
Definition at line 87 of file sim_firquest.h.
References sim_firquest_batchcounts().
Referenced by sim_firquest_batchcounts(), and sim_firquest_options().
|
inline |
The FIRQUEST defaults at R replications: b0 = 25 and the R-dependent ladder, every other constant as in FQUEST.
| R | number of replications |
Definition at line 105 of file sim_firquest.h.
References sim_firquest_batchcounts(), and sim_firquest_options().
Referenced by sim_firquest(), and sim_firquest_options().
| QuestResult< T > line::sim::sim_fquest | ( | const std::vector< T > & | Y, |
| double | p, | ||
| double | alpha = 0.05, | ||
| const QuestOptions & | options = QuestOptions() ) |
Fixed-sample-size confidence interval for a steady-state quantile.
| Y | one simulation sample path, finite |
| p | quantile order in (0,1) |
| alpha | nominal non-coverage, 0.05 by default |
| options | procedure constants, see sim_quest_options |
Definition at line 130 of file sim_fquest.h.
References line::sim::QuestResult< T >::Ap, line::sim::StsQuantileStats< T >::Ap, line::sim::StsQuantileStats< T >::areas, line::sim::QuestResult< T >::b, line::sim::StsQuantileStats< T >::bqe, line::sim::QuestResult< T >::estimate, line::sim::QuestResult< T >::halfwidth, line::sim::QuestResult< T >::heuristic, line::InputError::InputError(), line::sim::QuestInterval< T >::lower, line::sim::QuestResult< T >::lower, line::sim::QuestResult< T >::m, line::sim::QuestResult< T >::n, line::sim::StsQuantileStats< T >::n, line::sim::QuestResult< T >::Np, line::sim::StsQuantileStats< T >::Np, line::sim::StsQuantileStats< T >::quantile, sim_fquest(), sim_quest_heuristic_ci(), sim_quest_options(), sim_shapirowilk(), sim_sts_quantile_areas(), sim_tinv(), sim_vonneumann(), line::sim::QuestResult< T >::truncated, line::sim::QuestInterval< T >::upper, line::sim::QuestResult< T >::upper, line::sim::QuestResult< T >::Vp, line::sim::StsQuantileStats< T >::Vp, and line::sim::QuestResult< T >::warnings.
Referenced by sim_fquest().
|
inline |
Standard normal cumulative distribution function.
| z | the argument |
Definition at line 52 of file sim_dist.h.
References sim_normcdf().
Referenced by line::trace::mtrace_bootstrap(), sim_normcdf(), sim_shapirowilk(), and sim_vonneumann().
|
inline |
Standard normal quantile function.
| p | probability in [0,1] |
Definition at line 62 of file sim_dist.h.
References line::InputError::InputError(), and sim_norminv().
Referenced by line::trace::mtrace_bootstrap(), and sim_norminv().
| QuestInterval< T > line::sim::sim_quest_heuristic_ci | ( | const std::vector< T > & | bqe, |
| const T & | centre, | ||
| const T & | Ap, | ||
| const T & | Np, | ||
| std::size_t | nstar, | ||
| double | alpha, | ||
| bool | useAutocorr ) |
Fallback interval used when a QUEST stage test fails.
| bqe | the K batched quantile estimators, pooled over replications for sim_firquest |
| centre | the full-sample empirical quantile |
| Ap | STS area variance-parameter estimator |
| Np | NBQ variance-parameter estimator, may be NaN |
| nstar | number of observations Ap and Np were computed from |
| alpha | nominal non-coverage |
| useAutocorr | apply the lag-1 correction to the asymmetric arms |
Definition at line 109 of file sim_quest_heuristic_ci.h.
References line::InputError::InputError(), line::sim::QuestInterval< T >::lower, line::num_abs(), sim_quest_heuristic_ci(), sim_tinv(), and line::sim::QuestInterval< T >::upper.
Referenced by sim_firquest(), sim_fquest(), and sim_quest_heuristic_ci().
|
inline |
Validates an option set and returns it.
| options | the constants to check |
Definition at line 57 of file sim_quest_options.h.
References line::InputError::InputError(), and sim_quest_options().
Referenced by sim_firquest(), sim_fquest(), and sim_quest_options().
| RunLengthResult< T > line::sim::sim_runlength | ( | const T & | mean, |
| const T & | asymVar, | ||
| const T & | relPrecision = num_traits<T>::from_rational(1, 20), | ||
| const T & | confidence = num_traits<T>::from_rational(19, 20), | ||
| const T & | runLength = num_traits<T>::from_int(0) ) |
Run length for a steady-state estimate of a given relative precision.
| mean | the steady-state mean being estimated |
| asymVar | sigma^2 of that estimator |
| relPrecision | the target half-width as a fraction of the mean |
| confidence | the confidence level of the interval |
| runLength | an actual run length, to report the precision it buys; non-positive to skip |
Definition at line 179 of file sim_runlength.h.
References line::sim::RunLengthResult< T >::achievedRelPrecision, line::sim::RunLengthResult< T >::halfWidth, line::sim::RunLengthResult< T >::hasRun, line::InputError::InputError(), line::num_abs(), line::sim::RunLengthResult< T >::requiredRunLength, sim_runlength(), and line::sim::RunLengthResult< T >::z.
Referenced by sim_runlength(), and sim_runlength_plan().
| RunLengthPlan< T > line::sim::sim_runlength_plan | ( | const Matrix< T > & | means, |
| const Matrix< T > & | ciHalfWidth, | ||
| const T & | samplesUsed, | ||
| const T & | relPrecision = num_traits<T>::from_rational(1, 20), | ||
| const T & | confidence = num_traits<T>::from_rational(19, 20) ) |
How long a simulation run should have been, from the one it already did.
A batch-means half-width H at confidence 1-alpha over a run of N samples pins the ASYMPTOTIC variance of the estimator,
sigma^2 = (H/z)^2 N, z = Phi^-1((1+confidence)/2),
and that is the quantity a run length is planned from – NOT the stationary variance, which on M/M/1 differs from it by a factor blowing up like (1-rho)^-2. sim_runlength then turns it into the sample count that reaches a requested RELATIVE precision.
An entry with a non-positive mean or half-width is left NaN, since there is nothing to plan from there.
Reference: W. Whitt (1989). Planning queueing simulations. Management Science 35(11), 1341-1366.
Definition at line 249 of file sim_runlength.h.
References line::sim::RunLengthPlan< T >::asymptoticVariance, line::Matrix< T >::cols(), line::sim::RunLengthPlan< T >::confidence, line::InputError::InputError(), line::Matrix< T >::Matrix(), line::sim::RunLengthPlan< T >::relPrecision, line::sim::RunLengthPlan< T >::requiredSamples, line::Matrix< T >::rows(), line::sim::RunLengthPlan< T >::samplesUsed, sim_runlength(), and sim_runlength_plan().
Referenced by line::ldes::engine::batch_means_ci(), and sim_runlength_plan().
| ShapiroWilkResult< T > line::sim::sim_shapirowilk | ( | const std::vector< T > & | x, |
| double | alpha = 0.05 ) |
Shapiro-Wilk test for univariate normality.
| x | the sample, 3 to 5000 finite observations, order irrelevant |
| alpha | significance level in (0,1), 0.05 by default |
Definition at line 122 of file sim_shapirowilk.h.
References line::InputError::InputError(), line::sim::ShapiroWilkResult< T >::nobs, line::sim::ShapiroWilkResult< T >::pvalue, line::sim::ShapiroWilkResult< T >::reject, sim_normcdf(), sim_shapirowilk(), line::sim::ShapiroWilkResult< T >::W, and line::sim::ShapiroWilkResult< T >::zscore.
Referenced by sim_firquest(), sim_fquest(), and sim_shapirowilk().
| StsQuantileStats< T > line::sim::sim_sts_quantile_areas | ( | const std::vector< T > & | Y, |
| std::size_t | b, | ||
| std::size_t | m, | ||
| double | p, | ||
| double | weight = std::sqrt(12.0) ) |
Standardized time series areas of the batched quantile process.
| Y | exactly b*m finite observations, in sample-path order |
| b | batch count, positive |
| m | batch size, positive |
| p | quantile order in (0,1) |
| weight | constant STS weight function, sqrt(12) by default |
Definition at line 131 of file sim_sts_quantile_areas.h.
References line::sim::StsQuantileStats< T >::Ap, line::sim::StsQuantileStats< T >::areas, line::sim::StsQuantileStats< T >::b, line::sim::StsQuantileStats< T >::bqe, line::InputError::InputError(), line::sim::StsQuantileStats< T >::m, line::sim::StsQuantileStats< T >::n, line::sim::StsQuantileStats< T >::Np, line::sim::StsQuantileStats< T >::quantile, sim_sts_quantile_areas(), and line::sim::StsQuantileStats< T >::Vp.
Referenced by sim_firquest(), sim_fquest(), and sim_sts_quantile_areas().
|
inline |
Quantile function of Student's t distribution.
| p | probability in [0,1] |
| nu | degrees of freedom, positive |
Definition at line 77 of file sim_dist.h.
References line::InputError::InputError(), and sim_tinv().
Referenced by sim_firquest(), sim_fquest(), sim_quest_heuristic_ci(), and sim_tinv().
| VonNeumannResult< T > line::sim::sim_vonneumann | ( | const std::vector< T > & | x, |
| double | alpha = 0.05 ) |
Von Neumann ratio test for randomness of a sequence.
| x | the sequence, at least 3 finite observations |
| alpha | significance level in (0,1), 0.05 by default |
Definition at line 70 of file sim_vonneumann.h.
References line::InputError::InputError(), line::sim::VonNeumannResult< T >::nobs, line::sim::VonNeumannResult< T >::pvalue, line::sim::VonNeumannResult< T >::ratio, line::sim::VonNeumannResult< T >::reject, sim_normcdf(), sim_vonneumann(), and line::sim::VonNeumannResult< T >::zscore.
Referenced by sim_firquest(), sim_fquest(), and sim_vonneumann().