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

Namespaces

namespace  processes

Classes

struct  Distrib
struct  GlobalConstants
 The MATLAB GlobalConstants, as reported by lineStart at its defaults. More...
struct  PriorDesign
 A Prior reduced to alternatives and weights; the output of prior_discretize. More...
class  PriorRng
 The uniform stream the Monte Carlo design draws from. More...
struct  PriorSpec
 A LINE Distribution, as the model layer and sn carry it. More...

Typedefs

template<class T>
using CdScaling = std::function<std::vector<T>(const std::vector<T>&)>
 A class-dependent scaling map, sn.cdscaling.
template<class T>
using GdScaling = std::function<std::vector<T>(const std::vector<T>&)>
 A globally state-dependent scaling, sn.gdscaling.

Enumerations

enum class  MetricType {
  ResidT = 0 , RespT = 1 , DropRate = 2 , QLen = 3 ,
  QueueT = 4 , FCRWeight = 5 , FCRMemOcc = 6 , FJQLen = 7 ,
  FJRespT = 8 , RespTSink = 9 , SysQLen = 10 , SysRespT = 11 ,
  SysTput = 12 , Tput = 13 , ArvR = 14 , TputSink = 15 ,
  Util = 16 , TranQLen = 17 , TranUtil = 18 , TranTput = 19 ,
  TranRespT = 20 , Tard = 21 , SysTard = 22
}
 Solver output metrics, with the numeric values of MATLAB MetricType. More...
enum class  EventType {
  INIT = -1 , LOCAL = 0 , ARV = 1 , DEP = 2 ,
  PHASE = 3 , READ = 4 , STAGE = 5 , ENABLE = 6 ,
  FIRE = 7 , PRE = 8 , POST = 9 , RENEGE = 10 ,
  RETRY = 11 , SWITCH = 12 , FAILURE = 13 , REPAIR = 14 ,
  START = 15 , PREEMPT = 16
}
 The events a state can undergo, with the values of MATLAB EventType. More...
enum class  SignalType { REPLY = 0 , NEGATIVE = 1 , CATASTROPHE = 2 }
 G-network signal classes, with the values of MATLAB SignalType. More...
enum class  RemovalPolicy { RANDOM = 0 , FCFS = 1 , LCFS = 2 }
 Which job a negative signal removes, with the values of MATLAB RemovalPolicy. More...
enum class  SchedStrategy {
  INF = 0 , FCFS = 1 , LCFS = 2 , SIRO = 3 ,
  SJF = 4 , LJF = 5 , PS = 6 , DPS = 7 ,
  GPS = 8 , SEPT = 9 , LEPT = 10 , HOL = 11 ,
  FORK = 12 , EXT = 13 , REF = 14 , LCFSPR = 15 ,
  POLLING = 16 , PSPRIO = 17 , DPSPRIO = 18 , GPSPRIO = 19 ,
  LCFSPI = 20 , LCFSPRIO = 21 , LCFSPRPRIO = 22 , LCFSPIPRIO = 23 ,
  FCFSPR = 24 , FCFSPI = 25 , FCFSPRPRIO = 26 , FCFSPIPRIO = 27 ,
  SRPT = 28 , SRPTPRIO = 29 , EDD = 30 , EDF = 31 ,
  LPS = 32 , PSJF = 33 , FB = 34 , LRPT = 35 ,
  SETF = 36 , FSP = 37 , PAS = 38 , OI = 39 ,
  NONE = -1
}
 Scheduling disciplines, with the values of MATLAB SchedStrategy. More...
enum class  NodeType {
  Queue = 0 , Source = 1 , Delay = 2 , ClassSwitch = 3 ,
  Logger = 4 , Cache = 5 , Router = 6 , Fork = 7 ,
  Place = 8 , Transition = 9 , Region = 10 , Join = 11 ,
  Sink = 12
}
 Node kinds, with the values of MATLAB NodeType. More...
enum class  TimingStrategy { TIMED = 0 , IMMEDIATE = 1 }
 SPN transition timing, with the values of MATLAB TimingStrategy. More...
enum class  JobClassType { OPEN = 0 , CLOSED = 1 }
 Job class kinds, with the values of MATLAB JobClassType. More...
enum class  PollingType { GATED = 0 , EXHAUSTIVE = 1 , KLIMITED = 2 , DECREMENTING = 3 }
 Polling service disciplines, with the values of MATLAB PollingType. More...
enum class  ReplacementStrategy {
  RR = 0 , FIFO = 1 , SFIFO = 2 , LRU = 3 ,
  HLRU = 4 , CLIMB = 5 , QLRU = 6
}
 Cache replacement policies, with the values of MATLAB ReplacementStrategy. More...
enum class  RoutingStrategy {
  RAND = 0 , PROB = 1 , RROBIN = 2 , WRROBIN = 3 ,
  JSQ = 4 , FIRING = 5 , SQ = 6 , SDR = 7 ,
  DISABLED = -1
}
 Routing strategies, with the values of MATLAB RoutingStrategy. More...
enum class  DropStrategy {
  WAITQ = -1 , DROP = 1 , BAS = 2 , BBS = 3 ,
  RSRD = 4 , RETRIAL = 5 , RETRIAL_WITH_LIMIT = 6
}
 Blocking and loss rules, with the values of MATLAB DropStrategy. More...
enum class  ImpatienceType { NONE = 0 , RENEGING = 1 , BALKING = 2 , RETRIAL = 3 }
 Impatience kinds, with the values of MATLAB ImpatienceType. More...
enum class  BalkingStrategy { NONE = 0 , QUEUE_LENGTH = 1 , EXPECTED_WAIT = 2 , COMBINED = 3 }
 Balking rules, with the values of MATLAB BalkingStrategy. More...
enum class  HeteroSchedPolicy {
  ORDER = 0 , ALIS = 1 , ALFS = 2 , FAIRNESS = 3 ,
  FSF = 4 , RAIS = 5
}
 How a heterogeneous station picks among its server types, MATLAB HeteroSchedPolicy. More...
enum class  DepartureDiscipline { NORMAL = 0 , FIFO = 1 }
 When a Place releases a served token, MATLAB DepartureDiscipline. More...
enum class  JoinStrategy { STD = 1 , PARTIAL = 2 }
 Join rules, with the values of MATLAB JoinStrategy. More...
enum class  LqnElement {
  HOST = 0 , TASK = 1 , ENTRY = 2 , ACTIVITY = 3 ,
  CALL = 4
}
 LQN element kinds, with the values of MATLAB LayeredNetworkElement. More...
enum class  CallType { NONE = 0 , SYNC = 1 , ASYNC = 2 , FWD = 3 }
 Call kinds, with the values of MATLAB CallType. More...
enum class  PrecedenceType {
  NONE = 0 , PRE_SEQ = 1 , PRE_AND = 2 , PRE_OR = 3 ,
  POST_SEQ = 11 , POST_AND = 12 , POST_OR = 13 , POST_LOOP = 14 ,
  POST_CACHE = 15
}
 Activity precedence kinds, with the values of MATLAB ActivityPrecedenceType. More...
