LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
line::qn::Distrib< T > Struct Template Reference

#include <line/lang/lang_types.h>

Inheritance diagram for line::qn::Distrib< T >:
Collaboration diagram for line::qn::Distrib< T >:

Public Member Functions

bool is_prior () const
bool has_schedule () const
bool is_immediate () const
bool has_map () const
 True when the type carries a (D0,D1) pair of its own.
std::vector< T > mu_vec () const
 Phase rates, MATLAB's getMu: the total outgoing rate of each phase.
std::vector< T > phi_vec () const
 Completion probabilities, MATLAB's getPhi: (D1 e) .
std::size_t phases () const
 The order of the representation, MATLAB's sn.phases.
rate () const
 The rate MATLAB's refreshRates would store: 1/mean, with the Immediate singleton short-circuited to its declared rate so that the reciprocal of 1e-8 is exactly 1e8 in every arithmetic rather than 1e8 plus rounding.

Static Public Member Functions

static Distrib exp_mean (const T &m)
static Distrib exp_rate (const T &r)
static Distrib immediate ()
 The Immediate singleton.
static Distrib disabled_dist ()
static Distrib det (const T &m)
static Distrib erlang (const T &phase_rate, std::size_t r)
 Erlang(alpha, r): r phases of rate alpha, as MATLAB's Erlang(phaseRate, nphases).
static Distrib erlang_fit (const T &m, const T &c2)
 Erlang fitted to a mean and an SCV, as MATLAB's Erlang.fitMeanAndSCV.
static Distrib hyperexp_n (const std::vector< T > &p, const std::vector< T > &lambda)
 HyperExp(p, lambda1, lambda2): phase i chosen with probability p_i.
static Distrib hyperexp (const T &p, const T &lambda1, const T &lambda2)
static Distrib coxian (const std::vector< T > &mu, const std::vector< T > &phi)
 Coxian(mu, phi): phase i completes with probability phi(i) and otherwise moves to phase i+1.
static Distrib cox2 (const T &mu1, const T &mu2, const T &phi1)
 Cox2(mu1, mu2, phi1), MATLAB's two-phase Coxian constructor.
static Distrib phase_type (const std::vector< T > &alpha, const Matrix< T > &A, bool acyclic)
 PH / APH given by (alpha, A): D0 = A and D1 = (-A e) alpha.
static Distrib map_dist (const Matrix< T > &D0, const Matrix< T > &D1, ProcessType tag)
 A MAP given by its two matrices; the moments are those of its stationary phase.
static Distrib sched_dist (const std::vector< T > &breakpoints, const std::vector< Matrix< T > > &D0segs, const std::vector< Matrix< T > > &D1segs, bool cyclic, ProcessType tag)
 The shared constructor of the three schedule families.
static Distrib mapt (const std::vector< T > &breakpoints, const std::vector< Matrix< T > > &D0segs, const std::vector< Matrix< T > > &D1segs, bool cyclic)
 MAPt(breakpoints, {D0_k}, {D1_k}, cyclic): a piecewise-constant (D0(t), D1(t)).
static Distrib pht (const std::vector< T > &breakpoints, const std::vector< std::vector< T > > &alphas, const std::vector< Matrix< T > > &Ssegs, bool cyclic)
 PHt(breakpoints, {alpha_k}, {S_k}, cyclic), stored as its equivalent MAP schedule: D0 = S and D1 = (-S e) alpha, the pair sn_schedule_nominal builds from a PHt slot.
static Distrib nhpp (const std::vector< T > &breakpoints, const std::vector< T > &rates, bool cyclic)
 NHPP(breakpoints, rates, cyclic): a MAPt of ORDER ONE, which is what an inhomogeneous Poisson process is.
static Distrib uniform (const T &a, const T &b)
 Uniform(a, b).
static Distrib pareto (const T &shape, const T &scale)
 Pareto(shape, scale), with the MATLAB parameter order (alpha, k).
static Distrib gamma_dist (const T &shape, const T &scale)
 Gamma(shape, scale), Weibull(scale, shape) and Lognormal(mu, sigma).
