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...
class  Nnpp
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 , DROP = 17 , SETUP = 18 ,
  DELAYOFF = 19
}
 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 , LAS = 34 ,
  LRPT = 35 , SETF = 36 , FSP = 37 , PAS = 38 ,
  OI = 39 , RR = 40 , 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 ,
  GLIMITED = 4
}
 Polling service disciplines, with the values of MATLAB PollingType. More...
enum class  PollingOrder { CYCLIC = 0 , SKIPEMPTY = 1 , LQF = 2 , THRESHOLD = 3 }
 Visit-order rules of a polling server, with the values of MATLAB PollingOrder. More...
enum class  PollingTimer { NONE = 0 , LOCAL = 1 , GLOBAL = 2 }
 Visit-timer scopes of a polling server, with the values of MATLAB PollingTimer. 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 , MPH = 36 ,
  MMAPT = 37 , MPHT = 38 , BMMAPT = 39 , LOGLOGISTIC = 40 ,
  MASSATORIGIN = 41 , DEFECTIVE = 42 , NNPP = 43 , 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 refusal every lowering of a Prior shares.
template<class T>
mam::Map< T > dist_to_map (const Distrib< T > &d)
 The (D0,D1) pair that reaches sn.proc.
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>
T dist_lst (const Distrib< T > &d, const T &s)
 sn.lst: the Laplace-Stieltjes transform E[exp(-sX)].
template<class T>
T dist_cdf (const Distrib< T > &d, const T &x)
 F(x) = P{X <= x}, MATLAB's Distribution.evalCDF.
template<class T>
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>
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).
template<class T>
Distrib< T > dist_fit_nhpp (const std::vector< T > &times, const T &horizon, const std::string &method="leemis", std::size_t num_segments=100, bool cyclic=false)
 Port of NHPP.fit: fit an NHPP to ONE sample path of arrival EPOCHS observed on [0, horizon], returned as a Distrib usable as a Source arrival.
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.
bool process_is_marked_stationary (ProcessType p)
 True when the type carries PER-MARK arrival blocks, i.e.
bool process_is_marked_schedule (ProcessType p)
 True when sn.proc holds the MARKED SCHEDULE slot.
bool process_is_batch (ProcessType p)
 True when an EVENT of this process releases (or, as a service process, completes) a BATCH of jobs whose size the process itself carries in its blocks.
bool process_is_marked (ProcessType p)
 True for every marked family.
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>
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>
T prior_mean (const Distrib< T > &d)
 E[X] = sum_i p_i E[X_i], MATLAB Prior.getMean.
template<class T>
T prior_scv (const Distrib< T > &d)
 The SCV by the law of total variance, MATLAB Prior.getSCV.
template<class T>
T prior_skewness (const Distrib< T > &d)
 The skewness of the mixture, MATLAB Prior.getSkewness.
template<class T>
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>
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 794 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 807 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 486 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 508 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 499 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 465 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

DROP 

an arriving job is lost (full buffer or region, balking); emitted only by simulation event logs

SETUP 

a station server's setup clock moves a phase or completes (Queue.setDelayOff), making the server ACTIVE

DELAYOFF 

a station server's delay-off clock moves a phase or expires, turning the server OFF

Definition at line 116 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 492 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 483 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 388 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 502 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 505 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 51 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 345 of file lang_types.h.

◆ PollingOrder

enum class line::lang::PollingOrder
strong

Visit-order rules of a polling server, with the values of MATLAB PollingOrder.

CYCLIC walks the ring (or the polling table); the others are load-dependent and choose the next buffer when a visit ends.

Enumerator
CYCLIC 

fixed cyclic order (or the polling table)

SKIPEMPTY 

next non-empty buffer in cyclic order

LQF 

longest buffer first, ties to the cyclic successor

THRESHOLD 

a priority buffer above its threshold, else SKIPEMPTY

Definition at line 404 of file lang_types.h.

◆ PollingTimer

enum class line::lang::PollingTimer
strong

Visit-timer scopes of a polling server, with the values of MATLAB PollingTimer.

Enumerator
NONE 

no visit timer

LOCAL 

a timer per visit, drawn at the polling instant

GLOBAL 

a timed token: per-class target rotation timers

Definition at line 412 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

GLIMITED 

serve at most K of the jobs present at the polling instant

Definition at line 391 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 511 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 
MPH 

The MARKED families, MATLAB's ProcessType.m:36-38.

A mark is a label carried by an event, and at a Source it selects the class of the arriving job (Source.setMarkedArrival, sn.markidx, marked_classes).