enum class  ProcessType {
  EXP = 0 , ERLANG = 1 , HYPEREXP = 2 , PH = 3 ,
  APH = 4 , MAP = 5 , UNIFORM = 6 , DET = 7 ,
  COXIAN = 8 , GAMMA = 9 , PARETO = 10 , MMPP2 = 11 ,
  REPLAYER = 12 , IMMEDIATE = 13 , DISABLED = 14 , COX2 = 15 ,
  WEIBULL = 16 , LOGNORMAL = 17 , DUNIFORM = 18 , BERNOULLI = 19 ,
  PRIOR = 20 , BINOMIAL = 21 , POISSON = 22 , GEOMETRIC = 23 ,
  BMAP = 24 , ME = 25 , RAP = 26 , DISCRETESAMPLER = 27 ,
  ZIPF = 28 , DMAP = 29 , MMAP = 31 , EMPIRICALCDF = 32 ,
  NHPP = 33 , MAPT = 34 , PHT = 35 , NORMAL = 100 ,
  NONE = -1
}
 Distribution kinds, with the values of MATLAB ProcessType. More...

Functions

template<class T>
Distrib< T > ph_from_map (const mam::Map< T > &m, bool acyclic)
 A PH distribution from a fitted (D0, D1) pair.
template<class T>
Distrib< T > 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 > 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 > 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 > coxian_fit_mean_scv (const T &mean, const T &scv)
 Coxian.fitMeanAndSCV(MEAN, SCV), branch for branch.
template<class T>
Distrib< T > 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 > 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 > 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 > 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 > 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 > 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.
template<class T>
Distrib< T > dist_scale_rate (const Distrib< T > &d, const T &factor)
 The law of X / factor, in the same family as d.
unsigned convert_to_map_phases (double scv)
 The number of Erlang phases convertToMAP picks for a non-Markovian distribution: 20 when the SCV is below CoarseTol (a Det, or near one), and otherwise ceil(1/SCV) capped at 100.
void reject_prior (const char *who)
 The (D0,D1) pair that reaches sn.proc.
template<class T>
void dmap_refresh_moments (Distrib< T > &d)
 The first two moments of a DISCRETE-time MAP, from its own law.
template<class T>
mam::Map< T > dist_to_map (const Distrib< T > &d)
template<class T>
std::vector< T > dist_pie (const Distrib< T > &d)
 sn.pie: the phase distribution seen by an arriving job.
template<class T>
void dist_refresh_moments (Distrib< T > &d)
 Fill in the first two moments of a distribution given by its matrices.
template<class T>
dist_lst (const Distrib< T > &d, const T &s)
 sn.lst: the Laplace-Stieltjes transform E[exp(-sX)].
template<class T>
dist_cdf (const Distrib< T > &d, const T &x)
 F(x) = P{X <= x}, MATLAB's Distribution.evalCDF.
template<class T>
dist_moment (const Distrib< T > &d, unsigned k)
 The k-th raw moment.
template<class T>
std::complex< double > dist_lst (const Distrib< T > &d, const std::complex< double > &s)
 sn.lst at a COMPLEX argument, E[exp(-sX)] with s off the real axis.
template<class T>
dist_quantile (const Distrib< T > &d, const T &p)
 The p-quantile, by bisection on dist_cdf.
template<class T>
infer::NhppKsResult< T > dist_is_nhpp (const Distrib< T > &d)
 Port of Replayer.isNHPP: test whether a trace is a sample path of a NON-HOMOGENEOUS POISSON process, by the conditional-uniform KS test with the Lewis refinement (infer_nhpp_ks).
const char * metric_to_text (MetricType metric)
 Port of MetricType.toText.
const char * event_to_text (EventType e)
const char * sched_to_text (SchedStrategy s)
SchedStrategy sched_from_lqnx (const std::string &s)
 Parse the scheduling attribute of an .lqnx processor or task.
std::string sched_to_lqnx (SchedStrategy s)
 The scheduling attribute an .lqnx processor or task carries for a strategy.
const char * node_type_to_text (NodeType t)
 Name of a node kind, for diagnostics.
const char * routing_to_text (RoutingStrategy r)
const char * process_to_text (ProcessType p)
 The MATLAB ProcessType name, as sn.procid prints it.
bool process_is_markovian (ProcessType p)
 ProcessType.isMarkovian: true when sn.proc carries an exact matrix representation of the law, rather than the Erlang fit convertToMAP leaves there for the parameter-only families.
template<class T>
Distrib< T > prior_discrete (const std::vector< Distrib< T > > &alternatives, const std::vector< T > &probabilities)
 Prior(distributions, probabilities): the discrete form.
template<class T>
Distrib< T > prior_continuous (const Distrib< T > &param_dist, const std::function< Distrib< T >(const T &)> &factory)
 Prior(paramDist, distFactory): the continuous form.
template<class T>
Distrib< T > prior_from_sample (std::size_t k, const T &s, const std::function< Distrib< T >(const T &)> &factory=std::function< Distrib< T >(const T &)>())
 Prior.fromSample(k, s): the posterior of a rate estimated from lifetime data.
template<class T>
PriorDesign< T > prior_discretize (const Distrib< T > &d, std::size_t n, const std::string &method, PriorRng &rng)
 Reduce a Prior to n weighted alternatives, MATLAB Prior.discretize.
template<class T>
PriorDesign< T > prior_discretize (const Distrib< T > &d)
 prior_discretize with the defaults of Prior.discretize: 11 quadrature nodes.
template<class T>
prior_mean (const Distrib< T > &d)
 E[X] = sum_i p_i E[X_i], MATLAB Prior.getMean.
template<class T>
prior_scv (const Distrib< T > &d)
 The SCV by the law of total variance, MATLAB Prior.getSCV.
template<class T>
prior_skewness (const Distrib< T > &d)
 The skewness of the mixture, MATLAB Prior.getSkewness.
template<class T>
prior_cdf (const Distrib< T > &d, const T &t)
 F(t) = sum_i p_i F_i(t), MATLAB Prior.evalCDF.
template<class T>
prior_lst (const Distrib< T > &d, const T &s)
 L(s) = sum_i p_i L_i(s), MATLAB Prior.evalLST.
template<class T>
void prior_refresh_moments (Distrib< T > &d)
 Write the mixture moments onto a Prior, the counterpart of dist_refresh_moments for the Markovian families.

Variables

constexpr std::size_t kPriorDefaultNodes = 11
 The default number of nodes per continuous Prior, MATLAB options.samples.

Typedef Documentation

◆ CdScaling

template<class T>
using line::lang::CdScaling = std::function<std::vector<T>(const std::vector<T>&)>

A class-dependent scaling map, sn.cdscaling.

It takes the per-class population vector at one station and returns the per-class rate multipliers, which is the signature pfqn_cdfun consumes; the alias resolves to the same std::function type as pfqn::CdScaling, so a map built here is passed straight through to the api layer.