static Distrib weibull (const T &scale, const T &shape)
static Distrib lognormal (const T &logmean, const T &logsigma)
static Distrib normal (const T &mu, const T &sigma)
 Normal(mu, sigma): the Gaussian, for use as a continuous Prior's parameter density.
static Distrib replayer_from (const std::vector< T > &samples, const std::string &path)
 Replayer / Trace read FROM A FILE, which keeps the path beside the samples.
static Distrib replayer (const std::vector< T > &samples)
 Replayer / Trace: the samples, with their empirical first two moments.
static Distrib discrete_uniform (const T &a, const T &b)
 DiscreteUniform(a, b) over the integers a..b inclusive.
static Distrib bernoulli (const T &p)
 Bernoulli(p): one trial, mean p and variance p(1-p).
static Distrib binomial (const T &n, const T &p)
 Binomial(n, p).
static Distrib poisson (const T &lambda)
 Poisson(lambda), whose SCV is 1/lambda – the count's variance is lambda and its mean is lambda, so this is NOT the exponential's SCV of 1.
static Distrib geometric (const T &p)
 Geometric(p) on the MATLAB convention: the NUMBER OF TRIALS to the first success, support {1, 2, ...}, so the mean is 1/p and the SCV is 1-p.
static Distrib zipf (const T &s, std::size_t n)
 Zipf(s, n) over the ranks 1..n, with the generalized harmonic moments H(s-1,n)/H(s,n) and H(s-2,n)/H(s,n) MATLAB Zipf.m uses.
static Distrib discrete_sampler (const std::vector< T > &p, const std::vector< T > &x)
 DiscreteSampler(p, x): the pmf p over the points x.
static Distrib empirical_cdf (const std::vector< T > &x, const std::vector< T > &F)
 EmpiricalCDF(x, F): the moments of the MIDPOINT rule over the CDF bins, which is what MATLAB EmpiricalCDF.getMoments integrates – each bin contributes its midpoint raised to the moment order, weighted by the CDF increment.
static Distrib me (const std::vector< T > &alpha, const Matrix< T > &A)
 ME(alpha, A): the matrix-exponential distribution, whose moments are the phase-type ones – k!
static Distrib rap (const Matrix< T > &H0, const Matrix< T > &H1)
 RAP(H0, H1): a rational arrival process, whose moments are the MAP ones.
static Distrib dmap (const Matrix< T > &D0, const Matrix< T > &D1)
 DMAP(D0, D1): a DISCRETE-time MAP, where D0 + D1 is stochastic rather than a generator.
static Distrib mmap (const Matrix< T > &D0, const std::vector< Matrix< T > > &D1k)
 MMAP: D0 plus one D1 block per mark.
static Distrib bmap (const std::vector< Matrix< T > > &D)
 BMAP: the batch-size blocks D0, D1, ..., Dk, where Dj carries an arrival of batch size j.
static T ph_moment (const std::vector< T > &alpha, const Matrix< T > &A, unsigned k)
 The k-th raw moment of a phase-type (alpha, A): k!
static T ph_moment_from (const Matrix< T > &A, std::size_t start, unsigned k)
 The same, for a representation entered in a single phase (1-based).

Public Attributes

ProcessType type = ProcessType::DISABLED
std::shared_ptr< Distrib< T > > declared
 The law as DECLARED, when this one is a surrogate fitted over it.
mean = num_traits<T>::from_int(0)
scv = num_traits<T>::from_int(1)
bool disabled = true
std::vector< T > params
 Constructor arguments, in MATLAB getParam order.
std::vector< T > trace
 Replayer / Trace samples; empty for every other type.
std::string trace_file
 The trace FILE a Replayer was read from, when there was one.
Matrix< T > D0
 The (D0,D1) pair when the type carries one directly.
Matrix< T > D1
std::vector< Matrix< T > > Dmark
 MMAP per-class D1 blocks / BMAP per-batch-size blocks; empty otherwise.
