LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
dist_fitters.h File Reference

The moment fitters the reference distributions carry as STATIC FACTORIES: Erlang.fitMeanAndOrder, HyperExp.fitMeanAndSCV, Coxian.fitMeanAndSCV, Cox2.fitCentral, APH.fitMeanAndSCV, APH.fitCentral, Gamma.fitMeanAndSCV, Pareto.fitMeanAndSCV. More...

#include <cmath>
#include <cstddef>
#include <vector>
#include "line/api/mam/aph_fit.h"
#include "line/api/mam/aph_fit_moments.h"
#include "line/api/mam/map_transform.h"
#include "line/lang/lang_types.h"
#include "line/num/number.h"
#include "line/util/error.h"
Include dependency graph for dist_fitters.h:

Go to the source code of this file.

Namespaces

namespace  line
namespace  line::lang

Functions

template<class T>
Distrib< T > line::lang::ph_from_map (const mam::Map< T > &m, bool acyclic)
 A PH distribution from a fitted (D0, D1) pair.
template<class T>
Distrib< T > line::lang::erlang_fit_mean_order (const T &mean, std::size_t k)
 Erlang.fitMeanAndOrder(MEAN, k): k phases, each of rate k / MEAN.
template<class T>
Distrib< T > line::lang::hyperexp_fit_mean_scv (const T &mean, const T &scv)
 HyperExp.fitMeanAndSCV(MEAN, SCV), which is map_hyperexp at p = 0.99 read back as (p, mu1, mu2).
template<class T>
Distrib< T > line::lang::hyperexp_fit_mean_scv_balanced (const T &mean, const T &scv)
 HyperExp.fitMeanAndSCVBalanced(MEAN, SCV): the balanced-means branch, p / mu1 = (1 - p) / mu2.
template<class T>
Distrib< T > line::lang::coxian_fit_mean_scv (const T &mean, const T &scv)
 Coxian.fitMeanAndSCV(MEAN, SCV), branch for branch.
template<class T>
Distrib< T > line::lang::cox2_fit_central (const T &mean, const T &var, const T &skew)
 Cox2.fitCentral(MEAN, VAR, SKEW): the two-phase Coxian matching three central moments exactly when the moment set admits one.
template<class T>
Distrib< T > line::lang::coxian_fit_central (const T &mean, const T &var, const T &skew)
 Coxian.fitCentral, which the reference forwards to Cox2.fitCentral.
template<class T>
Distrib< T > line::lang::aph_fit_mean_scv (const T &mean, const T &scv)
 APH.fitMeanAndSCV(MEAN, SCV), through mam::aph_fit_mean_scv.
template<class T>
Distrib< T > line::lang::aph_fit_central (const T &mean, const T &var, const T &skew)
 APH.fitCentral(MEAN, VAR, SKEW): the three central moments converted to raw ones and matched by a canonical APH.
template<class T>
Distrib< T > line::lang::gamma_fit_mean_scv (const T &mean, const T &scv)
 Gamma.fitMeanAndSCV(MEAN, SCV): shape 1/SCV, scale MEAN * SCV.
template<class T>
Distrib< T > line::lang::pareto_fit_mean_scv (const T &mean, const T &scv)
 Pareto.fitMeanAndSCV(MEAN, SCV): alpha = 1 + sqrt(1 + 1/SCV) and k = MEAN (alpha - 1) / alpha.

Detailed Description

The moment fitters the reference distributions carry as STATIC FACTORIES: Erlang.fitMeanAndOrder, HyperExp.fitMeanAndSCV, Coxian.fitMeanAndSCV, Cox2.fitCentral, APH.fitMeanAndSCV, APH.fitCentral, Gamma.fitMeanAndSCV, Pareto.fitMeanAndSCV.

They live BESIDE Distrib rather than inside it because they are the only part of the distribution layer that needs line::mam: fitting an APH is aph_fit, fitting a two-phase hyperexponential is map_hyperexp, and lang/lang_types.h sits UNDER api/ in the include order. A model script that only constructs distributions by parameter never pays for this header.

WHAT IS A PORT AND WHAT IS A SUBSTITUTION. Every branch below is the reference's arithmetic transcribed, with one documented exception: APH.fitCentral/fitMeanAndSCV call BUTools' APHFrom3Moments, which this port does not transcribe, so they go through mam::aph_fit – the same Bobbio-Horvath-Telek canonical APH, and the same substitution api/qsys/qsys_mapg1.h:37-45 already documents.

EVERY FITTER IS GATED ON TRANSCENDENTAL ARITHMETIC. Each one takes a square root of a moment discriminant, which has no exact rational counterpart; the gate is mam::map_hyperexp's and is stated here rather than discovered as a link error in the exact instantiation.

Definition in file dist_fitters.h.