Definition at line 639 of file lang_types.h.

◆ GdScaling

template<class T>
using line::lang::GdScaling = std::function<std::vector<T>(const std::vector<T>&)>

A globally state-dependent scaling, sn.gdscaling.

Unlike CdScaling it is declared on the NETWORK, not on a station: the argument is the FULL population matrix, given row-major as nstations rows of nclasses entries, and the result is either one scalar, one entry per station, or one entry per (station, class) in the same row-major order. This is the Whittle primitive – a rate that reads the whole state – and no per-station scaling can express it when one route holds several resources at once.

Definition at line 652 of file lang_types.h.

Enumeration Type Documentation

◆ BalkingStrategy

enum class line::lang::BalkingStrategy
strong

Balking rules, with the values of MATLAB BalkingStrategy.

Enumerator
NONE 
QUEUE_LENGTH 
EXPECTED_WAIT 
COMBINED 

Definition at line 445 of file lang_types.h.

◆ CallType

enum class line::lang::CallType
strong

Call kinds, with the values of MATLAB CallType.

Enumerator
NONE 
SYNC 
ASYNC 
FWD 

Definition at line 467 of file lang_types.h.

◆ DepartureDiscipline

When a Place releases a served token, MATLAB DepartureDiscipline.

NORMAL is the standard queueing-Petri-net rule (available on completion); FIFO holds it until every earlier arrival to the depository has been released.

Enumerator
NORMAL 
FIFO 

Definition at line 458 of file lang_types.h.

◆ DropStrategy

enum class line::lang::DropStrategy
strong

Blocking and loss rules, with the values of MATLAB DropStrategy.

WAITQ is -1 and is also the marker refreshCapacity writes where the rule is never consulted (an unbounded station, or a closed class), so it means two different things depending on the station's capacity; see the comment in refresh_capacity().

Enumerator
WAITQ 
DROP 
BAS 
BBS 
RSRD 
RETRIAL 
RETRIAL_WITH_LIMIT 

Definition at line 424 of file lang_types.h.

◆ EventType

enum class line::lang::EventType
strong

The events a state can undergo, with the values of MATLAB EventType.

An event is ACTIVE at the node that schedules it and PASSIVE at the node that receives it: a DEP at one station is the ARV at the next, and only the active half carries a rate. The passive half is marked with a rate of -1, which the generator assembly replaces with the active rate – a convention that only reads as a sentinel because a rate can never be negative.

Enumerator
INIT 

the model is initialized, t = 0

LOCAL 

dummy event, no state change outside the node

ARV 

a job arrives

DEP 

a job departs

PHASE 

service advances a phase WITHOUT departing

READ 

a cache item is read

STAGE 

a random environment changes stage

ENABLE 

an SPN mode becomes enabled

FIRE 

an SPN mode fires

PRE 

consume from a place or queue buffer, no server effect

POST 

produce to a place or queue buffer

RENEGE 

a waiting job abandons the queue (impatience)

RETRY 

an orbiting job retries entry at a retrial station

SWITCH 

a polling server advances its switchover timer

FAILURE 

the server breaks down, going from up to down

REPAIR 

the server is repaired, going from down to up, resuming the held job, which is why it emits no START

START 

a job begins or resumes holding a server

PREEMPT 

a job holding a server is pushed back into the buffer

Definition at line 111 of file lang_types.h.

◆ HeteroSchedPolicy

enum class line::lang::HeteroSchedPolicy
strong

How a heterogeneous station picks among its server types, MATLAB HeteroSchedPolicy.

ORDER is the default: the declared order of the types.

Enumerator
ORDER 
ALIS 
ALFS 
FAIRNESS 
FSF 
RAIS 

Definition at line 451 of file lang_types.h.

◆ ImpatienceType

enum class line::lang::ImpatienceType
strong

Impatience kinds, with the values of MATLAB ImpatienceType.

RENEGING is a timer a job started at a queue; BALKING is a decision taken BEFORE joining, on the state of the queue, and is parameterized by Station::balking rather than by a distribution; RETRIAL sends the job to an orbit and is parameterized by RetrialParam.

Enumerator
NONE 
RENEGING 
BALKING 
RETRIAL 

Definition at line 442 of file lang_types.h.

◆ JobClassType

enum class line::lang::JobClassType
strong

Job class kinds, with the values of MATLAB JobClassType.

Enumerator
OPEN 
CLOSED 

Definition at line 367 of file lang_types.h.

◆ JoinStrategy

enum class line::lang::JoinStrategy
strong

Join rules, with the values of MATLAB JoinStrategy.

Enumerator
STD 
PARTIAL 

Definition at line 461 of file lang_types.h.

◆ LqnElement

enum class line::lang::LqnElement
strong

LQN element kinds, with the values of MATLAB LayeredNetworkElement.

Enumerator
HOST 
TASK 
ENTRY 
ACTIVITY 
CALL 

Definition at line 464 of file lang_types.h.

◆ MetricType

enum class line::lang::MetricType
strong

Solver output metrics, with the numeric values of MATLAB MetricType.

Enumerator
ResidT 
RespT 
DropRate 
QLen 
QueueT 
FCRWeight 
FCRMemOcc 
FJQLen 
FJRespT 
RespTSink 
SysQLen 
SysRespT 
SysTput 
Tput 
ArvR 
TputSink 
Util 
TranQLen 
TranUtil 
TranTput 
TranRespT 
Tard 
SysTard 

Definition at line 46 of file lang_types.h.

◆ NodeType

enum class line::lang::NodeType
strong

Node kinds, with the values of MATLAB NodeType.

Enumerator
Queue 
Source 
Delay 
ClassSwitch 
Logger 
Cache 
Router 
Fork 
Place 
Transition 
Region 
Join 
Sink 

Definition at line 324 of file lang_types.h.

◆ PollingType

enum class line::lang::PollingType
strong

Polling service disciplines, with the values of MATLAB PollingType.

Enumerator
GATED 

serve exactly the jobs present at the polling instant

EXHAUSTIVE 

serve until the queue empties

KLIMITED 

serve at most K per visit (K in pollingPar)

DECREMENTING 

serve until the queue is one shorter than at arrival

Definition at line 370 of file lang_types.h.

◆ PrecedenceType

enum class line::lang::PrecedenceType
strong

Activity precedence kinds, with the values of MATLAB ActivityPrecedenceType.

Enumerator
NONE 
PRE_SEQ 
PRE_AND 
PRE_OR 
POST_SEQ 
POST_AND 
POST_OR 
POST_LOOP 
POST_CACHE 

Definition at line 470 of file lang_types.h.

◆ ProcessType

enum class line::lang::ProcessType
strong

Distribution kinds, with the values of MATLAB ProcessType.

Enumerator
EXP 
ERLANG 
HYPEREXP 
PH 
APH 
MAP 
UNIFORM 
DET 
COXIAN 
GAMMA 
PARETO 
MMPP2 
REPLAYER 
IMMEDIATE 
DISABLED 
COX2 
WEIBULL 
LOGNORMAL 
DUNIFORM 
BERNOULLI 
PRIOR 