std::shared_ptr< PriorSpec< T > > prior
 The alternatives of a Prior, set only when type == PRIOR.
std::vector< T > sched_bp
 sn.proc{i}{r} = {breakpoints, A, B, cyclic} of a MAPt / PHt / NHPP.
std::vector< Matrix< T > > sched_D0
std::vector< Matrix< T > > sched_D1
bool sched_cyclic = false

Detailed Description

template<class T>
struct line::qn::Distrib< T >

Definition at line 716 of file lang_types.h.

Member Function Documentation

◆ bernoulli()

template<class T>
Distrib line::lang::Distrib< T >::bernoulli ( const T & p)
inlinestatic

Bernoulli(p): one trial, mean p and variance p(1-p).

Definition at line 1369 of file lang_types.h.

◆ binomial()

template<class T>
Distrib line::lang::Distrib< T >::binomial ( const T & n,
const T & p )
inlinestatic

Binomial(n, p).

Definition at line 1381 of file lang_types.h.

◆ bmap()

template<class T>
Distrib line::lang::Distrib< T >::bmap ( const std::vector< Matrix< T > > & D)
inlinestatic

BMAP: the batch-size blocks D0, D1, ..., Dk, where Dj carries an arrival of batch size j.

The wire form is the whole list including D0, so the head is split off here.

Definition at line 1576 of file lang_types.h.

◆ cox2()

template<class T>
Distrib line::lang::Distrib< T >::cox2 ( const T & mu1,
const T & mu2,
const T & phi1 )
inlinestatic

Cox2(mu1, mu2, phi1), MATLAB's two-phase Coxian constructor.

Definition at line 1013 of file lang_types.h.

◆ coxian()

template<class T>
Distrib line::lang::Distrib< T >::coxian ( const std::vector< T > & mu,
const std::vector< T > & phi )
inlinestatic

Coxian(mu, phi): phase i completes with probability phi(i) and otherwise moves to phase i+1.

The last phase always completes.

Definition at line 987 of file lang_types.h.

◆ det()

template<class T>
Distrib line::lang::Distrib< T >::det ( const T & m)
inlinestatic

Definition at line 858 of file lang_types.h.

◆ disabled_dist()

◆ discrete_sampler()

template<class T>
Distrib line::lang::Distrib< T >::discrete_sampler ( const std::vector< T > & p,
const std::vector< T > & x )
inlinestatic

DiscreteSampler(p, x): the pmf p over the points x.

THE MOMENTS ARE TAKEN OVER x. This port, and MATLAB DiscreteSampler.getMean with it, used to weight by the RANKS 1..n instead; the two agree on the default x = 1:n, which is the form the cache popularity vectors are written in, so the rank form survived unnoticed until a fork's jobs-per-link distribution arrived on a shifted support. The JAR and native Python already weighted by x.

Definition at line 1468 of file lang_types.h.

◆ discrete_uniform()

template<class T>
Distrib line::lang::Distrib< T >::discrete_uniform ( const T & a,
const T & b )
inlinestatic

DiscreteUniform(a, b) over the integers a..b inclusive.

Definition at line 1353 of file lang_types.h.

◆ dmap()

template<class T>
Distrib line::lang::Distrib< T >::dmap ( const Matrix< T > & D0,
const Matrix< T > & D1 )
inlinestatic

DMAP(D0, D1): a DISCRETE-time MAP, where D0 + D1 is stochastic rather than a generator.

Its moments cannot come from dist_refresh_moments's continuous formulas; dmap_moments in lang/distribution.h fills them.

Definition at line 1548 of file lang_types.h.

◆ empirical_cdf()

template<class T>
Distrib line::lang::Distrib< T >::empirical_cdf ( const std::vector< T > & x,
const std::vector< T > & F )
inlinestatic

EmpiricalCDF(x, F): the moments of the MIDPOINT rule over the CDF bins, which is what MATLAB EmpiricalCDF.getMoments integrates – each bin contributes its midpoint raised to the moment order, weighted by the CDF increment.

The rows are the (F, x) pairs in the order they arrive.