MPH is the RENEWAL special case of MMAP: a PH with K marked exits, lowered by D0 = S and D1k = s_k*alpha. MMAPT is MMAP with a piecewise-constant matrix schedule, carried in sched_Dmark beside sched_D0/sched_D1. MPHT is the same lowering applied segment by segment, so it is STORED CONVERTED to MMAPT form exactly as a PHt is stored as its equivalent MAPt pair, and the marked schedule walk serves both.

MPH keeps an id of its own rather than aliasing MMAP, so a solver that cannot honour a marked renewal process refuses it explicitly instead of inheriting MMAP's support. Every procid == MMAP test that should also accept a marked renewal process is therefore a MEMBERSHIP test.

MMAPT 
MPHT 
BMMAPT 

BMMAPT crosses the BATCH axis with the two above: a block is indexed by segment, mark and batch size, carried in sched_Dbatch beside sched_Dmark, and one epoch releases a batch of jobs that all carry the same mark.

It reduces to MMAPT when every batch size is 1 and to BMAP when the schedule is flat.

Like MPH it keeps an id of its own so a solver that cannot release batches refuses it by name instead of inheriting MMAPT's support, and every procid == BMAP test that should serve every batch family is therefore a MEMBERSHIP test, process_is_batch.

LOGLOGISTIC 

Three reliability laws of Trivedi and Bobbio, "Reliability and Availability Engineering" (2017), Sec.

3.2: the log-logistic (Fisk) law, an atom at zero mixed with any law, and a mass at infinity mixed with any law. The values are MATLAB ProcessType.m's. The two wrappers carry the law they wrap in Distrib::inner; a Defective has an infinite mean, so it is a lifetime law only and no Network accepts it.

MASSATORIGIN 
DEFECTIVE 
NNPP 

A nonstationary non-Poisson arrival process (thinning + SCIATA): a rate function lambda(t) on [0, S] and a dispersion ratio C, generated by thinning a Weibull equilibrium renewal process inverted through a piecewise-constant majorizer (line/lang/nnpp.h).

MATLAB's value. The law itself is carried in Distrib::nnpp; D0/D1 hold the Poisson nominal at the time-average rate, as an NHPP's do. Only SolverLDES simulates it.

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 the ids MATLAB assigns (0..38 as of the marked families) so that it can never collide with one added 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 524 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 187 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 419 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 430 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 
LAS 
LRPT 
SETF 
FSP 
PAS 
OI 
RR 
NONE 

Definition at line 194 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 180 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 382 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(), line::LINE_DIST_CTOR(), and line::lal::decl_detail::replayer_fit_aph().

◆ 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 64 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(), line::LINE_DIST_CTOR(), 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 739 of file distribution.h.

References line::Matrix< T >::cols(), line::mam::Map< T >::D0, DEFECTIVE, DET, line::lang::Distrib< T >::disabled, dist_cdf(), dist_to_map(), ERLANG, EXP, line::expm(), GAMMA, line::mam::gammainc_lower(), HYPEREXP, IMMEDIATE, line::lang::Distrib< T >::inner, line::InputError::InputError(), line::lang::Distrib< T >::is_prior(), LOGLOGISTIC, LOGNORMAL, line::mam::map_pie(), MASSATORIGIN, 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 line::mc::smp_detail::cdf_row(), dist_cdf(), dist_lst(), dist_quantile(), prior_cdf(), and line::mc::smp_stage_quad().

◆ dist_fit_nhpp()

template<class T>
Distrib< T > line::lang::dist_fit_nhpp ( const std::vector< T > & times,
const T & horizon,
const std::string & method = "leemis",
std::size_t num_segments = 100,
bool cyclic = false )

Port of NHPP.fit: fit an NHPP to ONE sample path of arrival EPOCHS observed on [0, horizon], returned as a Distrib usable as a Source arrival.

"leemis" returns the piecewise-linear integrated rate estimator of Leemis (1991) exactly: its rate is constant on every gap between consecutive arrivals, so the schedule has the knots [0, times, T] as breakpoints and N/((N+1) gap) as rates. "powerlaw" fits Lambda(t) = (a t)^b by maximum likelihood and returns the schedule on num_segments equal segments whose rates match the fitted Lambda exactly at every breakpoint.

Only the RATE is identified by one path: Nelson and Leemis (2020) show that whether the process is Poisson at all cannot be tested from it. To see how much a conclusion leans on the Poisson assumption, rerun with an NNPP of the same rate and a dispersion ratio swept around 1.

Definition at line 1011 of file distribution.h.

References dist_fit_nhpp(), line::infer::infer_nhpp_leemis(), line::infer::infer_nhpp_powerlaw(), line::InputError::InputError(), line::infer::NhppLeemisResult< T >::knots, line::lang::Distrib< T >::nhpp(), line::infer::NhppLeemisResult< T >::rates, line::infer::NhppPowerLawResult< T >::scale, and line::infer::NhppPowerLawResult< T >::shape.