A Prior: a weighted set of ALTERNATIVE distributions, or a density over a scalar parameter plus a factory from it.

It is not a mixture – each alternative is a separate model realization – and only SolverUQ consumes it; every other solver refuses it through Feature::Prior.

BINOMIAL 
POISSON 
GEOMETRIC 
BMAP 
ME 
RAP 
DISCRETESAMPLER 
ZIPF 
DMAP 
MMAP 
EMPIRICALCDF 
NHPP 

The time-INHOMOGENEOUS families of Ko and Pender (ORL 45, 2017): an NHPP is a rate schedule lambda(t), a MAPt a (D0(t), D1(t)) schedule and a PHt an (alpha(t), S(t)) one, all piecewise constant on one breakpoint vector and optionally cyclic.

The numeric values are MATLAB's (ProcessType.m:41-43).

THEY CARRY A NOMINAL PAIR TOO. Distrib::D0/D1 hold the width-weighted time average of the schedule, which is what sn_schedule_nominal returns as its first two outputs and what every consumer that has no notion of time – the phase count, the rate, the fluid layout – reads. The schedule itself lives in sched_bp/sched_D0/sched_D1 beside it, and only a solver that integrates in time looks at it.

MAPT 
PHT 
NORMAL 

A Gaussian, and the ONE family whose value is not MATLAB's, because MATLAB has none to copy: ProcessType.m stops at 35 and Normal.m is a ContinuousDistribution with no id at all, exactly as Normal.java and the python Normal have none.

That is not an oversight in the reference – a Gaussian has mass below zero, so it can never be a service or interarrival process and can never appear in sn.proc. It reaches this port only as the PARAMETER density of a continuous Prior, where it is read through dist_cdf and dist_quantile and never through dist_to_map.

The value is deliberately far outside 0..35 so that it can never collide with an id MATLAB assigns later; sn.procid must never carry it, and dist_to_map refuses it by name rather than handing back the Erlang fit its default arm would otherwise produce for a law with negative support.

NONE 

Definition at line 483 of file lang_types.h.

◆ RemovalPolicy

enum class line::lang::RemovalPolicy
strong

Which job a negative signal removes, with the values of MATLAB RemovalPolicy.

Enumerator
RANDOM 

uniform over waiting AND in-service jobs

FCFS 

the oldest waiting job; servers only once nobody waits

LCFS 

the newest waiting job; servers only once nobody waits

Definition at line 174 of file lang_types.h.

◆ ReplacementStrategy

Cache replacement policies, with the values of MATLAB ReplacementStrategy.

Enumerator
RR 

random replacement

FIFO 

first in, first out

SFIFO 

strict FIFO

LRU 

least recently used

HLRU 

h-LRU / LRU(m): h lists, promote i -> i+1 on a hit

CLIMB 

move up one position on a hit (transposition rule)

QLRU 

q-LRU: LRU with probabilistic admission on a miss

Definition at line 378 of file lang_types.h.

◆ RoutingStrategy

enum class line::lang::RoutingStrategy
strong

Routing strategies, with the values of MATLAB RoutingStrategy.

Enumerator
RAND 
PROB 
RROBIN 
WRROBIN 
JSQ 
FIRING 
SQ 
SDR 

Krzesinski (1987) product-form state-dependent routing.

DISABLED 

Definition at line 389 of file lang_types.h.

◆ SchedStrategy

enum class line::lang::SchedStrategy
strong

Scheduling disciplines, with the values of MATLAB SchedStrategy.

Enumerator
INF 
FCFS 
LCFS 
SIRO 
SJF 
LJF 
PS 
DPS 
GPS 
SEPT 
LEPT 
HOL 
FORK 
EXT 
REF 
LCFSPR 
POLLING 
PSPRIO 
DPSPRIO 
GPSPRIO 
LCFSPI 
LCFSPRIO 
LCFSPRPRIO 
LCFSPIPRIO 
FCFSPR 
FCFSPI 
FCFSPRPRIO 
FCFSPIPRIO 
SRPT 
SRPTPRIO 
EDD 
EDF 
LPS 
PSJF 
FB 
LRPT 
SETF 
FSP 
PAS 
OI 
NONE 

Definition at line 181 of file lang_types.h.

◆ SignalType

enum class line::lang::SignalType
strong

G-network signal classes, with the values of MATLAB SignalType.

A signal is not a job: it never joins a station, it acts on the jobs already there and is annihilated. REPLY is the odd one out – it completes a synchronous call and then joins as an ordinary job.

Enumerator
REPLY 

completes a synchronous call, releasing a held server

NEGATIVE 