Definition at line 1499 of file lang_types.h.

◆ erlang()

template<class T>
Distrib line::lang::Distrib< T >::erlang ( const T & phase_rate,
std::size_t r )
inlinestatic

Erlang(alpha, r): r phases of rate alpha, as MATLAB's Erlang(phaseRate, nphases).

Definition at line 873 of file lang_types.h.

◆ erlang_fit()

template<class T>
Distrib line::lang::Distrib< T >::erlang_fit ( const T & m,
const T & c2 )
inlinestatic

Erlang fitted to a mean and an SCV, as MATLAB's Erlang.fitMeanAndSCV.

AN SCV ABOVE ONE IS REFUSED, not answered. An Erlang of order r has SCV = 1/r, so the family reaches 1 and no higher; ceil(1/c2) is 1 for every c2 > 1, and returning that means handing back an EXPONENTIAL under the name of the distribution the caller asked for. MATLAB errors here and this port now does too, so a mis-specified SCV is a diagnostic rather than a silently different service process.

Definition at line 904 of file lang_types.h.

◆ exp_mean()

template<class T>
Distrib line::lang::Distrib< T >::exp_mean ( const T & m)
inlinestatic

Definition at line 799 of file lang_types.h.

◆ exp_rate()

template<class T>
Distrib line::lang::Distrib< T >::exp_rate ( const T & r)
inlinestatic

◆ gamma_dist()

template<class T>
Distrib line::lang::Distrib< T >::gamma_dist ( const T & shape,
const T & scale )
inlinestatic

Gamma(shape, scale), Weibull(scale, shape) and Lognormal(mu, sigma).

Their moments are values of the gamma function or of exp, so they exist only where the arithmetic has transcendentals. Under exact arithmetic the factory REFUSES rather than storing a rounded rational: a rational that came out of tgamma is not the exact moment of the distribution, and every downstream claim of exactness would be false.

Definition at line 1231 of file lang_types.h.

◆ geometric()

template<class T>
Distrib line::lang::Distrib< T >::geometric ( const T & p)
inlinestatic

Geometric(p) on the MATLAB convention: the NUMBER OF TRIALS to the first success, support {1, 2, ...}, so the mean is 1/p and the SCV is 1-p.

Definition at line 1412 of file lang_types.h.

◆ has_map()

template<class T>
bool line::lang::Distrib< T >::has_map ( ) const
inline

True when the type carries a (D0,D1) pair of its own.

Definition at line 1587 of file lang_types.h.

◆ has_schedule()

template<class T>
bool line::lang::Distrib< T >::has_schedule ( ) const
inline

Definition at line 797 of file lang_types.h.

◆ hyperexp()

template<class T>
Distrib line::lang::Distrib< T >::hyperexp ( const T & p,
const T & lambda1,
const T & lambda2 )
inlinestatic

Definition at line 956 of file lang_types.h.

◆ hyperexp_n()

template<class T>
Distrib line::lang::Distrib< T >::hyperexp_n ( const std::vector< T > & p,
const std::vector< T > & lambda )
inlinestatic

HyperExp(p, lambda1, lambda2): phase i chosen with probability p_i.

D1(i,j) = mu(i) p(j) – the OUTER product. Associating the other way gives D1(i,j) = mu(i) p(i) replicated across the row, whose rows no longer sum with D0 to zero; _kb records that trap in the MATLAB class. The same for any number of branches, which is what MATLAB HyperExp accepts and what the writers emit as vector p and lambda. The two-branch entry point stays because it carries MATLAB's getParam order (p, lambda1, lambda2), which a parameter-by-parameter dump compares against.

Definition at line 931 of file lang_types.h.

◆ immediate()

template<class T>
Distrib line::lang::Distrib< T >::immediate ( )
inlinestatic

The Immediate singleton.