Referenced by dist_fit_nhpp().

◆ 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 981 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 451 of file distribution.h.

References line::mam::Map< T >::D0, DEFECTIVE, DET, line::lang::Distrib< T >::disabled, dist_cdf(), dist_lst(), dist_moment(), dist_to_map(), GAMMA, IMMEDIATE, line::lang::Distrib< T >::inner, line::InputError::InputError(), line::lang::Distrib< T >::is_prior(), LOGLOGISTIC, line::mam::map_pie(), MASSATORIGIN, 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]

◆ dist_moment()

◆ 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 150 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 888 of file distribution.h.

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

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

◆ dist_refresh_moments()

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

◆ dist_scale_rate()

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

The law of X / factor, in the same family as d.

Definition at line 48 of file dist_scale_rate.h.

References APH, COX2, COXIAN, line::lang::Distrib< T >::coxian(), line::lang::Distrib< T >::D0, line::lang::Distrib< T >::D1, DEFECTIVE, line::lang::Distrib< T >::defective(), DET, line::lang::Distrib< T >::det(), line::lang::Distrib< T >::disabled, dist_scale_rate(), ERLANG, line::lang::Distrib< T >::erlang(), EXP, line::lang::Distrib< T >::exp_rate(), GAMMA, line::lang::Distrib< T >::gamma_dist(), line::lang::Distrib< T >::has_schedule(), HYPEREXP, line::lang::Distrib< T >::hyperexp(), IMMEDIATE, line::lang::Distrib< T >::immediate(), line::lang::Distrib< T >::inner, line::InputError::InputError(), line::lang::Distrib< T >::is_prior(), LOGLOGISTIC, line::lang::Distrib< T >::loglogistic(), LOGNORMAL, line::lang::Distrib< T >::lognormal(), MAP, line::lang::Distrib< T >::map_dist(), line::lang::Distrib< T >::mass_at_origin(), MASSATORIGIN, line::lang::Distrib< T >::mean, MMPP2, NNPP, line::lang::Distrib< T >::params, PARETO, line::lang::Distrib< T >::pareto(), PH, line::lang::Distrib< T >::phase_type(), REPLAYER, line::lang::Distrib< T >::replayer(), line::lang::Distrib< T >::scv, line::lang::Distrib< T >::trace, line::lang::Distrib< T >::type, UNIFORM, line::lang::Distrib< T >::uniform(), line::UnsupportedError::UnsupportedError(), WEIBULL, and line::lang::Distrib< T >::weibull().

Referenced by dist_scale_rate(), line::infer::ParamEstimator::estimate_at(), line::workflow::Workflow< T >::set_activity_demand_mean(), line::sens::solver_sensitivity_table(), and line::tr::transform_solve_lc().

◆ dist_to_map()

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

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.

Definition at line 97 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, DEFECTIVE, line::lang::Distrib< T >::disabled, dist_to_map(), line::lang::Distrib< T >::has_map(), line::InputError::InputError(), line::lang::Distrib< T >::is_prior(), LOGLOGISTIC, 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(), line::qsys::mmapgk1lcfsprdetail::cmatrix_lst(), dist_cdf(), dist_lst(), dist_lst(), dist_moment(), dist_pie(), dist_to_map(), line::io::code_gen_detail::empty_class_ref(), line::api::infer_fmlps(), line::io::jmt_dist_view(), line::mam::mam_fj_extract_params(), line::mam::mam_fj_is_homogeneous(), line::mam::mam_sync_refusal(), line::mam::mam_transient_qbd_applicable(), line::io::pnml_load(), line::ctmc::pools_detail::pool_station(), line::io::code_gen_detail::proc_spec(), line::api::sn_patience_handles(), line::api::sn_renewal_lst(), 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_ispn(), 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_qsys_analyzer(), line::nc::solver_nc_cdf_respt(), line::nc::solver_nc_open_cdfrespt(), line::nc::solver_oi_open_cdfrespt(), 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 2522 of file lang_types.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(), dmap_refresh_moments(), and line::lang::Distrib< double >::map_dist().

◆ erlang_fit_mean_order()

template<class T>
Distrib< T > line::lang::erlang_fit_mean_order ( const T & mean,
std::size_t k )

◆ event_to_text()

◆ 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_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 78 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()

◆ 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 line::lal::decl_detail::build_network_impl(), and 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]

◆ 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_batch()

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

True when an EVENT of this process releases (or, as a service process, completes) a BATCH of jobs whose size the process itself carries in its blocks.