removes a batch of jobs (Gelenbe's negative customer)

CATASTROPHE 

removes EVERY job at the station

Definition at line 167 of file lang_types.h.

◆ TimingStrategy

enum class line::lang::TimingStrategy
strong

SPN transition timing, with the values of MATLAB TimingStrategy.

Enumerator
TIMED 

fires after its firing distribution elapses

IMMEDIATE 

fires with zero delay, resolved by weight and priority

Definition at line 361 of file lang_types.h.

Function Documentation

◆ aph_fit_central()

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.

Definition at line 252 of file dist_fitters.h.

References line::mam::aph_fit(), aph_fit_central(), and ph_from_map().

Referenced by aph_fit_central(), and line::LINE_DIST_CTOR().

◆ aph_fit_mean_scv()

template<class T>
Distrib< T > line::lang::aph_fit_mean_scv ( const T & mean,
const T & scv )

◆ convert_to_map_phases()

unsigned line::lang::convert_to_map_phases ( double scv)
inline

The number of Erlang phases convertToMAP picks for a non-Markovian distribution: 20 when the SCV is below CoarseTol (a Det, or near one), and otherwise ceil(1/SCV) capped at 100.

The cap is what makes the approximation one-sided: a Pareto of SCV 64 gets a single phase (an exponential), so the approximation matches the mean and NOT the SCV whenever the SCV exceeds 1. That is the reference's behaviour and the reason sn.scv is read from the distribution rather than from sn.proc.

Definition at line 62 of file distribution.h.

References line::lang::GlobalConstants::CoarseTol, and convert_to_map_phases().

Referenced by convert_to_map_phases(), and dist_to_map().

◆ cox2_fit_central()

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.

Both roots of the moment condition are tried in the reference's order, and the fallback when neither is feasible is the reference's: fitMeanAndSCV above SCV = 1/2 and the exponential of that mean below it.

Definition at line 197 of file dist_fitters.h.

References line::lang::Distrib< T >::cox2(), cox2_fit_central(), coxian_fit_mean_scv(), and line::lang::Distrib< T >::exp_mean().

Referenced by cox2_fit_central(), coxian_fit_central(), and line::LINE_DIST_CTOR().

◆ coxian_fit_central()

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.

Definition at line 233 of file dist_fitters.h.

References cox2_fit_central(), and coxian_fit_central().

Referenced by coxian_fit_central(), and line::LINE_DIST_CTOR().

◆ coxian_fit_mean_scv()

template<class T>
Distrib< T > line::lang::coxian_fit_mean_scv ( const T & mean,
const T & scv )

Coxian.fitMeanAndSCV(MEAN, SCV), branch for branch.

SCV below 1/2 is matched by an ERLANG of order ceil(1/SCV) expressed as a Coxian with every phi zero but the last – the reference's own choice, and the reason this cannot be routed through Distrib::erlang: the order it picks matches the mean exactly and the SCV only from below.

Definition at line 157 of file dist_fitters.h.

References line::lang::GlobalConstants::CoarseTol, line::lang::Distrib< T >::coxian(), and coxian_fit_mean_scv().

Referenced by cox2_fit_central(), coxian_fit_mean_scv(), and line::LINE_DIST_CTOR().

◆ dist_cdf()

template<class T>
T line::lang::dist_cdf ( const Distrib< T > & d,
const T & x )

F(x) = P{X <= x}, MATLAB's Distribution.evalCDF.

WHY IT EXISTS AT ALL in a port whose solvers read moments and transforms: it is the only thing Prior.discretize needs. The quadrature design of SolverUQ places its nodes at the conditional medians of equal-mass strata of the parameter density, which is an inverse CDF and nothing else, so a parameter law of any family can be discretized with no per-family quantile.

PER FAMILY, from the closed form the reference's own class uses – the Erlang from its Poisson sum, the Gamma from the regularized incomplete gamma, the Pareto from gpcdf reduced to 1 - (k/x)^alpha – rather than from the Erlang approximation of dist_to_map, for the same reason dist_moment does: the approximation matches only the mean once the SCV exceeds one. The phase-type and MAP families fall through to 1 - pie exp(D0 x) e, which is map_cdf.

ONE DELIBERATE DIVERGENCE FROM THE REFERENCE, and it is a defect on the other side: Uniform.evalCDF in MATLAB returns the constant DENSITY 1/(b-a) inside the support and 0 above it, so it is neither a CDF nor monotone. Reproducing that would make the bisection below fail to bracket rather than return a matching wrong number, and no ported quantity reads it, so the correct (x-a)/(b-a) is computed here. Recorded in BUGS.md.

Definition at line 694 of file distribution.h.

References line::Matrix< T >::cols(), line::mam::Map< T >::D0, DET, line::lang::Distrib< T >::disabled, dist_cdf(), dist_to_map(), ERLANG, EXP, line::expm(), GAMMA, line::mam::gammainc_lower(), HYPEREXP, IMMEDIATE, line::InputError::InputError(), line::lang::Distrib< T >::is_prior(), LOGNORMAL, line::mam::map_pie(), NORMAL, line::lang::Distrib< T >::params, PARETO, REPLAYER, line::Matrix< T >::rows(), line::lang::Distrib< T >::trace, line::lang::Distrib< T >::type, UNIFORM, line::UnsupportedError::UnsupportedError(), and WEIBULL.

Referenced by dist_cdf(), dist_lst(), dist_quantile(), and prior_cdf().

◆ dist_is_nhpp()

template<class T>
infer::NhppKsResult< T > line::lang::dist_is_nhpp ( const Distrib< T > & d)

Port of Replayer.isNHPP: test whether a trace is a sample path of a NON-HOMOGENEOUS POISSON process, by the conditional-uniform KS test with the Lewis refinement (infer_nhpp_ks).

WHY THE QUESTION IS WORTH ASKING. A Replayer is used wherever a measured stream is fed to a solver, and every analytical method that consumes it as an arrival process assumes SOMETHING about its dependence structure. This test says whether the Poisson assumption – independent increments, whatever the rate does with time – survives contact with the data, which is the assumption a time-varying analysis (mtginf, mol, tvms) rests on. A small p-value says the stream is not Poisson at any rate function, so those methods are answering a different process.

The trace holds INTER-ARRIVAL times, so the arrival epochs are their cumulative sum and the horizon is the last of them.

Definition at line 888 of file distribution.h.

References dist_is_nhpp(), line::infer::infer_nhpp_ks(), line::InputError::InputError(), and line::lang::Distrib< T >::trace.

Referenced by dist_is_nhpp().

◆ dist_lst() [1/2]

template<class T>
std::complex< double > line::lang::dist_lst ( const Distrib< T > & d,
const std::complex< double > & s )

sn.lst at a COMPLEX argument, E[exp(-sX)] with s off the real axis.

WHY A SECOND OVERLOAD. A transform is evaluated off the real axis by anything that inverts it or locates its roots: the Abate-Whitt Euler sum walks the line Re(s) = A/(2t), and a matrix transform int exp(Ut) dF(t) is read off the spectrum of U, which is complex in general. dist_lst(d, s) above is templated on the arithmetic type T and returns T, so it cannot answer either; this twin fixes the argument and the result at std::complex<double>, since a complex transform is meaningless without transcendental arithmetic anyway. Parity note: the JAR carries the same capability by widening sn.lst to SerializableFunction<Complex, Complex>, MATLAB by its own closed forms, and python by Distribution.evalLST accepting a complex argument.

THE TIERS mirror the real overload exactly: a closed form where the family has one, the phase-type solve where the law is Markovian, and the CDF-increment sum otherwise – the last being a proper measure for ANY law, including one with an atom and one with no density.

Definition at line 458 of file distribution.h.

References line::mam::Map< T >::D0, DET, line::lang::Distrib< T >::disabled, dist_cdf(), dist_lst(), dist_moment(), dist_to_map(), GAMMA, IMMEDIATE, line::InputError::InputError(), line::lang::Distrib< T >::is_prior(), line::mam::map_pie(), line::lang::Distrib< T >::mean, NORMAL, line::NumericError::NumericError(), line::lang::Distrib< T >::params, process_is_markovian(), reject_prior(), REPLAYER, line::lang::Distrib< T >::trace, line::lang::Distrib< T >::type, and UNIFORM.

◆ dist_lst() [2/2]

template<class T>
T line::lang::dist_lst ( const Distrib< T > & d,
const T & s )

sn.lst: the Laplace-Stieltjes transform E[exp(-sX)].

The phase-type families evaluate the closed form pie (sI - D0)^-1 (-D0) e; for a MAP that is the transform of its stationary interarrival time, which is the quantity the M/G/1 analyzers want.

Definition at line 227 of file distribution.h.

References line::mam::Map< T >::D0, DET, line::lang::Distrib< T >::disabled, dist_lst(), dist_to_map(), GAMMA, IMMEDIATE, line::InputError::InputError(), line::lang::Distrib< T >::is_prior(), LOGNORMAL, line::mam::map_pie(), line::lang::Distrib< T >::mean, NORMAL, line::NumericError::NumericError(), line::lang::Distrib< T >::params, PARETO, reject_prior(), REPLAYER, line::lang::Distrib< T >::trace, line::lang::Distrib< T >::type, UNIFORM, line::UnsupportedError::UnsupportedError(), and WEIBULL.

Referenced by dist_lst(), dist_lst(), prior_lst(), and line::mva::solver_mva_qsys_analyzer().

◆ dist_moment()

template<class T>
T line::lang::dist_moment ( const Distrib< T > & d,
unsigned k )

The k-th raw moment.

The closed-form families are evaluated from their parameters, as the MATLAB classes do, rather than from the Erlang approximation of sn.proc: the approximation matches only the mean once the SCV exceeds 1.

Definition at line 570 of file distribution.h.

References DET, line::lang::Distrib< T >::disabled, dist_moment(), dist_to_map(), GAMMA, IMMEDIATE, line::InputError::InputError(), line::lang::Distrib< T >::is_prior(), LOGNORMAL, line::mam::map_moment(), line::lang::Distrib< T >::mean, NORMAL, line::NumericError::NumericError(), line::lang::Distrib< T >::params, PARETO, reject_prior(), REPLAYER, line::lang::Distrib< T >::trace, line::lang::Distrib< T >::type, UNIFORM, line::UnsupportedError::UnsupportedError(), and WEIBULL.

Referenced by dist_lst(), dist_moment(), prior_skewness(), and line::qsys::qsys_mmapgk1().

◆ dist_pie()

template<class T>
std::vector< T > line::lang::dist_pie ( const Distrib< T > & d)

sn.pie: the phase distribution seen by an arriving job.

Definition at line 193 of file distribution.h.

References dist_pie(), dist_to_map(), and line::mam::map_pie().

Referenced by line::retrieval::cache_retrieval_inputs(), dist_pie(), and line::io::jmt_dist_view().

◆ dist_quantile()

template<class T>
T line::lang::dist_quantile ( const Distrib< T > & d,
const T & p )

The p-quantile, by bisection on dist_cdf.

Port of Prior.quantile: bracketing starts at the mean and doubles outward, which terminates for any law with a finite mean, and the search then halves 200 times or until the bracket is within FineTol of its own width. Using only the CDF is what makes it applicable to every family at once, which is the reason Prior.discretize is written in probability space rather than in parameter space.

Definition at line 820 of file distribution.h.

References dist_cdf(), dist_quantile(), line::lang::GlobalConstants::FineTol, line::InputError::InputError(), line::lang::Distrib< T >::mean, NORMAL, line::NumericError::NumericError(), line::lang::Distrib< T >::params, and line::lang::Distrib< T >::type.

Referenced by dist_quantile(), prior_continuous(), and prior_discretize().

◆ dist_refresh_moments()

template<class T>
void line::lang::dist_refresh_moments ( Distrib< T > & d)

Fill in the first two moments of a distribution given by its matrices.

Distrib::map_dist cannot compute them – they need the stationary vector – so a MAP built directly from (D0,D1) leaves mean and scv at their defaults until this runs. Every builder call that installs such a distribution passes through here.

Definition at line 206 of file distribution.h.

References line::lang::Distrib< T >::D0, line::mam::Map< T >::D0, line::lang::Distrib< T >::D1, line::mam::Map< T >::D1, line::lang::Distrib< T >::disabled, dist_refresh_moments(), DMAP, dmap_refresh_moments(), line::lang::Distrib< T >::has_map(), line::mam::map_mean(), line::mam::map_scv(), line::lang::Distrib< T >::mean, line::lang::Distrib< T >::scv, and line::lang::Distrib< T >::type.

Referenced by dist_refresh_moments(), line::env::env_degraded_model(), line::qn::Network< double >::set_arrival(), and line::qn::Network< double >::set_service().

◆ dist_scale_rate()

template<class T>
Distrib< T > line::lang::dist_scale_rate ( const Distrib< T > & d,
const T & factor )

◆ dist_to_map()

template<class T>
mam::Map< T > line::lang::dist_to_map ( const Distrib< T > & d)

Definition at line 149 of file distribution.h.

References line::mam::aph_fit(), convert_to_map_phases(), line::lang::Distrib< T >::D0, line::mam::Map< T >::D0, line::lang::Distrib< T >::D1, line::mam::Map< T >::D1, line::lang::Distrib< T >::disabled, dist_to_map(), line::lang::Distrib< T >::has_map(), line::InputError::InputError(), line::lang::Distrib< T >::is_prior(), line::mam::map_erlang(), line::lang::Distrib< T >::mean, NORMAL, reject_prior(), REPLAYER, line::lang::Distrib< T >::scv, line::lang::Distrib< T >::trace, line::lang::Distrib< T >::type, and line::UnsupportedError::UnsupportedError().

Referenced by line::ba::blocking_default(), line::io::build_network_from_json(), line::retrieval::cache_retrieval_inputs(), dist_cdf(), dist_lst(), dist_lst(), dist_moment(), dist_pie(), dist_to_map(), line::io::jmt_dist_view(), line::mam::mam_fj_extract_params(), line::mam::mam_fj_is_homogeneous(), line::mam::mam_transient_qbd_applicable(), line::io::pnml_load(), line::api::sn_patience_handles(), line::sn::sn_to_qrf_alpha(), line::ba::solver_ba_analyzer(), line::ba::solver_ba_qrf_analyzer(), line::ba::solver_ba_snc_envelopes(), line::fluid::solver_fluid_qsys(), line::mam::solver_mam_basic(), line::mam::solver_mam_bgchain(), line::mam::solver_mam_getmamresult(), line::mam::solver_mam_ldqbd(), line::mam::solver_mam_ldqbd_transient(), line::mam::solver_mam_mapmap1_exact(), line::mam::solver_mam_passage_time(), line::mam::solver_mam_retrial(), line::mam::solver_mam_transient_qbd(), line::mva::solver_mapqn(), line::mva::solver_mva_polling_analyzer(), line::mva::solver_mva_qsys_analyzer(), line::nc::solver_nc_cdf_respt(), line::mva::solver_rqna(), line::mva::solver_rqt(), line::spn::spn_lpbnd(), line::spn::spn_mdd(), and line::wf::wf_from_struct().

◆ dmap_refresh_moments()

template<class T>
void line::lang::dmap_refresh_moments ( Distrib< T > & d)

The first two moments of a DISCRETE-time MAP, from its own law.

With alpha the arrival-epoch stationary vector – dmap_pie, the stationary vector of (I - D0)^-1 D1 – the interarrival count has P(N = k) = alpha D0^(k-1) D1 e, so

E[N] = alpha (I - D0)^-1 e (MATLAB DMAP.getMean) E[N(N-1)] = 2 alpha D0 (I - D0)^-2 e

THE SCV IS NOT MATLAB'S INHERITED ONE. DMAP declares no getSCV, so it falls through to Markovian.getSCV = map_scv({D0,D1}), a CONTINUOUS-time formula that reads D0 + D1 as a generator; for a DMAP that matrix is stochastic, so the stationary solve behind it is singular and the number it returns is not the SCV of anything. Reproducing it would propagate an undefined value into every AMVA path, so the discrete second moment is computed here and the reference defect is recorded in BUGS.md.

Definition at line 113 of file distribution.h.

References line::lang::Distrib< T >::D0, line::lang::Distrib< T >::D1, dmap_refresh_moments(), line::mc::dtmc_solve(), line::lu_factor(), line::lu_solve(), line::lang::Distrib< T >::mean, and line::lang::Distrib< T >::scv.

Referenced by dist_refresh_moments(), and dmap_refresh_moments().

◆ erlang_fit_mean_order()

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.

Definition at line 97 of file dist_fitters.h.

References line::lang::Distrib< T >::erlang(), erlang_fit_mean_order(), and line::InputError::InputError().

Referenced by erlang_fit_mean_order(), and line::LINE_DIST_CTOR().

◆ event_to_text()

const char * line::lang::event_to_text ( EventType e)
inline

◆ gamma_fit_mean_scv()

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.

Definition at line 270 of file dist_fitters.h.

References line::lang::Distrib< T >::gamma_dist(), and gamma_fit_mean_scv().

Referenced by gamma_fit_mean_scv(), and line::LINE_DIST_CTOR().

◆ hyperexp_fit_mean_scv()

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).