Its MEAN is zero and its RATE is 1e8, and the two are deliberately not reciprocal: MATLAB's Immediate.getMean() returns 0 while Immediate.getRate() returns GlobalConstants.Immediate, and both are read, by different callers. SolverLN reads the mean (a task with an Immediate think time contributes no think time); Network.refreshRates reads the rate (the station serves the class in 1e-8 time units, not in zero, which would be an infinite service rate the MVA recursion cannot carry). Collapsing them onto 1/mean or 1/rate breaks one caller or the other, so the type tag decides. The point mass at zero.

Its SCV is 1, NOT the 0 of a degenerate distribution. The reference makes this explicit – Immediate.getSCV returns 1 in MATLAB, in the JAR and in Python – because Immediate is realised downstream as an exponential of rate GlobalConstants.Immediate rather than as a Dirac: rate() below returns 1e8, and the SCV has to be the one that goes with it. Declaring 0 here is invisible on a layer of PS or infinite-server stations, where the AMVA correction does not read the SCV at all, and shows up only once a layer holds an FCFS or multiserver station – so it survives a model like lqn_ofbiz and breaks a model like lqn_basic.

Definition at line 846 of file lang_types.h.

Referenced by line::qn::Network< double >::set_switchover().

◆ is_immediate()

template<class T>
bool line::lang::Distrib< T >::is_immediate ( ) const
inline

Definition at line 1584 of file lang_types.h.

◆ is_prior()

template<class T>
bool line::lang::Distrib< T >::is_prior ( ) const
inline

Definition at line 776 of file lang_types.h.

◆ lognormal()

template<class T>
Distrib line::lang::Distrib< T >::lognormal ( const T & logmean,
const T & logsigma )
inlinestatic

Definition at line 1266 of file lang_types.h.

◆ map_dist()

template<class T>
Distrib line::lang::Distrib< T >::map_dist ( const Matrix< T > & D0,
const Matrix< T > & D1,
ProcessType tag )
inlinestatic

A MAP given by its two matrices; the moments are those of its stationary phase.

Definition at line 1051 of file lang_types.h.

◆ mapt()

template<class T>
Distrib line::lang::Distrib< T >::mapt ( const std::vector< T > & breakpoints,
const std::vector< Matrix< T > > & D0segs,
const std::vector< Matrix< T > > & D1segs,
bool cyclic )
inlinestatic

MAPt(breakpoints, {D0_k}, {D1_k}, cyclic): a piecewise-constant (D0(t), D1(t)).

breakpoints is the boundary vector, so it holds one more entry than there are segments and must be strictly increasing. Every segment must have the SAME ORDER: the schedule modulates one phase structure, it does not switch between structures, and a solver that integrated across a change of order would have no way to map the phase occupancy across the boundary. That is the reference's own constructor requirement.

D0 / D1 are set to the WIDTH-WEIGHTED TIME AVERAGE of the segments, which is sn_schedule_nominal's nominal pair: it is the stationary carrier of the phase structure the schedule modulates, so the phase count and the mean rate a time-blind consumer reads are the ones the model actually has.

Definition at line 1138 of file lang_types.h.

◆ me()

template<class T>
Distrib line::lang::Distrib< T >::me ( const std::vector< T > & alpha,
const Matrix< T > & A )
inlinestatic

ME(alpha, A): the matrix-exponential distribution, whose moments are the phase-type ones – k!

alpha (-A)^-k e – evaluated by DEFINITION rather than through the stationary vector of A + (-Ae)alpha. MATLAB ME.getMean makes the same choice and says why: the stationary solve is a probabilistic object that a non-Markovian A degrades badly (a CME of order 101 lost 2.6e-4 in the SCV that way, against 1e-13 by definition).

Definition at line 1532 of file lang_types.h.

◆ mmap()

template<class T>
Distrib line::lang::Distrib< T >::mmap ( const Matrix< T > & D0,
const std::vector< Matrix< T > > & D1k )
inlinestatic

MMAP: D0 plus one D1 block per mark.

D1 is their sum, the aggregate arrival matrix every unmarked consumer reads, and the blocks stay in Dmark for the ones that distinguish marks.

Definition at line 1557 of file lang_types.h.

◆ mu_vec()

template<class T>
std::vector< T > line::lang::Distrib< T >::mu_vec ( ) const
inline