The batch twin of process_is_marked_stationary and process_is_marked_schedule, and the same rule applies: a procid test that should serve every batch family is a MEMBERSHIP test, never equality with ProcessType::BMAP.

Disjoint from Station::arrival_batch, which is a SEPARATE batch-size law bolted onto a renewal stream by Source.setArrivalBatch. A process that is batch already carries its own sizes, so the two are mutually exclusive by construction.

BMMAPT is ALSO process_is_marked_schedule, and deliberately: a consumer gated on that predicate reads it as the MMAPt it aggregates down to, which is right for anything batch-blind and WRONG for anything that releases jobs.

Definition at line 771 of file lang_types.h.

References BMAP, BMMAPT, and process_is_batch().

Referenced by line::ldes::engine::ldes_engine_reject(), line::ldes::ldes_engine_solve_one(), process_is_batch(), and line::mva::solver_mva_qsys_analyzer().

◆ process_is_marked()

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

True for every marked family.

MPH is the renewal special case of MMAP and lowers to the same M3A cell (D0 = S, D1k = s_k*alpha), so a consumer reading that layout must gate on process_is_marked_stationary rather than on equality with ProcessType::MMAP.

Definition at line 781 of file lang_types.h.

References process_is_marked(), process_is_marked_schedule(), and process_is_marked_stationary().

Referenced by process_is_marked().

◆ process_is_marked_schedule()

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

True when sn.proc holds the MARKED SCHEDULE slot.

MPHt is stored lowered to MMAPt form segment by segment, so one walk serves both, exactly as one MAPt walk serves MAPt and PHt.

Definition at line 751 of file lang_types.h.

References BMMAPT, MMAPT, MPHT, and process_is_marked_schedule().

Referenced by line::ldes::engine::sp::phase_count(), process_is_marked(), and process_is_marked_schedule().

◆ process_is_marked_stationary()

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

True when the type carries PER-MARK arrival blocks, i.e.

an event of this process is labelled and the label is meaningful to the model. At a Source the label selects the class of the arriving job (marked_classes, sn.markidx).

Definition at line 742 of file lang_types.h.

References MMAP, MPH, and process_is_marked_stationary().

Referenced by line::ldes::engine::sp::phase_count(), process_is_marked(), process_is_marked_stationary(), line::api::sn_map_modulation(), and line::ldes::engine::sp::walked().

◆ 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 713 of file lang_types.h.

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

Referenced by line::qsys::mmapgk1lcfsprdetail::cmatrix_lst(), dist_lst(), line::qn::NetworkStruct< T >::polling_has_timed_switchover(), line::qn::polling_info(), line::qn::NetworkStruct< T >::polling_leg(), line::qn::NetworkStruct< T >::polling_leg_differs(), process_is_markovian(), line::api::sn_renewal_lst(), and line::ssa::ssa_tstep_refusal().

◆ process_to_text()

◆ reject_prior()

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

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 81 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

◆ 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 296 of file lang_types.h.

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

Referenced by line::lqn::read_lqnx_model_doc(), 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 325 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()

const char * line::lang::sched_to_text ( SchedStrategy s)
inline

Definition at line 248 of file lang_types.h.

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

Referenced by line::qn::after_event_station_arv(), line::qn::after_event_station_dep(), line::qn::ctmc_station_blocks(), line::mva::debemva_scope_reason(), line::fluid::fluid_ddpp_admits(), line::fluid::fluid_symodes(), line::io::tikz_detail::java_sched_name(), line::jmt::jmt150_refusal(), line::ldes::engine::ldes_engine_reject(), line::ldes::ldes_ln_engine_solve(), line::mam::mam_sync_refusal(), line::mva::mva_qna_scheduling_reason(), line::mva::mvablo_scope_reason(), line::mva::oqnrc_scope(), line::ctmc::pools_detail::pool_station(), line::lal::decl_detail::sched_by_name(), line::io::code_gen_detail::sched_property(), sched_to_lqnx(), sched_to_text(), line::api::sn_print(), line::mva::solver_amvald(), line::ctmc::solver_ctmc_mdd_analyzer(), line::mam::solver_mam_basic(), line::mam::solver_mam_passage_time(), line::mam::solver_mna_closed(), line::mam::solver_mna_open(), line::mva::solver_mva(), line::mva::solver_mva_marie_analyzer(), line::mva::solver_mva_qsys_sizebased_analyzer(), line::mva::solver_mva_sjn_analyzer(), line::mva::solver_mva_sum(), line::mva::solver_mvac_analyzer(), line::nc::solver_nc_open_cdfrespt(), line::nc::solver_oi_open_cdfrespt(), line::mva::solver_qna(), and line::ssa::ssa_tstep_refusal().

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