Definition at line 113 of file dist_fitters.h.

References line::mam::Map< T >::D0, line::mam::Map< T >::D1, line::lang::Distrib< T >::hyperexp(), hyperexp_fit_mean_scv(), and line::mam::map_hyperexp().

Referenced by hyperexp_fit_mean_scv(), line::LINE_DIST_CTOR(), and line::api::sn_aggregate_chains().

◆ hyperexp_fit_mean_scv_balanced()

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.

Both roots are tried in the reference's order.

Definition at line 129 of file dist_fitters.h.

References line::lang::Distrib< T >::hyperexp(), and hyperexp_fit_mean_scv_balanced().

Referenced by hyperexp_fit_mean_scv_balanced(), and line::LINE_DIST_CTOR().

◆ metric_to_text()

const char * line::lang::metric_to_text ( MetricType metric)
inline

Port of MetricType.toText.

Definition at line 73 of file lang_types.h.

References ArvR, DropRate, FCRMemOcc, FCRWeight, FJQLen, FJRespT, metric_to_text(), QLen, QueueT, ResidT, RespT, RespTSink, SysQLen, SysRespT, SysTard, SysTput, Tard, Tput, TputSink, TranQLen, TranRespT, TranTput, TranUtil, and Util.

Referenced by metric_to_text().