Phase rates, MATLAB's getMu: the total outgoing rate of each phase.

Empty when the type carries no representation, which is what refreshProcessPhases writes as NaN for a Fork or a Join.

Definition at line 1595 of file lang_types.h.

◆ nhpp()

template<class T>
Distrib line::lang::Distrib< T >::nhpp ( const std::vector< T > & breakpoints,
const std::vector< T > & rates,
bool cyclic )
inlinestatic

NHPP(breakpoints, rates, cyclic): a MAPt of ORDER ONE, which is what an inhomogeneous Poisson process is.

Building it through the same path is what makes every schedule consumer see one representation.

Definition at line 1177 of file lang_types.h.

◆ normal()

template<class T>
Distrib line::lang::Distrib< T >::normal ( const T & mu,
const T & sigma )
inlinestatic

Normal(mu, sigma): the Gaussian, for use as a continuous Prior's parameter density.

scv is Inf at mu = 0, which is Normal.m:52-63's own answer and not a degradation: the SCV of a zero-mean law is not defined, and the reference says so rather than dividing.

Definition at line 1294 of file lang_types.h.

◆ pareto()

template<class T>
Distrib line::lang::Distrib< T >::pareto ( const T & shape,
const T & scale )
inlinestatic

Pareto(shape, scale), with the MATLAB parameter order (alpha, k).

Definition at line 1207 of file lang_types.h.

◆ ph_moment()

template<class T>
T line::lang::Distrib< T >::ph_moment ( const std::vector< T > & alpha,
const Matrix< T > & A,
unsigned k )
inlinestatic

The k-th raw moment of a phase-type (alpha, A): k!

alpha (-A)^-k e.

The inverse is never formed: the powers are accumulated by repeated solves of (-A) x = b, which is exact in rational arithmetic and stable in floating point.

Definition at line 1637 of file lang_types.h.

◆ ph_moment_from()

template<class T>
T line::lang::Distrib< T >::ph_moment_from ( const Matrix< T > & A,
std::size_t start,
unsigned k )
inlinestatic

The same, for a representation entered in a single phase (1-based).

Definition at line 1649 of file lang_types.h.

◆ phase_type()

template<class T>
Distrib line::lang::Distrib< T >::phase_type ( const std::vector< T > & alpha,
const Matrix< T > & A,
bool acyclic )
inlinestatic

PH / APH given by (alpha, A): D0 = A and D1 = (-A e) alpha.

acyclic selects the type tag only; the representation is the same, and no consumer of sn.proc distinguishes them.

Definition at line 1028 of file lang_types.h.

◆ phases()

template<class T>
std::size_t line::lang::Distrib< T >::phases ( ) const
inline

The order of the representation, MATLAB's sn.phases.

Definition at line 1625 of file lang_types.h.

◆ phi_vec()

template<class T>
std::vector< T > line::lang::Distrib< T >::phi_vec ( ) const
inline

Completion probabilities, MATLAB's getPhi: (D1 e) .

/ (-diag(D0)).

Definition at line 1607 of file lang_types.h.

◆ pht()

template<class T>
Distrib line::lang::Distrib< T >::pht ( const std::vector< T > & breakpoints,
const std::vector< std::vector< T > > & alphas,
const std::vector< Matrix< T > > & Ssegs,
bool cyclic )
inlinestatic

PHt(breakpoints, {alpha_k}, {S_k}, cyclic), stored as its equivalent MAP schedule: D0 = S and D1 = (-S e) alpha, the pair sn_schedule_nominal builds from a PHt slot.

Definition at line 1148 of file lang_types.h.

◆ poisson()

template<class T>
Distrib line::lang::Distrib< T >::poisson ( const T & lambda)
inlinestatic

Poisson(lambda), whose SCV is 1/lambda – the count's variance is lambda and its mean is lambda, so this is NOT the exponential's SCV of 1.

Definition at line 1397 of file lang_types.h.

◆ rap()

template<class T>
Distrib line::lang::Distrib< T >::rap ( const Matrix< T > & H0,
const Matrix< T > & H1 )
inlinestatic

RAP(H0, H1): a rational arrival process, whose moments are the MAP ones.

Definition at line 1539 of file lang_types.h.

◆ rate()

template<class T>
T line::lang::Distrib< T >::rate ( ) const
inline

The rate MATLAB's refreshRates would store: 1/mean, with the Immediate singleton short-circuited to its declared rate so that the reciprocal of 1e-8 is exactly 1e8 in every arithmetic rather than 1e8 plus rounding.

Definition at line 1702 of file lang_types.h.

◆ replayer()

template<class T>
Distrib line::lang::Distrib< T >::replayer ( const std::vector< T > & samples)
inlinestatic

Replayer / Trace: the samples, with their empirical first two moments.

Definition at line 1325 of file lang_types.h.

◆ replayer_from()

template<class T>
Distrib line::lang::Distrib< T >::replayer_from ( const std::vector< T > & samples,
const std::string & path )
inlinestatic

Replayer / Trace read FROM A FILE, which keeps the path beside the samples.

Every solver in this port replays trace; the path is what the EXPORTERS need. JMT is handed a ReplayerPar naming a file and has no way to take samples inline, so a Replayer exported without it is a JMT model that reads nothing – oqn_trace_driven was refused outright for exactly that.

Definition at line 1318 of file lang_types.h.

◆ sched_dist()

template<class T>
Distrib line::lang::Distrib< T >::sched_dist ( const std::vector< T > & breakpoints,
const std::vector< Matrix< T > > & D0segs,
const std::vector< Matrix< T > > & D1segs,
bool cyclic,
ProcessType tag )
inlinestatic

The shared constructor of the three schedule families.

Definition at line 1070 of file lang_types.h.

◆ uniform()

template<class T>
Distrib line::lang::Distrib< T >::uniform ( const T & a,
const T & b )
inlinestatic

Uniform(a, b).

Definition at line 1193 of file lang_types.h.

◆ weibull()

template<class T>
Distrib line::lang::Distrib< T >::weibull ( const T & scale,
const T & shape )
inlinestatic

Definition at line 1243 of file lang_types.h.

◆ zipf()

template<class T>
Distrib line::lang::Distrib< T >::zipf ( const T & s,
std::size_t n )
inlinestatic

Zipf(s, n) over the ranks 1..n, with the generalized harmonic moments H(s-1,n)/H(s,n) and H(s-2,n)/H(s,n) MATLAB Zipf.m uses.

The harmonic sums call pow for a non-integer shape, so the factory is gated on transcendental arithmetic exactly as Weibull and Lognormal are.

Definition at line 1430 of file lang_types.h.

Member Data Documentation

◆ D0

template<class T>
Matrix<T> line::lang::Distrib< T >::D0

The (D0,D1) pair when the type carries one directly.

EMPTY for Det, Uniform, Pareto, Gamma, Weibull, Lognormal and Replayer: MATLAB's getProcess returns their raw PARAMETERS there, and refreshProcessRepresentations replaces them with an Erlang approximation (convertToMAP) on the way into sn.proc. That conversion is a property of the refresh, not of the distribution, so it is not done here; see dist_to_map() in lang/distribution.h.

Definition at line 759 of file lang_types.h.

◆ D1

template<class T>
Matrix<T> line::lang::Distrib< T >::D1

Definition at line 759 of file lang_types.h.

◆ declared

template<class T>
std::shared_ptr<Distrib<T> > line::lang::Distrib< T >::declared

The law as DECLARED, when this one is a surrogate fitted over it.

sn_nonmarkov_toph installs a fitted (D0,D1) over a Gamma or a Lognormal and retags type PH or ME, after which nothing names or evaluates the law the user wrote. MMAP[K]/G[K]/1 reads that law's TRANSFORM rather than the fit, so it needs the original; every other consumer wants the surrogate and reads this struct as before. Null when no substitution has happened. A POINTER, and shared, for the reason prior below is one: an inline member would make the type self-embedding.