◆ node_type_to_text()

const char * line::lang::node_type_to_text ( NodeType t)
inline

◆ pareto_fit_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.

Definition at line 280 of file dist_fitters.h.

References line::lang::Distrib< T >::pareto(), and pareto_fit_mean_scv().

Referenced by line::LINE_DIST_CTOR(), and pareto_fit_mean_scv().

◆ ph_from_map()

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.

The initial vector is recovered from D1 rather than carried alongside it: D1 = (-D0 e) alpha by construction, so row i of D1 is alpha scaled by phase i's exit rate and ANY row with a positive exit rate recovers it.

IT CANNOT BE ROW 0. The canonical APH aph_fit returns is BIDIAGONAL: phase 1 moves to phase 2 and never completes, so its exit rate is exactly zero and its D1 row is all zeros. Reading alpha off row 0 threw on every APH fit.

Definition at line 78 of file dist_fitters.h.

References line::mam::Map< T >::D0, line::mam::Map< T >::D1, line::NumericError::NumericError(), ph_from_map(), and line::lang::Distrib< T >::phase_type().

Referenced by aph_fit_central(), aph_fit_mean_scv(), and ph_from_map().

◆ prior_cdf()

template<class T>
T line::lang::prior_cdf ( const Distrib< T > & d,
const T & t )

F(t) = sum_i p_i F_i(t), MATLAB Prior.evalCDF.

Definition at line 320 of file prior.h.

References dist_cdf(), line::lang::PriorDesign< T >::dists, prior_cdf(), prior_discretize(), and line::lang::PriorDesign< T >::weights.

Referenced by prior_cdf().

◆ prior_continuous()

template<class T>
Distrib< T > line::lang::prior_continuous ( const Distrib< T > & param_dist,
const std::function< Distrib< T >(const T &)> & factory )

Prior(paramDist, distFactory): the continuous form.

factory maps a value of the parameter to a distribution, e.g. a rate to an Exp. It is called eagerly once here, on the median of the parameter law, so that a factory returning a disabled or nested-Prior distribution is refused at construction rather than at the first design point.

Definition at line 150 of file prior.h.

References line::lang::Distrib< T >::disabled, dist_quantile(), line::InputError::InputError(), line::lang::Distrib< T >::is_prior(), PRIOR, line::lang::Distrib< T >::prior, prior_continuous(), and line::lang::Distrib< T >::type.

Referenced by prior_continuous(), and prior_from_sample().

◆ prior_discrete()

template<class T>
Distrib< T > line::lang::prior_discrete ( const std::vector< Distrib< T > > & alternatives,
const std::vector< T > & probabilities )

Prior(distributions, probabilities): the discrete form.

The weights must be nonnegative and sum to one within CoarseTol, which is the reference's own tolerance; a set that does not is a modelling error and is refused rather than renormalized, since renormalizing would answer for a prior the caller did not write.

Definition at line 110 of file prior.h.

References line::lang::GlobalConstants::CoarseTol, line::lang::Distrib< T >::disabled, line::InputError::InputError(), PRIOR, line::lang::Distrib< T >::prior, prior_discrete(), and line::lang::Distrib< T >::type.

Referenced by prior_discrete().

◆ prior_discretize() [1/2]

template<class T>
PriorDesign< T > line::lang::prior_discretize ( const Distrib< T > & d)

prior_discretize with the defaults of Prior.discretize: 11 quadrature nodes.

Definition at line 251 of file prior.h.

References kPriorDefaultNodes, and prior_discretize().

◆ prior_discretize() [2/2]

template<class T>
PriorDesign< T > line::lang::prior_discretize ( const Distrib< T > & d,
std::size_t n,
const std::string & method,
PriorRng & rng )

◆ prior_from_sample()

template<class T>
Distrib< T > line::lang::prior_from_sample ( std::size_t k,
const T & s,
const std::function< Distrib< T >(const T &)> & factory = std::function<Distrib<T>(const T&)>() )

Prior.fromSample(k, s): the posterior of a rate estimated from lifetime data.

Given k i.i.d. exponential observations summing to s, the Jeffreys prior f(lambda) = s/lambda yields the posterior lambda^(k-1) s^k exp(-lambda s) / (k-1)!, an Erlang density of k phases and phase rate s (Trivedi and Bobbio (2017), Eq. 3.71). Its mean k/s is the maximum-likelihood rate and its variance k/s^2 shrinks as k grows, so the prior concentrates on the estimate.

Definition at line 179 of file prior.h.

References line::lang::Distrib< T >::erlang(), line::lang::Distrib< T >::exp_rate(), line::InputError::InputError(), prior_continuous(), and prior_from_sample().

Referenced by prior_from_sample().

◆ prior_lst()

template<class T>
T line::lang::prior_lst ( const Distrib< T > & d,
const T & s )

L(s) = sum_i p_i L_i(s), MATLAB Prior.evalLST.

Definition at line 329 of file prior.h.

References dist_lst(), line::lang::PriorDesign< T >::dists, prior_discretize(), prior_lst(), and line::lang::PriorDesign< T >::weights.

Referenced by prior_lst().

◆ prior_mean()

template<class T>
T line::lang::prior_mean ( const Distrib< T > & d)

E[X] = sum_i p_i E[X_i], MATLAB Prior.getMean.

Definition at line 258 of file prior.h.

References line::lang::PriorDesign< T >::dists, prior_discretize(), prior_mean(), and line::lang::PriorDesign< T >::weights.

Referenced by prior_mean(), prior_refresh_moments(), and prior_skewness().

◆ prior_refresh_moments()

template<class T>
void line::lang::prior_refresh_moments ( Distrib< T > & d)

Write the mixture moments onto a Prior, the counterpart of dist_refresh_moments for the Markovian families.

prior_discrete and prior_continuous leave mean and scv at their defaults, because computing them costs a discretization of the parameter density; the builders call this so that a struct dumped before SolverUQ has run reports the epistemic mean rather than a zero.

Definition at line 346 of file prior.h.

References line::lang::Distrib< T >::is_prior(), line::lang::Distrib< T >::mean, prior_mean(), prior_refresh_moments(), prior_scv(), and line::lang::Distrib< T >::scv.

Referenced by line::env::env_degraded_model(), prior_refresh_moments(), line::qn::Network< double >::set_arrival(), and line::qn::Network< double >::set_service().

◆ prior_scv()

template<class T>
T line::lang::prior_scv ( const Distrib< T > & d)

The SCV by the law of total variance, MATLAB Prior.getSCV.

Var(X) = E[Var(X|D)] + Var(E[X|D]): the within-alternative variance plus the spread of the alternative means. The second term is what makes a Prior's SCV exceed the SCV of any of its alternatives.

Definition at line 273 of file prior.h.

References line::lang::PriorDesign< T >::dists, line::NumericError::NumericError(), prior_discretize(), prior_scv(), and line::lang::PriorDesign< T >::weights.

Referenced by prior_refresh_moments(), prior_scv(), and prior_skewness().

◆ prior_skewness()

template<class T>
T line::lang::prior_skewness ( const Distrib< T > & d)

The skewness of the mixture, MATLAB Prior.getSkewness.

Each alternative's third central moment is shifted to the global mean by E[(X_i - mu)^3] = m3_i + 3 v_i delta + delta^3, delta = m_i - mu, and the shifted moments are averaged. Exact for the mixture, and it is the mixture that Distribution.getSkewness is asked about.

Definition at line 299 of file prior.h.

References dist_moment(), line::lang::PriorDesign< T >::dists, line::lang::GlobalConstants::FineTol, prior_discretize(), prior_mean(), prior_scv(), prior_skewness(), and line::lang::PriorDesign< T >::weights.

Referenced by prior_skewness().

◆ process_is_markovian()

bool line::lang::process_is_markovian ( ProcessType p)
inline

ProcessType.isMarkovian: true when sn.proc carries an exact matrix representation of the law, rather than the Erlang fit convertToMAP leaves there for the parameter-only families.

ME and RAP count – their representation is the matrix-exponential analogue, not a generator – and the discrete families do not, so a solver reading sn.proc as the law must gate on this exactly as MATLAB ProcessType.m does.

Definition at line 610 of file lang_types.h.

References APH, BMAP, COX2, COXIAN, DMAP, ERLANG, EXP, HYPEREXP, MAP, ME, MMAP, MMPP2, PH, process_is_markovian(), and RAP.

Referenced by dist_lst(), and process_is_markovian().

◆ process_to_text()

◆ reject_prior()

void line::lang::reject_prior ( const char * who)
inline

The (D0,D1) pair that reaches sn.proc.

A type that carries its own representation returns it unchanged. Det, Uniform, Pareto, Gamma, Weibull and Lognormal are replaced by the Erlang approximation of convertToMAP; a Replayer is fitted by aph_fit, which is what MATLAB's Replayer.fitAPH does before taking getProcess. The refusal every lowering of a Prior shares.

A Prior is a set of models, not one law, so there is no (D0,D1), no transform and no moment of it that a solver could integrate: substituting any single alternative would answer for a model the caller did not describe, and collapsing the set to its mixture would answer for a model nobody described. SolverUQ is the one consumer, and it replaces the Prior before the design point is solved.

Definition at line 87 of file distribution.h.

References reject_prior(), and line::UnsupportedError::UnsupportedError().

Referenced by dist_lst(), dist_lst(), dist_moment(), dist_to_map(), and reject_prior().

◆ routing_to_text()

const char * line::lang::routing_to_text ( RoutingStrategy r)
inline

Definition at line 402 of file lang_types.h.

References FIRING, JSQ, PROB, RAND, routing_to_text(), RROBIN, SDR, SQ, and WRROBIN.

Referenced by routing_to_text().

◆ sched_from_lqnx()

SchedStrategy line::lang::sched_from_lqnx ( const std::string & s)
inline

Parse the scheduling attribute of an .lqnx processor or task.

Definition at line 277 of file lang_types.h.

References FCFS, FCFSPRPRIO, HOL, INF, LCFS, LJF, PS, REF, sched_from_lqnx(), SIRO, SJF, and line::UnsupportedError::UnsupportedError().

Referenced by line::lqn::read_lqnx_model(), and sched_from_lqnx().

◆ sched_to_lqnx()

std::string line::lang::sched_to_lqnx ( SchedStrategy s)
inline

The scheduling attribute an .lqnx processor or task carries for a strategy.

The inverse of sched_from_lqnx over the disciplines the schema spells, and a refusal by name for every other one. It refuses rather than falling back on fcfs because the file is handed to an external solver: a task written as fcfs when the model says lcfspr is answered, not rejected, and the discipline would be lost inside a number that looks ordinary.

Definition at line 304 of file lang_types.h.

References FCFS, FCFSPRPRIO, HOL, INF, LCFS, LJF, PS, REF, sched_to_lqnx(), sched_to_text(), SIRO, SJF, and line::UnsupportedError::UnsupportedError().

Referenced by sched_to_lqnx(), and line::lqn::write_lqnx().

◆ sched_to_text()

Variable Documentation

◆ kPriorDefaultNodes

std::size_t line::lang::kPriorDefaultNodes = 11
inlineconstexpr

The default number of nodes per continuous Prior, MATLAB options.samples.

Definition at line 72 of file prior.h.

Referenced by prior_discretize().