Definition at line 729 of file lang_types.h.

◆ disabled

template<class T>
bool line::lang::Distrib< T >::disabled = true

Definition at line 732 of file lang_types.h.

◆ Dmark

template<class T>
std::vector<Matrix<T> > line::lang::Distrib< T >::Dmark

MMAP per-class D1 blocks / BMAP per-batch-size blocks; empty otherwise.

Definition at line 761 of file lang_types.h.

◆ mean

template<class T>
T line::lang::Distrib< T >::mean = num_traits<T>::from_int(0)

Definition at line 730 of file lang_types.h.

◆ params

template<class T>
std::vector<T> line::lang::Distrib< T >::params

Constructor arguments, in MATLAB getParam order.

Definition at line 734 of file lang_types.h.

◆ prior

template<class T>
std::shared_ptr<PriorSpec<T> > line::lang::Distrib< T >::prior

The alternatives of a Prior, set only when type == PRIOR.

A POINTER, and shared: PriorSpec holds Distrib<T> values, so an inline member would make the type self-embedding, and the spec is immutable once built, so copying a service table copies a pointer rather than a design. mean and scv beside it are the MIXTURE moments, as MATLAB's Prior.getMean/getSCV return: a Prior that reaches refresh_rates therefore lowers to a rate rather than to a NaN. That is for honesty of the struct dump only – the featset gate refuses the model before any solver reads those rates, and dist_to_map, dist_lst and dist_moment refuse a Prior by name.

Definition at line 775 of file lang_types.h.

◆ sched_bp

template<class T>
std::vector<T> line::lang::Distrib< T >::sched_bp

sn.proc{i}{r} = {breakpoints, A, B, cyclic} of a MAPt / PHt / NHPP.

sched_bp has one more entry than there are segments – it is the BOUNDARY vector, so segment k is in force on [bp(k), bp(k+1)) – and sched_D0[k], sched_D1[k] are the pair of segment k, ALREADY in MAP form. A PHt is stored converted, D0 = S and D1 = (-S e) alpha, because sn_schedule_nominal converts it on every read and keeping the raw (alpha, S) here would make every consumer repeat that conversion and one of them eventually forget. The raw form is not needed: the conversion is lossless and nothing downstream asks for alpha again.

EMPTY FOR EVERY OTHER TYPE. has_schedule() is the test, and a solver with no notion of time simply never calls it – the nominal pair in D0/D1 is a complete, time-averaged answer for such a solver.

Definition at line 794 of file lang_types.h.

◆ sched_cyclic

template<class T>
bool line::lang::Distrib< T >::sched_cyclic = false

Definition at line 796 of file lang_types.h.

◆ sched_D0

template<class T>
std::vector<Matrix<T> > line::lang::Distrib< T >::sched_D0

Definition at line 795 of file lang_types.h.

◆ sched_D1

template<class T>
std::vector<Matrix<T> > line::lang::Distrib< T >::sched_D1

Definition at line 795 of file lang_types.h.

◆ scv

template<class T>
T line::lang::Distrib< T >::scv = num_traits<T>::from_int(1)

Definition at line 731 of file lang_types.h.

◆ trace

template<class T>
std::vector<T> line::lang::Distrib< T >::trace

Replayer / Trace samples; empty for every other type.

Definition at line 736 of file lang_types.h.

◆ trace_file

template<class T>
std::string line::lang::Distrib< T >::trace_file

The trace FILE a Replayer was read from, when there was one.

The samples above are what every solver in this port uses, so the path is carried only for the exporters: saveServiceStrategy hands JMT a ReplayerPar naming a file, and a Replayer exported without it is a JMT model that reads nothing. Empty when the samples were supplied directly. network_writer.h emits it for the same reason: the samples have no wire form, so without the path a Replayer is written back as the moments and reloads as a different law.

Definition at line 748 of file lang_types.h.

◆ type

template<class T>
ProcessType line::lang::Distrib< T >::type = ProcessType::DISABLED

Definition at line 717 of file lang_types.h.


The documentation for this struct was generated from the following file: