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

Namespaces

namespace  lqn

Classes

struct  ArrivalRateFun
 lambda(t), with whether it actually varies and the cycle length. More...
struct  CacheActualProb
 The converged cache split, per ORIGINAL class of one Cache node. More...
struct  ChainAggregationDeagg
 Everything needed to map a chain-level result back onto the classes. More...
struct  ChainAggregationResult
 What sn_aggregate_chains returns. More...
struct  DiscreteTimeInfo
 Which laws the model carries, and why it was refused when it was. More...
struct  DiscreteTimeOptions
 How the caller may override the automatic decision. More...
struct  FjSpnStructure
 What the auxiliary construction found, for one class. More...
struct  FluidRtLikelihood
 What the fluid likelihood call reports. More...
struct  MinpsClassTrace
 One class's raw trace: when its jobs arrived, and how long they took. More...
struct  MinpsSetup
 The prepared sample set, plus what the preparation had to decide. More...
struct  MlpsSample
 One observation: a response time, the tagged class, and the arrival state. More...
struct  NonmarkovOptions
 options.config.nonmkv and friends. More...
struct  OpenProbTerm
 The log contribution, and whether the state carries any mass at all. More...
struct  PatienceHandles
 The patience law of one station-class pair, in the forms the solvers consume. More...
struct  SnMapModulation
 One modulating process: which station and classes it drives, and its blocks. More...
struct  SnPnAvgRates
 What sn_pn_avg_rates rewrites in place; empty tables are left empty. More...
struct  SnPnFiringRates
 What sn_pn_firing_rates returns; x empty means "no answer", as in the reference. More...
struct  SnRtOrig
 What sn_rtnodes_to_rtorig returns: the flat matrix and its per-class-pair blocks. More...
struct  SnRtStations
 What sn_rt_stations returns: the complemented routing and the station visits. More...

Enumerations

enum class  PhFit { Cme , Ph , Hyperexp }
 Which Markovian surrogate to fit; options.config.phfit. More...
enum class  ValidationLevel { Full , Minimal , None }
 How much of the struct to check; the reference's ValidationLevel. More...

Functions

template<class T>
FluidRtLikelihood infer_fluid_ps_rt_likelihood (const qn::NetworkStruct< T > &sn, std::size_t ist, std::size_t cls, const std::vector< double > &levels, double rsampled, double marked=1.0)
 The fluid passage-time density at one observed response time.
template<class T>
std::vector< double > infer_fmlps (const qn::NetworkStruct< T > &sn, std::size_t ist, const std::vector< MlpsSample > &samples)
 FMLPS: the fluid analogue of MLPS.
MinpsSetup infer_minps_setup (const std::vector< MinpsClassTrace > &traces, std::size_t initSample, std::size_t sampleSize)
 Turn a raw per-class trace into the sample set MINPS estimates from.
std::vector< double > infer_minps_from_trace (const std::vector< MinpsClassTrace > &traces, std::size_t initSample, std::size_t sampleSize, double nCores)
 Prepare the trace and run MINPS on it, as the reference's last line does.
std::vector< double > infer_mlps (const std::vector< double > &muZ, double nCores, const std::vector< MlpsSample > &samples)
 MLPS demand estimation at a PS queue.
std::vector< double > infer_minps (const std::vector< double > &muZ, double nCores, const std::vector< MlpsSample > &samples)
 MINPS: run MLPS and RPS and keep whichever gives the smaller mean demand.
template<class T>
ChainAggregationResult< T > sn_aggregate_chains (const qn::NetworkStruct< T > &sn, const std::string &suffix=std::string())
 Collapse every chain onto one class, port of ModelAdapter.aggregateChains.
template<class T>
ArrivalRateFun< T > sn_arrival_rate_fun (const qn::NetworkStruct< T > &sn, std::size_t ist, std::size_t r)
 Build lambda(t) for station ist (0-based), class r.
template<class T>
sn_compat_rate (const Matrix< T > &compat, const std::vector< double > &counts, const std::vector< T > &rates, const std::vector< T > &n)
 Rate cleared by the pools when the operands in n are present.
template<class T>
sn_compat_peak (const std::vector< double > &counts, const std::vector< T > &rates)
 Rate with every pool active: sum_t counts(t)*rates(t).
template<class T>
sn_compat_scaling (const Matrix< T > &compat, const std::vector< double > &counts, const std::vector< T > &rates, const std::vector< T > &n)
 Rate scaling eta(n) a compatibility declaration imposes on its station.
template<class T>
void sn_fj_nodevisits_mmt (qn::NetworkStruct< T > &sn)
 Rewrite sn.nodevisits with the MMT correction.
template<class T>
FjSpnStructure fj_spn_structure (const qn::NetworkStruct< T > &sn, const Matrix< T > &P_r, const std::vector< bool > &visited, std::size_t cls=0)
 Classify one class's visited subgraph and size the auxiliary net.
template<class T>
std::vector< Matrix< T > > sn_fj_visits_spn (const qn::NetworkStruct< T > &sn)
 Per-chain fork-join node visit ratios.
template<class T>
bool sn_has_bursty_arrival (const qn::NetworkStruct< T > &sn)
template<class T>
bool sn_has_classdep_routing (const qn::NetworkStruct< T > &sn)
template<class T>
bool sn_is_discrete_time (const qn::NetworkStruct< T > &sn, const DiscreteTimeOptions &options, double *slot_length, DiscreteTimeInfo *info)
 True when every law of sn is lattice-valued on slot_length.
template<class T>
bool sn_is_phasetype (const std::vector< Matrix< T > > &maps, const std::vector< T > &pie)
 Whether a (D0, D1, ...) list is a valid phase-type / MAP representation.
template<class T>
bool sn_is_phasetype (const std::vector< Matrix< T > > &maps)
template<class T>
std::vector< SnMapModulation< T > > sn_map_modulation (const qn::NetworkStruct< T > &sn)
template<class T>
Matrix< T > sn_get_node_arvr_from_tput (const qn::NetworkStruct< T > &sn, const Matrix< T > &TN, const Matrix< T > &AN)
 Port of sn_get_node_arvr_from_tput.
template<class T>
Matrix< T > sn_get_node_tput_from_tput (const qn::NetworkStruct< T > &sn, const Matrix< T > &TN, const Matrix< T > &ANn, const std::map< std::size_t, CacheActualProb< T > > &cache_prob=std::map< std::size_t, CacheActualProb< T > >())
 Port of sn_get_node_tput_from_tput.
template<class T>
bool sn_has_nonmarkov (const qn::NetworkStruct< T > &sn, bool preserve_det=false)
 Whether any law in the struct would be replaced, so a caller can skip copying the struct when there is nothing to convert.
template<class T>
void sn_nonmarkov_toph (qn::NetworkStruct< T > &sn, const NonmarkovOptions &opts=NonmarkovOptions())
 Replace every non-Markovian service and firing law by a Markovian surrogate.
template<class T>
OpenProbTerm< T > sn_open_prob_terms (const qn::NetworkStruct< T > &sn, const Matrix< T > &Q, const Matrix< T > &U, const Matrix< T > &nir, std::size_t ist)
 Open-class contribution to an aggregate state probability at one station.
template<class T>
PatienceHandles< T > sn_patience_handles (const qn::NetworkStruct< T > &sn, std::size_t ist, std::size_t r)
 Build the patience handles of station ist (0-based), class r.
template<class T>
SnPnFiringRates sn_pn_firing_rates (const qn::NetworkStruct< T > &sn, const Matrix< T > &TN, bool tput_is_tokens)
 Ports of matlab/src/api/sn/sn_pn_firing_rates.m and sn_pn_avg_rates.m.
template<class T>
SnPnAvgRates< T > sn_pn_avg_rates (const qn::NetworkStruct< T > &sn, const Matrix< T > &QN, const Matrix< T > &TN, const Matrix< T > &AN, const Matrix< T > &RN)
 Port of sn_pn_avg_rates: rewrite the place rows of TN, AN and RN so that they agree with the recovered mode firing rates.
template<class T>
bool sn_has_dps (const qn::NetworkStruct< T > &sn)
template<class T>
bool sn_has_dps_prio (const qn::NetworkStruct< T > &sn)
template<class T>
bool sn_has_fcfs (const qn::NetworkStruct< T > &sn)
template<class T>
bool sn_has_gps (const qn::NetworkStruct< T > &sn)
template<class T>
bool sn_has_gps_prio (const qn::NetworkStruct< T > &sn)
template<class T>
bool sn_has_hol (const qn::NetworkStruct< T > &sn)
template<class T>
bool sn_has_inf (const qn::NetworkStruct< T > &sn)
template<class T>
bool sn_has_lcfs (const qn::NetworkStruct< T > &sn)
template<class T>
bool sn_has_lcfs_pi (const qn::NetworkStruct< T > &sn)
template<class T>
bool sn_has_lcfs_pr (const qn::NetworkStruct< T > &sn)
template<class T>
bool sn_has_lept (const qn::NetworkStruct< T > &sn)
template<class T>
bool sn_has_ljf (const qn::NetworkStruct< T > &sn)
template<class T>
bool sn_has_lps (const qn::NetworkStruct< T > &sn)
template<class T>
bool sn_has_polling (const qn::NetworkStruct< T > &sn)
template<class T>
bool sn_has_ps (const qn::NetworkStruct< T > &sn)
template<class T>
bool sn_has_ps_prio (const qn::NetworkStruct< T > &sn)
template<class T>
bool sn_has_sept (const qn::NetworkStruct< T > &sn)
template<class T>
bool sn_has_setf (const qn::NetworkStruct< T > &sn)
template<class T>
bool sn_has_siro (const qn::NetworkStruct< T > &sn)
template<class T>
bool sn_has_sjf (const qn::NetworkStruct< T > &sn)
template<class T>
bool sn_has_srpt (const qn::NetworkStruct< T > &sn)
template<class T>
bool sn_has_homogeneous_scheduling (const qn::NetworkStruct< T > &sn, qn::SchedStrategy)
 Port of sn_has_homogeneous_scheduling.
template<class T>
bool sn_has_open_classes (const qn::NetworkStruct< T > &sn)
template<class T>
bool sn_has_closed_classes (const qn::NetworkStruct< T > &sn)
template<class T>
bool sn_has_multiple_closed_classes (const qn::NetworkStruct< T > &sn)
template<class T>
bool sn_has_mixed_classes (const qn::NetworkStruct< T > &sn)
template<class T>
bool sn_has_multi_chain (const qn::NetworkStruct< T > &sn)
template<class T>
bool sn_has_single_chain (const qn::NetworkStruct< T > &sn)
template<class T>
bool sn_has_multi_class (const qn::NetworkStruct< T > &sn)
template<class T>
bool sn_has_single_class (const qn::NetworkStruct< T > &sn)
template<class T>
bool sn_has_class_switching (const qn::NetworkStruct< T > &sn)
template<class T>
bool sn_is_open_model (const qn::NetworkStruct< T > &sn)
 all(isinf(sn.njobs)): EVERY class is open, which a mixed model fails.
template<class T>
bool sn_is_closed_model (const qn::NetworkStruct< T > &sn)
 all(isfinite(sn.njobs)): EVERY class is closed.
template<class T>
bool sn_is_mixed_model (const qn::NetworkStruct< T > &sn)
template<class T>
bool sn_has_priorities (const qn::NetworkStruct< T > &sn)
template<class T>
bool sn_has_multi_server (const qn::NetworkStruct< T > &sn)
template<class T>
bool sn_has_fractional_populations (const qn::NetworkStruct< T > &sn)
 any(sn.njobs ~= round(sn.njobs)); an infinite population rounds to itself.
template<class T>
bool sn_has_load_dependence (const qn::NetworkStruct< T > &sn)
 size(sn.lldscaling,2)>0: some station carries a limited-load scaling row.
template<class T>
bool sn_has_fork_join (const qn::NetworkStruct< T > &sn)
 any(sn.fj(:) > 0): the model has a Fork closed by a Join.
template<class T>
bool sn_has_sd_routing (const qn::NetworkStruct< T > &sn)
 sn_has_sd_routing: some node dispatches on the STATE of the network.
template<class T>
bool sn_has_multi_class_fcfs (const qn::NetworkStruct< T > &sn)
 sum(sn.rates(i,:)>0)>1 at some FCFS station: more than one class is served there.
template<class T>
bool sn_has_multi_class_heter_fcfs (const qn::NetworkStruct< T > &sn)
 sn_has_multi_class_heter_fcfs: an FCFS station whose per-class rates differ.
template<class T>
bool sn_has_multi_class_heter_exp_fcfs (const qn::NetworkStruct< T > &sn)
 An FCFS station with heterogeneous rates whose SCVs are all one (exponential).
template<class T>
bool sn_sched_is_product_form (const qn::NetworkStruct< T > &sn)
 The disciplines the reference admits in sn_has_product_form.
template<class T>
bool sn_has_blocking (const qn::NetworkStruct< T > &sn)
 Defined below, after sn_is_mm1k_loss, which it exempts.
template<class T>
bool sn_has_product_form (const qn::NetworkStruct< T > &sn)
 Port of sn_has_product_form.
template<class T>
bool sn_has_product_form_not_het_fcfs (const qn::NetworkStruct< T > &sn, bool check_means=true)
 Port of sn_has_product_form_not_het_fcfs: LCFS is out, and every enabled FCFS pair with a finite positive SCV must have that SCV equal to one, with the service means agreeing across the classes served there.
template<class T>
bool sn_is_population_model (const qn::NetworkStruct< T > &sn)
 sn_is_population_model: every station is population dependent only, which is what lets the fluid and mean-field limits close on the queue lengths.
template<class T>
bool sn_is_bas_model (const qn::NetworkStruct< T > &sn)
 sn_is_bas_model: a single-class closed model with blocking-after-service.
template<class T>
bool sn_is_mm1k_loss (const qn::NetworkStruct< T > &sn)
 sn_is_mm1k_loss: the three-node Source/Queue/Sink model of an M/M/1/K with loss, the shape MVA answers in closed form instead of iterating.
template<class T>
std::string sn_print (const qn::NetworkStruct< T > &sn)
 The full field: value dump of a NetworkStruct, ending with a newline.
template<class T>
std::string sn_print_routing_matrix (const qn::NetworkStruct< T > &sn, std::size_t onlyclass=0)
 The human-readable form of sn.rtnodes: one line per positive (node, class) to (node, class) edge.
template<class T>
std::vector< bool > sn_region_members (const qn::NetworkStruct< T > &sn, std::size_t f)
 The membership mask of region f (0-based), one entry per station.
template<class T>
std::vector< std::size_t > sn_region_member_list (const qn::NetworkStruct< T > &sn, std::size_t f)
 The same membership as 1-based station indices, the form most callers want.
template<class T>
qn::NetworkStruct< T > sn_remove_class (const qn::NetworkStruct< T > &sn, std::size_t cls)
 The model without class cls (1-based), leaving sn untouched.
template<class T>
qn::NetworkStruct< T > sn_remove_class (const qn::NetworkStruct< T > &sn, const std::string &name)
 The same, naming the class.
template<class T>
SnRtStations< T > sn_rt_stations (const qn::NetworkStruct< T > &sn)
template<class T>
SnRtOrig< T > sn_rtnodes_to_rtorig (const qn::NetworkStruct< T > &sn)
template<class T>
void sn_refresh_process_fields (qn::NetworkStruct< T > &sn, std::size_t ist, std::size_t r)
 Port of sn_refresh_process_fields: rebuild sn.service[ist][r] from the (rate, SCV) pair currently in sn.rates and sn.scv.
template<class T>
void sn_set_service (qn::NetworkStruct< T > &sn, std::size_t ist, std::size_t r, const T &rate, const T &scv, bool auto_refresh=false)
 Port of sn_set_service: write a (rate, SCV) pair at one (station, class).
template<class T>
void sn_set_arrival (qn::NetworkStruct< T > &sn, std::size_t r, const T &rate, const T &scv, bool auto_refresh=false)
 Port of sn_set_arrival: the same, at whichever station is the Source.
template<class T>
void sn_set_service_batch (qn::NetworkStruct< T > &sn, const Matrix< T > &rates, const Matrix< T > &scvs, const std::vector< std::vector< bool > > &set_rate, const std::vector< std::vector< bool > > &set_scv, bool auto_refresh=false)
 Port of sn_set_service_batch: write a whole (rate, SCV) table, skipping the entries the caller left undefined.
template<class T>
void sn_set_population (qn::NetworkStruct< T > &sn, std::size_t r, double njobs, bool auto_refresh=false)
 Port of sn_set_population: change a class population and the closed total.
template<class T>
void sn_set_servers (qn::NetworkStruct< T > &sn, std::size_t ist, double nservers)
 Port of sn_set_servers.
template<class T>
void sn_set_priority (qn::NetworkStruct< T > &sn, std::size_t r, int priority)
 Port of sn_set_priority.
template<class T>
void sn_set_fork_fanout (qn::NetworkStruct< T > &sn, std::size_t fork_node, double fanout)
 Port of sn_set_fork_fanout.
template<class T>
void sn_set_routing (qn::NetworkStruct< T > &sn, const Matrix< T > &rt, bool auto_refresh=false)
 Port of sn_set_routing: replace the class-expanded stateful routing wholesale.
template<class T>
void sn_set_routing_prob (qn::NetworkStruct< T > &sn, std::size_t from_stateful, std::size_t from_class, std::size_t to_stateful, std::size_t to_class, const T &prob, bool auto_refresh=false)
 Port of sn_set_routing_prob: one entry of the class-expanded stateful routing.
template<class T>
std::vector< std::pair< T, std::vector< T > > > sn_get_state_aggr (const qn::NetworkStruct< T > &sn, const std::vector< std::vector< T > > &state)
 Port of sn_get_state_aggr: the per-class job counts of each stateful node's state row, with the phase and buffer encoding aggregated away.
template<class T>
Matrix< T > sn_declared_marginal (const qn::NetworkStruct< T > &sn)
 The (nstations x nclasses) per-class job counts of the model's OWN state.
template<class T>
bool sn_state_counts_valid (const qn::NetworkStruct< T > &sn, const Matrix< T > &n, const Matrix< T > &s)
 Port of State.isValid, which is the whole body of sn_is_state_valid once the marginals are formed.
template<class T>
bool sn_is_state_valid (const qn::NetworkStruct< T > &sn, const std::vector< std::vector< T > > &state)
 Port of sn_is_state_valid: form the station marginals of state and test them.
template<class T>
std::vector< std::string > sn_validate_dimensions (const qn::NetworkStruct< T > &sn)
 The (nstations x nclasses) matrices agree with the declared dimensions.
template<class T>
std::vector< std::string > sn_validate_rates (const qn::NetworkStruct< T > &sn)
 Rates and SCVs are non-negative wherever the pair is enabled.
template<class T>
std::vector< std::string > sn_validate_population (const qn::NetworkStruct< T > &sn)
 Class populations are neither NaN nor negative; an open class may be Inf.
template<class T>
std::vector< std::string > sn_validate_routing (const qn::NetworkStruct< T > &sn)
 Every non-empty row of rt is a probability vector summing to one.
template<class T>
std::vector< std::string > sn_validate_servers (const qn::NetworkStruct< T > &sn)
 Server counts are positive, except at a Source or a Sink.
template<class T>
std::vector< std::string > sn_validate (const qn::NetworkStruct< T > &sn, ValidationLevel level=ValidationLevel::Full)
 Consistency checks on a NetworkStruct, a port of jar/src/main/java/jline/api/sn/SnValidate.java and ValidationLevel.java.
template<class T>
std::string sn_validate_station_index (const qn::NetworkStruct< T > &sn, std::size_t ist, const std::string &paramName="stationIdx")
template<class T>
std::string sn_validate_class_index (const qn::NetworkStruct< T > &sn, std::size_t r, const std::string &paramName="classIdx")
template<class T>
std::string sn_validate_node_index (const qn::NetworkStruct< T > &sn, std::size_t ind, const std::string &paramName="nodeIdx")
template<class T>
std::string sn_validate_node_type (const qn::NetworkStruct< T > &sn, std::size_t ind, qn::NodeType expected)

Enumeration Type Documentation

◆ PhFit

enum class line::api::PhFit
strong

Which Markovian surrogate to fit; options.config.phfit.

Enumerator
Cme 

concentrated ME plus exponential tail: two moments, exactly

Ph 

Bernstein density fit: a genuine phase-type, shape-carrying.

Hyperexp 

Mixture of exponentials fitted to the ccdf ITSELF across decades of time scale (hyperexp_fit_longtail, Feldmann and Whitt 1998).

The only one of the three that says anything about a LONG TAIL: a Pareto with tail index below 2 has no finite variance, so a two-moment fit does not exist at all, and even where the moments are finite they say nothing about the several orders of magnitude over which such a law acts. It applies only to the families with a closed-form tail below; a light-tailed law falls through to the two-moment surrogate.

Definition at line 82 of file sn_nonmarkov_toph.h.

◆ ValidationLevel

enum class line::api::ValidationLevel
strong

How much of the struct to check; the reference's ValidationLevel.

Enumerator
Full 

every check

Minimal 

dimensions only

None 

skip everything

Definition at line 51 of file sn_validate.h.

Function Documentation

◆ fj_spn_structure()

template<class T>
FjSpnStructure line::api::fj_spn_structure ( const qn::NetworkStruct< T > & sn,
const Matrix< T > & P_r,
const std::vector< bool > & visited,
std::size_t cls = 0 )

Classify one class's visited subgraph and size the auxiliary net.

Exposed because it is what carries the model content: B and the per-Join leaf counts are the construction, and a test that only checked the ones and zeros of the visit vector would not be testing anything.

Definition at line 143 of file sn_fj_visits_spn.h.

References line::api::FjSpnStructure::B, fj_spn_structure(), line::api::FjSpnStructure::forkNodes, line::InputError::InputError(), line::api::FjSpnStructure::inRegion, line::api::FjSpnStructure::joinLeaves, line::api::FjSpnStructure::joinNodes, and line::api::FjSpnStructure::stationNodes.

Referenced by fj_spn_structure(), and sn_fj_visits_spn().

◆ infer_fluid_ps_rt_likelihood()

template<class T>
FluidRtLikelihood line::api::infer_fluid_ps_rt_likelihood ( const qn::NetworkStruct< T > & sn,
std::size_t ist,
std::size_t cls,
const std::vector< double > & levels,
double rsampled,
double marked = 1.0 )

◆ infer_fmlps()

template<class T>
std::vector< double > line::api::infer_fmlps ( const qn::NetworkStruct< T > & sn,
std::size_t ist,
const std::vector< MlpsSample > & samples )

FMLPS: the fluid analogue of MLPS.

Same objective as infer_mlps – the negative log-likelihood of the observed response times – with the exact phase-type density replaced by the fluid passage-time density above. The initial fluid state of each observation is the per-class queue length it found, spread over the phases of each block.

Parameters
sna template network whose station ist carries the demands being estimated; only its service RATES are varied
ist1-based PS station
samplesthe observations

Definition at line 265 of file infer_fmlps.h.

References line::lang::Distrib< T >::exp_rate(), line::fluid::fluid_ode_system(), infer_fluid_ps_rt_likelihood(), infer_fmlps(), line::InputError::InputError(), line::fluid::FluidLayout::kic, line::fluid::FluidOdeSystem::layout, line::api::FluidRtLikelihood::like, line::nelder_mead_box(), line::fluid::FluidLayout::nstates, line::fluid::FluidLayout::qidx, line::qn::NetworkStruct< T >::refresh_rates(), and line::qn::NetworkStruct< T >::set_service().

Referenced by infer_fmlps().

◆ infer_minps()

std::vector< double > line::api::infer_minps ( const std::vector< double > & muZ,
double nCores,
const std::vector< MlpsSample > & samples )
inline

MINPS: run MLPS and RPS and keep whichever gives the smaller mean demand.

The reference's rule verbatim. It is a selection, not a blend: taking the elementwise minimum instead would mix two estimators' class assignments and report a demand vector neither of them produced.

Definition at line 322 of file infer_mlps.h.

References infer_minps(), infer_mlps(), and line::infer::infer_rps().

Referenced by infer_minps(), and infer_minps_from_trace().

◆ infer_minps_from_trace()

std::vector< double > line::api::infer_minps_from_trace ( const std::vector< MinpsClassTrace > & traces,
std::size_t initSample,
std::size_t sampleSize,
double nCores )
inline

Prepare the trace and run MINPS on it, as the reference's last line does.

Definition at line 168 of file infer_minps_setup.h.

References infer_minps(), infer_minps_from_trace(), infer_minps_setup(), line::api::MinpsSetup::lambda, and line::api::MinpsSetup::samples.

Referenced by infer_minps_from_trace().

◆ infer_minps_setup()

MinpsSetup line::api::infer_minps_setup ( const std::vector< MinpsClassTrace > & traces,
std::size_t initSample,
std::size_t sampleSize )
inline

Turn a raw per-class trace into the sample set MINPS estimates from.

Parameters
tracesper-class raw trace, one entry per ORIGINAL class
initSample1-based index of the first sample of the window
sampleSizewindow length; 0 means every sample

Definition at line 73 of file infer_minps_setup.h.

References line::api::MinpsSetup::classMap, line::api::MlpsSample::cls, line::infer::infer_get_qlen_arrival(), infer_minps_setup(), line::InputError::InputError(), line::api::MinpsSetup::lambda, line::api::MlpsSample::ql, line::api::MlpsSample::rt, line::api::MinpsSetup::samples, and line::api::MinpsSetup::threads.

Referenced by infer_minps_from_trace(), and infer_minps_setup().

◆ infer_mlps()

◆ sn_aggregate_chains()

template<class T>
ChainAggregationResult< T > line::api::sn_aggregate_chains ( const qn::NetworkStruct< T > & sn,
const std::string & suffix = std::string() )

Collapse every chain onto one class, port of ModelAdapter.aggregateChains.

Parameters
sna REFRESHED model (the chains, rt and the rates are read)
suffixappended to each chain class name, as the reference's argument

Definition at line 148 of file sn_aggregate_chains.h.

References line::qn::Network< T >::add_closed_class(), line::qn::Network< T >::add_delay(), line::qn::Network< T >::add_open_class(), line::qn::Network< T >::add_queue(), line::qn::Network< T >::add_router(), line::qn::Network< T >::add_sink(), line::qn::Network< T >::add_source(), line::api::ChainAggregationResult< T >::alpha, line::mva::ChainDemands< T >::alpha, line::qn::Station< T >::cap, line::api::ChainAggregationResult< T >::chainclass, line::Matrix< T >::cols(), line::api::ChainAggregationResult< T >::deagg, line::lang::Distrib< T >::det(), line::lang::Distrib< T >::disabled_dist(), line::lang::Distrib< T >::erlang(), line::lang::Distrib< T >::exp_mean(), line::lang::Distrib< T >::exp_rate(), line::lang::GlobalConstants::FineTol, line::lang::Distrib< T >::hyperexp(), line::lang::hyperexp_fit_mean_scv(), line::InputError::InputError(), line::mva::ChainDemands< T >::Lchain, line::qn::Network< T >::link(), line::Matrix< T >::Matrix(), line::qn::NodeDef::name, line::mva::ChainDemands< T >::Nchain, line::lang::node_type_to_text(), line::qn::NodeDef::nodetype, line::qn::Station< T >::nservers, line::lang::Distrib< T >::params, line::qn::Network< T >::raw_struct(), line::mva::ChainDemands< T >::refstatchain, line::Matrix< T >::rows(), line::qn::Station< T >::sched, line::mva::ChainDemands< T >::SCVchain, line::qn::RoutingMatrix< T >::set(), line::qn::Network< T >::set_arrival(), line::qn::Network< T >::set_capacity(), line::qn::Network< T >::set_number_of_servers(), line::qn::Network< T >::set_service(), sn_aggregate_chains(), line::mva::sn_get_demands_chain(), line::qn::NodeDef::station, line::api::ChainAggregationResult< T >::stationnode, line::mva::ChainDemands< T >::STchain, line::UnsupportedError::UnsupportedError(), and line::mva::ChainDemands< T >::Vchain.

Referenced by sn_aggregate_chains(), line::tr::transform_solve_chains(), and line::tr::transform_solve_lc().

◆ sn_arrival_rate_fun()

◆ sn_compat_peak()

template<class T>
T line::api::sn_compat_peak ( const std::vector< double > & counts,
const std::vector< T > & rates )

Rate with every pool active: sum_t counts(t)*rates(t).

Normalizes U = T*S/peak.

Definition at line 103 of file sn_compat_rate.h.

References line::InputError::InputError(), and sn_compat_peak().

Referenced by sn_compat_peak(), and sn_compat_scaling().

◆ sn_compat_rate()

template<class T>
T line::api::sn_compat_rate ( const Matrix< T > & compat,
const std::vector< double > & counts,
const std::vector< T > & rates,
const std::vector< T > & n )

Rate cleared by the pools when the operands in n are present.

Parameters
compat(npools x noperands), nonzero where the pool may serve
counts(npools) servers held by each pool
rates(npools) per-server rate of each pool
n(noperands) per-operand population, integer or fractional

Definition at line 77 of file sn_compat_rate.h.

References line::Matrix< T >::cols(), line::InputError::InputError(), line::Matrix< T >::rows(), and sn_compat_rate().

Referenced by sn_compat_rate(), and sn_compat_scaling().

◆ sn_compat_scaling()

template<class T>
T line::api::sn_compat_scaling ( const Matrix< T > & compat,
const std::vector< double > & counts,
const std::vector< T > & rates,
const std::vector< T > & n )

Rate scaling eta(n) a compatibility declaration imposes on its station.

This is what SolverLN carries onto the layer station, and it is NOT sn_compat_rate / sn_compat_peak. The denominator is the rate the SAME population would obtain under FULL compatibility,

eta(n) = mu(n) / (peak * min(1, sum_j n(j)))

so eta isolates the effect of the compatibility GRAPH and nothing else. The denominator DAMPS BY OCCUPANCY RELATIVE TO THE SERVER COUNT, min(1, N/S), because that is what the solver's own multiserver term contributes: it applies min(N,S) servers at the average server rate peak/S, so

min(N,S) * (peak/S) * eta(n) = mu(n)

and the station clears the activated-server rate exactly, at every state. Damping by min(1, N) instead – which this did until 2026-08-28 – left the effective law at min(N,S)/S * mu(n) and cancelled the REDUNDANCY SPEED-UP the activated-server law exists to express: a pool of S servers facing one compatible job clears S, not 1, because every one works on it and the first to finish cancels the rest. eta is therefore above one at low occupancy, which is the speed-up of servers that would otherwise be idle.

Definition at line 138 of file sn_compat_rate.h.

References sn_compat_peak(), sn_compat_rate(), and sn_compat_scaling().

Referenced by sn_compat_scaling().

◆ sn_declared_marginal()

template<class T>
Matrix< T > line::api::sn_declared_marginal ( const qn::NetworkStruct< T > & sn)

The (nstations x nclasses) per-class job counts of the model's OWN state.

This is what the reference reads as State.toMarginal(sn, ist, state{isf}) inside every getProb* getter, and it is a DECLARED quantity rather than a derived one: setState and initFromMarginal put the jobs where the caller asked, and the probability of "the model's state" is the probability of that placement. The writers emit the row as a one-row stateSpace with a [1] statePrior and the reader stores the pair, so it reaches here.

A STATION THAT DECLARES NOTHING FALLS BACK TO THE DEFAULT MARKING – every closed class's jobs at its reference station – which is what initDefault would have put there, so a model that was never initialized answers exactly as it did before any of this existed. The fallback is per station and not all-or-nothing, matching the reference, where setState on one node leaves the others at whatever they held.

Definition at line 85 of file sn_state.h.

References sn_declared_marginal(), and line::qn::to_marginal_aggr().

Referenced by line::jmt::jmt_prob_aggr(), and sn_declared_marginal().

◆ sn_fj_nodevisits_mmt()

template<class T>
void line::api::sn_fj_nodevisits_mmt ( qn::NetworkStruct< T > & sn)

Rewrite sn.nodevisits with the MMT correction.

A no-op on a model with no fork-join pair, on a tag-augmented struct, and whenever the transformation grows no auxiliary class.

Definition at line 65 of file sn_fj_nodevisits_mmt.h.

References line::mva::fj_mmt(), line::qn::NetworkStruct< T >::inchain, line::qn::NetworkStruct< T >::nchains, line::qn::NetworkStruct< T >::nodes, line::qn::NetworkStruct< T >::nodevisits, and sn_fj_nodevisits_mmt().

Referenced by line::qn::Network< double >::get_struct(), and sn_fj_nodevisits_mmt().

◆ sn_fj_visits_spn()

template<class T>
std::vector< Matrix< T > > line::api::sn_fj_visits_spn ( const qn::NetworkStruct< T > & sn)

Per-chain fork-join node visit ratios.

Returns
one (nnodes x nclasses) matrix per chain, normalized so the chain's reference station carries one

Definition at line 230 of file sn_fj_visits_spn.h.

References line::api::FjSpnStructure::B, fj_spn_structure(), line::api::FjSpnStructure::inRegion, sn_fj_visits_spn(), and line::api::FjSpnStructure::stationNodes.

Referenced by sn_fj_visits_spn().

◆ sn_get_node_arvr_from_tput()

template<class T>
Matrix< T > line::api::sn_get_node_arvr_from_tput ( const qn::NetworkStruct< T > & sn,
const Matrix< T > & TN,
const Matrix< T > & AN )

Port of sn_get_node_arvr_from_tput.

AN is the STATION arrival-rate table (sn_get_arvr_from_tput). Stations copy their own row; every other node takes the chain's reference throughput scaled by its node visits.

Definition at line 152 of file sn_node_metrics.h.

References line::Matrix< T >::rows(), and sn_get_node_arvr_from_tput().

Referenced by line::solvers::node_metrics(), and sn_get_node_arvr_from_tput().

◆ sn_get_node_tput_from_tput()

template<class T>
Matrix< T > line::api::sn_get_node_tput_from_tput ( const qn::NetworkStruct< T > & sn,
const Matrix< T > & TN,
const Matrix< T > & ANn,
const std::map< std::size_t, CacheActualProb< T > > & cache_prob = std::map<std::size_t, CacheActualProb<T>>() )

Port of sn_get_node_tput_from_tput.

Three passes, in the reference's order. A Cache node first splits the arriving flow into its hit and miss classes; every station then overwrites its own node row with its station throughput; finally every non-station node that is not a Sink accumulates what sn.rtnodes carries out of it.

cache_prob maps a 1-based Cache NODE index to its converged split; an absent or empty entry selects the visit-ratio branch.

Definition at line 203 of file sn_node_metrics.h.

References line::Matrix< T >::rows(), and sn_get_node_tput_from_tput().

Referenced by line::solvers::node_metrics(), and sn_get_node_tput_from_tput().

◆ sn_get_state_aggr()

template<class T>
std::vector< std::pair< T, std::vector< T > > > line::api::sn_get_state_aggr ( const qn::NetworkStruct< T > & sn,
const std::vector< std::vector< T > > & state )

Port of sn_get_state_aggr: the per-class job counts of each stateful node's state row, with the phase and buffer encoding aggregated away.

Parameters
statestate[isf] is the row of the (isf+1)-th stateful node
Returns
out[isf] is that node's (ni, nir) pair

Definition at line 56 of file sn_state.h.

References sn_get_state_aggr(), and line::qn::to_marginal_aggr().

Referenced by sn_get_state_aggr().

◆ sn_has_blocking()

template<class T>
bool line::api::sn_has_blocking ( const qn::NetworkStruct< T > & sn)

Defined below, after sn_is_mm1k_loss, which it exempts.

Port of sn_has_blocking: some station can REFUSE a job.

Either its own buffer binds – Kendall's K below the population that can reach it, whatever the drop rule (WAITQ, DROP, BAS, BBS, RSRD) – or a finite capacity region caps a set of stations jointly. Such a network is not product form: the truncation couples the station occupancies, so no BCMP factorization of the equilibrium distribution exists.

Only a buffer that can actually BIND counts, which is what sn_get_buffer_size decides; refresh_capacity derives a finite classcap (the chain population) at every station of every closed model, so a plain finiteness test would call every closed model blocking.

A Cache is exempt: it builds its own capped retrieval queues (classcap 1), which the cache analyzers solve rather than treat as a buffer constraint. So is the single-station M/M/1/K loss system, whose truncated geometric distribution is a product form over its one station.

Definition at line 562 of file sn_predicates.h.

References sn_has_blocking().

Referenced by line::ba::ba_bounds(), line::ba::blocking_default(), line::ba::list_valid_methods(), sn_has_blocking(), sn_has_product_form(), and line::ba::solver_ba_run_analyzer().

◆ sn_has_bursty_arrival()

◆ sn_has_class_switching()

template<class T>
bool line::api::sn_has_class_switching ( const qn::NetworkStruct< T > & sn)

Definition at line 204 of file sn_predicates.h.

References sn_has_class_switching().

Referenced by sn_has_class_switching().

◆ sn_has_classdep_routing()

template<class T>
bool line::api::sn_has_classdep_routing ( const qn::NetworkStruct< T > & sn)

◆ sn_has_closed_classes()

template<class T>
bool line::api::sn_has_closed_classes ( const qn::NetworkStruct< T > & sn)

Definition at line 168 of file sn_predicates.h.

References sn_has_closed_classes().

Referenced by sn_has_closed_classes(), and sn_has_mixed_classes().

◆ sn_has_dps()

template<class T>
bool line::api::sn_has_dps ( const qn::NetworkStruct< T > & sn)

Definition at line 60 of file sn_predicates.h.

References sn_has_dps().

Referenced by sn_has_dps().

◆ sn_has_dps_prio()

template<class T>
bool line::api::sn_has_dps_prio ( const qn::NetworkStruct< T > & sn)

Definition at line 64 of file sn_predicates.h.

References sn_has_dps_prio().

Referenced by sn_has_dps_prio().

◆ sn_has_fcfs()

template<class T>
bool line::api::sn_has_fcfs ( const qn::NetworkStruct< T > & sn)

Definition at line 68 of file sn_predicates.h.

References sn_has_fcfs().

Referenced by sn_has_fcfs().

◆ sn_has_fork_join()

template<class T>
bool line::api::sn_has_fork_join ( const qn::NetworkStruct< T > & sn)

any(sn.fj(:) > 0): the model has a Fork closed by a Join.

sn.fj is the (fork, join) pair list here, so non-empty is the predicate. It is populated on the UN-augmented struct too, exactly as MATLAB's fj matrix is, so this agrees with the reference before and after fj_tag.

Definition at line 271 of file sn_predicates.h.

References sn_has_fork_join().

Referenced by sn_has_fork_join(), sn_has_product_form(), sn_has_product_form_not_het_fcfs(), and sn_is_population_model().

◆ sn_has_fractional_populations()

template<class T>
bool line::api::sn_has_fractional_populations ( const qn::NetworkStruct< T > & sn)

any(sn.njobs ~= round(sn.njobs)); an infinite population rounds to itself.

Definition at line 247 of file sn_predicates.h.

References sn_has_fractional_populations().

Referenced by sn_has_fractional_populations().

◆ sn_has_gps()

template<class T>
bool line::api::sn_has_gps ( const qn::NetworkStruct< T > & sn)

Definition at line 72 of file sn_predicates.h.

References sn_has_gps().

Referenced by sn_has_gps().

◆ sn_has_gps_prio()

template<class T>
bool line::api::sn_has_gps_prio ( const qn::NetworkStruct< T > & sn)

Definition at line 76 of file sn_predicates.h.

References sn_has_gps_prio().

Referenced by sn_has_gps_prio().

◆ sn_has_hol()

template<class T>
bool line::api::sn_has_hol ( const qn::NetworkStruct< T > & sn)

Definition at line 80 of file sn_predicates.h.

References sn_has_hol().

Referenced by sn_has_hol().

◆ sn_has_homogeneous_scheduling()

template<class T>
bool line::api::sn_has_homogeneous_scheduling ( const qn::NetworkStruct< T > & sn,
qn::SchedStrategy  )

Port of sn_has_homogeneous_scheduling.

The reference is length(findstring(sn.sched, strategy)) == sn.nstations, and findstring compares STRINGS: against the numeric sched vector its strcmp is false everywhere, so it returns the sentinel -1, whose length is 1. The predicate therefore reduces to nstations == 1 whatever the disciplines are. Reproduced and not corrected: this is the branch every codebase takes.

Definition at line 154 of file sn_predicates.h.

References sn_has_homogeneous_scheduling().

Referenced by sn_has_homogeneous_scheduling().

◆ sn_has_inf()

template<class T>
bool line::api::sn_has_inf ( const qn::NetworkStruct< T > & sn)

Definition at line 84 of file sn_predicates.h.

References sn_has_inf().

Referenced by sn_has_inf().

◆ sn_has_lcfs()

template<class T>
bool line::api::sn_has_lcfs ( const qn::NetworkStruct< T > & sn)

Definition at line 88 of file sn_predicates.h.

References sn_has_lcfs().

Referenced by sn_has_lcfs().

◆ sn_has_lcfs_pi()

template<class T>
bool line::api::sn_has_lcfs_pi ( const qn::NetworkStruct< T > & sn)

Definition at line 92 of file sn_predicates.h.

References sn_has_lcfs_pi().

Referenced by sn_has_lcfs_pi().

◆ sn_has_lcfs_pr()

template<class T>
bool line::api::sn_has_lcfs_pr ( const qn::NetworkStruct< T > & sn)

Definition at line 96 of file sn_predicates.h.

References sn_has_lcfs_pr().

Referenced by sn_has_lcfs_pr().

◆ sn_has_lept()

template<class T>
bool line::api::sn_has_lept ( const qn::NetworkStruct< T > & sn)

Definition at line 100 of file sn_predicates.h.

References sn_has_lept().

Referenced by sn_has_lept().

◆ sn_has_ljf()

template<class T>
bool line::api::sn_has_ljf ( const qn::NetworkStruct< T > & sn)

Definition at line 104 of file sn_predicates.h.

References sn_has_ljf().

Referenced by sn_has_ljf().

◆ sn_has_load_dependence()

template<class T>
bool line::api::sn_has_load_dependence ( const qn::NetworkStruct< T > & sn)

size(sn.lldscaling,2)>0: some station carries a limited-load scaling row.

Definition at line 257 of file sn_predicates.h.

References sn_has_load_dependence().

Referenced by sn_has_load_dependence().

◆ sn_has_lps()

template<class T>
bool line::api::sn_has_lps ( const qn::NetworkStruct< T > & sn)

Definition at line 108 of file sn_predicates.h.

References sn_has_lps().

Referenced by sn_has_lps().

◆ sn_has_mixed_classes()

template<class T>
bool line::api::sn_has_mixed_classes ( const qn::NetworkStruct< T > & sn)

◆ sn_has_multi_chain()

template<class T>
bool line::api::sn_has_multi_chain ( const qn::NetworkStruct< T > & sn)

Definition at line 188 of file sn_predicates.h.

References sn_has_multi_chain().

Referenced by sn_has_multi_chain().

◆ sn_has_multi_class()

template<class T>
bool line::api::sn_has_multi_class ( const qn::NetworkStruct< T > & sn)

Definition at line 196 of file sn_predicates.h.

References sn_has_multi_class().

Referenced by sn_has_multi_class().

◆ sn_has_multi_class_fcfs()

template<class T>
bool line::api::sn_has_multi_class_fcfs ( const qn::NetworkStruct< T > & sn)

sum(sn.rates(i,:)>0)>1 at some FCFS station: more than one class is served there.

Definition at line 298 of file sn_predicates.h.

References sn_has_multi_class_fcfs().

Referenced by sn_has_multi_class_fcfs().

◆ sn_has_multi_class_heter_exp_fcfs()

template<class T>
bool line::api::sn_has_multi_class_heter_exp_fcfs ( const qn::NetworkStruct< T > & sn)

An FCFS station with heterogeneous rates whose SCVs are all one (exponential).

Definition at line 346 of file sn_predicates.h.

References line::qn::GlobalConstants::FineTol, and sn_has_multi_class_heter_exp_fcfs().

Referenced by sn_has_multi_class_heter_exp_fcfs().

◆ sn_has_multi_class_heter_fcfs()

template<class T>
bool line::api::sn_has_multi_class_heter_fcfs ( const qn::NetworkStruct< T > & sn)

sn_has_multi_class_heter_fcfs: an FCFS station whose per-class rates differ.

MATLAB filters the row with isfinite(rates) & ~isnan(rates), which drops BOTH the NaN of a disabled pair and the Inf of an Immediate service. The disabled flag covers the first; the isfinite test below covers the second, without which an Immediate-served class would make every FCFS station look heterogeneous and take product form away from the model.

Definition at line 322 of file sn_predicates.h.

References sn_has_multi_class_heter_fcfs().

Referenced by sn_has_multi_class_heter_fcfs(), and sn_has_product_form().

◆ sn_has_multi_server()

template<class T>
bool line::api::sn_has_multi_server ( const qn::NetworkStruct< T > & sn)

Definition at line 239 of file sn_predicates.h.

References sn_has_multi_server().

Referenced by sn_has_multi_server().

◆ sn_has_multiple_closed_classes()

template<class T>
bool line::api::sn_has_multiple_closed_classes ( const qn::NetworkStruct< T > & sn)

Definition at line 175 of file sn_predicates.h.

References sn_has_multiple_closed_classes().

Referenced by sn_has_multiple_closed_classes().

◆ sn_has_nonmarkov()

template<class T>
bool line::api::sn_has_nonmarkov ( const qn::NetworkStruct< T > & sn,
bool preserve_det = false )

Whether any law in the struct would be replaced, so a caller can skip copying the struct when there is nothing to convert.

Parameters
snthe struct to inspect
preserve_detleave Det alone, as the MAM analyzer does

Definition at line 334 of file sn_nonmarkov_toph.h.

References line::lang::Distrib< T >::disabled, line::qn::TransitionParam< T >::firingproc, line::lang::Distrib< T >::is_prior(), sn_has_nonmarkov(), and line::lang::Distrib< T >::type.

Referenced by sn_has_nonmarkov(), line::ag::solver_ag_solve(), line::ctmc::solver_ctmc_analyzer(), line::fluid::solver_fluid(), line::mam::solver_mam_get_cdf_respt(), and line::mam::solver_mam_solve().

◆ sn_has_open_classes()

template<class T>
bool line::api::sn_has_open_classes ( const qn::NetworkStruct< T > & sn)

Definition at line 161 of file sn_predicates.h.

References sn_has_open_classes().

Referenced by sn_has_mixed_classes(), and sn_has_open_classes().

◆ sn_has_polling()

template<class T>
bool line::api::sn_has_polling ( const qn::NetworkStruct< T > & sn)

Definition at line 112 of file sn_predicates.h.

References sn_has_polling().

Referenced by sn_has_polling().

◆ sn_has_priorities()

template<class T>
bool line::api::sn_has_priorities ( const qn::NetworkStruct< T > & sn)

◆ sn_has_product_form()

template<class T>
bool line::api::sn_has_product_form ( const qn::NetworkStruct< T > & sn)

Port of sn_has_product_form.

NOTE. NetworkStruct::has_product_form omits the fork-join and the state-dependent-routing conjuncts the reference carries, so it answers TRUE on a model with a surviving Fork or a round-robin dispatcher. That is not a cosmetic difference: the predicate gates exact MVA, the NC convolution and the AUTO solver tree, so the omission silently hands a non-product-form model to an exact algorithm. This free function is the reference-faithful one and callers in the api layer must use it.

Definition at line 413 of file sn_predicates.h.

References sn_has_blocking(), sn_has_fork_join(), sn_has_multi_class_heter_fcfs(), sn_has_priorities(), sn_has_product_form(), sn_has_sd_routing(), and sn_sched_is_product_form().

Referenced by sn_has_product_form().

◆ sn_has_product_form_not_het_fcfs()

template<class T>
bool line::api::sn_has_product_form_not_het_fcfs ( const qn::NetworkStruct< T > & sn,
bool check_means = true )

Port of sn_has_product_form_not_het_fcfs: LCFS is out, and every enabled FCFS pair with a finite positive SCV must have that SCV equal to one, with the service means agreeing across the classes served there.

CHECK_MEANS drops that second half; pass false only for an algorithm that models class-dependent FCFS itself (ab, schmidt, schmidt-ext).

Definition at line 432 of file sn_predicates.h.

References line::qn::GlobalConstants::CoarseTol, line::qn::GlobalConstants::FineTol, sn_has_fork_join(), sn_has_priorities(), sn_has_product_form_not_het_fcfs(), sn_has_sd_routing(), and line::qn::GlobalConstants::Zero.

Referenced by sn_has_product_form_not_het_fcfs().

◆ sn_has_ps()

template<class T>
bool line::api::sn_has_ps ( const qn::NetworkStruct< T > & sn)

Definition at line 116 of file sn_predicates.h.

References sn_has_ps().

Referenced by sn_has_ps().

◆ sn_has_ps_prio()

template<class T>
bool line::api::sn_has_ps_prio ( const qn::NetworkStruct< T > & sn)

Definition at line 120 of file sn_predicates.h.

References sn_has_ps_prio().

Referenced by sn_has_ps_prio().

◆ sn_has_sd_routing()

template<class T>
bool line::api::sn_has_sd_routing ( const qn::NetworkStruct< T > & sn)

sn_has_sd_routing: some node dispatches on the STATE of the network.

RROBIN, WRROBIN, JSQ and SQ. RROBIN matters even though the refresh spreads its probabilities uniformly: the uniform matrix is the right MEAN and the wrong higher moments, so a round-robin model is not product form and must not be handed to exact MVA or to the convolution algorithm.

Definition at line 284 of file sn_predicates.h.

References sn_has_sd_routing().

Referenced by sn_has_product_form(), sn_has_product_form_not_het_fcfs(), and sn_has_sd_routing().

◆ sn_has_sept()

template<class T>
bool line::api::sn_has_sept ( const qn::NetworkStruct< T > & sn)

Definition at line 124 of file sn_predicates.h.

References sn_has_sept().

Referenced by sn_has_sept().

◆ sn_has_setf()

template<class T>
bool line::api::sn_has_setf ( const qn::NetworkStruct< T > & sn)

Definition at line 128 of file sn_predicates.h.

References sn_has_setf().

Referenced by sn_has_setf().

◆ sn_has_single_chain()

template<class T>
bool line::api::sn_has_single_chain ( const qn::NetworkStruct< T > & sn)

Definition at line 192 of file sn_predicates.h.

References sn_has_single_chain().

Referenced by sn_has_single_chain().

◆ sn_has_single_class()

template<class T>
bool line::api::sn_has_single_class ( const qn::NetworkStruct< T > & sn)

Definition at line 200 of file sn_predicates.h.

References sn_has_single_class().

Referenced by sn_has_single_class().

◆ sn_has_siro()

template<class T>
bool line::api::sn_has_siro ( const qn::NetworkStruct< T > & sn)

Definition at line 132 of file sn_predicates.h.

References sn_has_siro().

Referenced by sn_has_siro().

◆ sn_has_sjf()

template<class T>
bool line::api::sn_has_sjf ( const qn::NetworkStruct< T > & sn)

Definition at line 136 of file sn_predicates.h.

References sn_has_sjf().

Referenced by sn_has_sjf().

◆ sn_has_srpt()

template<class T>
bool line::api::sn_has_srpt ( const qn::NetworkStruct< T > & sn)

Definition at line 140 of file sn_predicates.h.

References sn_has_srpt().

Referenced by sn_has_srpt().

◆ sn_is_bas_model()

template<class T>
bool line::api::sn_is_bas_model ( const qn::NetworkStruct< T > & sn)

sn_is_bas_model: a single-class closed model with blocking-after-service.

Definition at line 515 of file sn_predicates.h.

References sn_is_bas_model().

Referenced by sn_is_bas_model().

◆ sn_is_closed_model()

template<class T>
bool line::api::sn_is_closed_model ( const qn::NetworkStruct< T > & sn)

all(isfinite(sn.njobs)): EVERY class is closed.

Definition at line 218 of file sn_predicates.h.

References sn_is_closed_model().

Referenced by sn_is_closed_model().

◆ sn_is_discrete_time()

template<class T>
bool line::api::sn_is_discrete_time ( const qn::NetworkStruct< T > & sn,
const DiscreteTimeOptions & options,
double * slot_length,
DiscreteTimeInfo * info )

True when every law of sn is lattice-valued on slot_length.

slot_length receives the slot in model time units and info the diagnosis. A DMAP mixed with continuous laws is an ERROR rather than a false: its (D0,D1) are probability matrices, so the continuous machinery would form inv(-D0) where the law needs inv(I-D0) and return a wrong number in silence.

Definition at line 83 of file sn_is_discrete_time.h.

References line::api::DiscreteTimeInfo::has_continuous, line::api::DiscreteTimeInfo::has_dmap, line::api::DiscreteTimeInfo::has_lattice, line::InputError::InputError(), line::api::DiscreteTimeInfo::mixed, line::api::DiscreteTimeInfo::reason, line::api::DiscreteTimeOptions::slotlength, sn_is_discrete_time(), and line::api::DiscreteTimeOptions::timescale.

Referenced by line::mam::mam_dispatch(), sn_is_discrete_time(), and line::mam::solver_mam_solve().

◆ sn_is_mixed_model()

template<class T>
bool line::api::sn_is_mixed_model ( const qn::NetworkStruct< T > & sn)

Definition at line 225 of file sn_predicates.h.

References sn_has_mixed_classes(), and sn_is_mixed_model().

Referenced by sn_is_mixed_model().

◆ sn_is_mm1k_loss()

template<class T>
bool line::api::sn_is_mm1k_loss ( const qn::NetworkStruct< T > & sn)

sn_is_mm1k_loss: the three-node Source/Queue/Sink model of an M/M/1/K with loss, the shape MVA answers in closed form instead of iterating.

Definition at line 538 of file sn_predicates.h.

References sn_is_mm1k_loss().

Referenced by sn_is_mm1k_loss().

◆ sn_is_open_model()

template<class T>
bool line::api::sn_is_open_model ( const qn::NetworkStruct< T > & sn)

all(isinf(sn.njobs)): EVERY class is open, which a mixed model fails.

Definition at line 210 of file sn_predicates.h.

References sn_is_open_model().

Referenced by line::fes::fes_validate(), and sn_is_open_model().

◆ sn_is_phasetype() [1/2]

template<class T>
bool line::api::sn_is_phasetype ( const std::vector< Matrix< T > > & maps)

Definition at line 86 of file sn_is_phasetype.h.

References sn_is_phasetype().

◆ sn_is_phasetype() [2/2]

template<class T>
bool line::api::sn_is_phasetype ( const std::vector< Matrix< T > > & maps,
const std::vector< T > & pie )

Whether a (D0, D1, ...) list is a valid phase-type / MAP representation.

Parameters
mapsthe (D0, D1, ...) blocks
piethe entry vector, empty when there is none to check

Definition at line 47 of file sn_is_phasetype.h.

References line::Matrix< T >::cols(), line::Matrix< T >::rows(), sn_is_phasetype(), and line::lang::GlobalConstants::Zero.

Referenced by sn_is_phasetype(), and sn_is_phasetype().

◆ sn_is_population_model()

template<class T>
bool line::api::sn_is_population_model ( const qn::NetworkStruct< T > & sn)

sn_is_population_model: every station is population dependent only, which is what lets the fluid and mean-field limits close on the queue lengths.

Definition at line 499 of file sn_predicates.h.

References sn_has_fork_join(), sn_has_priorities(), and sn_is_population_model().

Referenced by sn_is_population_model().

◆ sn_is_state_valid()

template<class T>
bool line::api::sn_is_state_valid ( const qn::NetworkStruct< T > & sn,
const std::vector< std::vector< T > > & state )

Port of sn_is_state_valid: form the station marginals of state and test them.

A station whose row carries several candidate states is answered on its FIRST row, which is what the reference does after warning: a validity question about a set of states has no single answer.

Definition at line 196 of file sn_state.h.

References line::qn::RowLayout< T >::K, line::qn::RowLayout< T >::Ks, line::qn::Marginal< T >::nir, line::qn::RowLayout< T >::nvar, line::qn::row_layout(), line::qn::Marginal< T >::sir, sn_is_state_valid(), sn_state_counts_valid(), and line::qn::to_marginal().

Referenced by sn_is_state_valid().

◆ sn_map_modulation()

◆ sn_nonmarkov_toph()

◆ sn_open_prob_terms()

template<class T>
OpenProbTerm< T > line::api::sn_open_prob_terms ( const qn::NetworkStruct< T > & sn,
const Matrix< T > & Q,
const Matrix< T > & U,
const Matrix< T > & nir,
std::size_t ist )

Open-class contribution to an aggregate state probability at one station.

Parameters
snthe network struct
Qmean queue lengths, stations by classes
Uutilizations, stations by classes
nirper-class job counts, stations by classes (row ist is read)
ist0-based station index

Definition at line 67 of file sn_open_prob_terms.h.

References line::api::OpenProbTerm< T >::feasible, line::InputError::InputError(), line::api::OpenProbTerm< T >::logp, and sn_open_prob_terms().

Referenced by sn_open_prob_terms(), line::mva::solver_mva_get_prob_aggr(), and line::mva::solver_mva_get_prob_sys_aggr().

◆ sn_patience_handles()

◆ sn_pn_avg_rates()

template<class T>
SnPnAvgRates< T > line::api::sn_pn_avg_rates ( const qn::NetworkStruct< T > & sn,
const Matrix< T > & QN,
const Matrix< T > & TN,
const Matrix< T > & AN,
const Matrix< T > & RN )

Port of sn_pn_avg_rates: rewrite the place rows of TN, AN and RN so that they agree with the recovered mode firing rates.

A place's throughput becomes the rate its tokens are CONSUMED at, its arrival rate the rate they are PRODUCED at, and its response time the quotient the queue length and that throughput define. A model with no Place node, or one whose firing rates could not be recovered, is returned untouched.

Definition at line 225 of file sn_pn_firing_rates.h.

References line::api::SnPnAvgRates< T >::AN, line::api::SnPnFiringRates::consumed, line::api::SnPnFiringRates::place_nodes, line::api::SnPnFiringRates::produced, line::api::SnPnAvgRates< T >::RN, line::Matrix< T >::rows(), sn_pn_avg_rates(), sn_pn_firing_rates(), line::api::SnPnAvgRates< T >::TN, and line::api::SnPnFiringRates::x.

Referenced by sn_pn_avg_rates().

◆ sn_pn_firing_rates()

template<class T>
SnPnFiringRates line::api::sn_pn_firing_rates ( const qn::NetworkStruct< T > & sn,
const Matrix< T > & TN,
bool tput_is_tokens )

Ports of matlab/src/api/sn/sn_pn_firing_rates.m and sn_pn_avg_rates.m.

Parameters
TNstation throughput table, (nstations x nclasses)
tput_is_tokenswhether TN counts tokens (true) or firings (false)

Definition at line 82 of file sn_pn_firing_rates.h.

References line::Matrix< T >::cols(), line::api::SnPnFiringRates::consumed, line::qn::TransitionParam< T >::enabling, line::qn::TransitionParam< T >::firing, line::lang::IMMEDIATE, line::api::SnPnFiringRates::nclasses, line::pinv(), line::api::SnPnFiringRates::place_nodes, line::api::SnPnFiringRates::produced, line::Matrix< T >::rows(), sn_pn_firing_rates(), and line::api::SnPnFiringRates::x.

Referenced by sn_pn_avg_rates(), and sn_pn_firing_rates().

◆ sn_print()

template<class T>
std::string line::api::sn_print ( const qn::NetworkStruct< T > & sn)

◆ sn_print_routing_matrix()

template<class T>
std::string line::api::sn_print_routing_matrix ( const qn::NetworkStruct< T > & sn,
std::size_t onlyclass = 0 )

The human-readable form of sn.rtnodes: one line per positive (node, class) to (node, class) edge.

Parameters
onlyclass1-based class index to restrict to, 0 for every class. The reference matches on the class NAME and keeps an edge when EITHER end names it, which is what the index test below reproduces.

Definition at line 47 of file sn_print_routing_matrix.h.

References sn_print_routing_matrix().

Referenced by sn_print_routing_matrix().

◆ sn_refresh_process_fields()

template<class T>
void line::api::sn_refresh_process_fields ( qn::NetworkStruct< T > & sn,
std::size_t ist,
std::size_t r )

◆ sn_region_member_list()

template<class T>
std::vector< std::size_t > line::api::sn_region_member_list ( const qn::NetworkStruct< T > & sn,
std::size_t f )

The same membership as 1-based station indices, the form most callers want.

Definition at line 66 of file sn_region_members.h.

References sn_region_member_list(), and sn_region_members().

Referenced by sn_region_member_list().

◆ sn_region_members()

template<class T>
std::vector< bool > line::api::sn_region_members ( const qn::NetworkStruct< T > & sn,
std::size_t f )

The membership mask of region f (0-based), one entry per station.

Returns an empty mask when the model declares no such region, which is the reference's behaviour of leaving mask empty rather than raising.

Definition at line 41 of file sn_region_members.h.

References line::qn::NetworkStruct< T >::Region::cap, line::qn::NetworkStruct< T >::Region::maxmem, line::qn::NetworkStruct< T >::Region::members, and sn_region_members().

Referenced by sn_region_member_list(), and sn_region_members().

◆ sn_remove_class() [1/2]

template<class T>
qn::NetworkStruct< T > line::api::sn_remove_class ( const qn::NetworkStruct< T > & sn,
const std::string & name )

The same, naming the class.

THE LOOKUP BY NAME IS NOT A CONVENIENCE. ModelAdapter.removeClass works on a COPY of the model, whose class objects are distinct from the caller's, and the JAR's identity-only lookup therefore returned the model unchanged and silently: a defect found the first time the two entry points were exercised together. A caller here holding a class of a struct that has since been copied, tagged or transformed is in exactly that position, and the name is the one handle that survives those.

Definition at line 327 of file sn_remove_class.h.

References line::InputError::InputError(), and sn_remove_class().

◆ sn_remove_class() [2/2]

template<class T>
qn::NetworkStruct< T > line::api::sn_remove_class ( const qn::NetworkStruct< T > & sn,
std::size_t cls )

◆ sn_rt_stations()

◆ sn_rtnodes_to_rtorig()

◆ sn_sched_is_product_form()

template<class T>
bool line::api::sn_sched_is_product_form ( const qn::NetworkStruct< T > & sn)

The disciplines the reference admits in sn_has_product_form.

Definition at line 386 of file sn_predicates.h.

References sn_sched_is_product_form().

Referenced by sn_has_product_form(), and sn_sched_is_product_form().

◆ sn_set_arrival()

template<class T>
void line::api::sn_set_arrival ( qn::NetworkStruct< T > & sn,
std::size_t r,
const T & rate,
const T & scv,
bool auto_refresh = false )

Port of sn_set_arrival: the same, at whichever station is the Source.

Definition at line 106 of file sn_setters.h.

References line::InputError::InputError(), sn_set_arrival(), and sn_set_service().

Referenced by sn_set_arrival().

◆ sn_set_fork_fanout()

template<class T>
void line::api::sn_set_fork_fanout ( qn::NetworkStruct< T > & sn,
std::size_t fork_node,
double fanout )

Port of sn_set_fork_fanout.

The reference writes sn.nodeparam{f}.fanOut, a field no MATLAB solver reads back; the quantity this struct carries and the fork-join machinery does read is the per-branch multiplicity tasks_per_link, so that is what is written.

Definition at line 176 of file sn_setters.h.

References line::InputError::InputError(), and sn_set_fork_fanout().

Referenced by sn_set_fork_fanout().

◆ sn_set_population()

template<class T>
void line::api::sn_set_population ( qn::NetworkStruct< T > & sn,
std::size_t r,
double njobs,
bool auto_refresh = false )

Port of sn_set_population: change a class population and the closed total.

auto_refresh re-solves the visit ratios, which the reference does because a class that becomes open (or closed) changes which chains are closed and therefore how the visits are normalised.

Definition at line 150 of file sn_setters.h.

References sn_set_population().

Referenced by sn_set_population().

◆ sn_set_priority()

template<class T>
void line::api::sn_set_priority ( qn::NetworkStruct< T > & sn,
std::size_t r,
int priority )

Port of sn_set_priority.

Definition at line 164 of file sn_setters.h.

References sn_set_priority().

Referenced by sn_set_priority().

◆ sn_set_routing()

template<class T>
void line::api::sn_set_routing ( qn::NetworkStruct< T > & sn,
const Matrix< T > & rt,
bool auto_refresh = false )

Port of sn_set_routing: replace the class-expanded stateful routing wholesale.

Definition at line 186 of file sn_setters.h.

References sn_set_routing().

Referenced by sn_set_routing().

◆ sn_set_routing_prob()

template<class T>
void line::api::sn_set_routing_prob ( qn::NetworkStruct< T > & sn,
std::size_t from_stateful,
std::size_t from_class,
std::size_t to_stateful,
std::size_t to_class,
const T & prob,
bool auto_refresh = false )

Port of sn_set_routing_prob: one entry of the class-expanded stateful routing.

Definition at line 193 of file sn_setters.h.

References sn_set_routing_prob().

Referenced by sn_set_routing_prob().

◆ sn_set_servers()

template<class T>
void line::api::sn_set_servers ( qn::NetworkStruct< T > & sn,
std::size_t ist,
double nservers )

Port of sn_set_servers.

Definition at line 158 of file sn_setters.h.

References sn_set_servers().

Referenced by sn_set_servers().

◆ sn_set_service()

template<class T>
void line::api::sn_set_service ( qn::NetworkStruct< T > & sn,
std::size_t ist,
std::size_t r,
const T & rate,
const T & scv,
bool auto_refresh = false )

Port of sn_set_service: write a (rate, SCV) pair at one (station, class).

Definition at line 97 of file sn_setters.h.

References sn_refresh_process_fields(), and sn_set_service().

Referenced by sn_set_arrival(), and sn_set_service().

◆ sn_set_service_batch()

template<class T>
void line::api::sn_set_service_batch ( qn::NetworkStruct< T > & sn,
const Matrix< T > & rates,
const Matrix< T > & scvs,
const std::vector< std::vector< bool > > & set_rate,
const std::vector< std::vector< bool > > & set_scv,
bool auto_refresh = false )

Port of sn_set_service_batch: write a whole (rate, SCV) table, skipping the entries the caller left undefined.

MATLAB marks "leave this one alone" with NaN; this port takes an explicit mask, because a struct instantiated at Rational has no NaN to mark it with.

Definition at line 123 of file sn_setters.h.

References sn_refresh_process_fields(), and sn_set_service_batch().

Referenced by sn_set_service_batch().

◆ sn_state_counts_valid()

template<class T>
bool line::api::sn_state_counts_valid ( const qn::NetworkStruct< T > & sn,
const Matrix< T > & n,
const Matrix< T > & s )

Port of State.isValid, which is the whole body of sn_is_state_valid once the marginals are formed.

Parameters
n(nstations x nclasses) jobs present
s(nstations x nclasses) jobs in service

Definition at line 126 of file sn_state.h.

References line::Matrix< T >::rows(), and sn_state_counts_valid().

Referenced by sn_is_state_valid(), and sn_state_counts_valid().

◆ sn_validate()

template<class T>
std::vector< std::string > line::api::sn_validate ( const qn::NetworkStruct< T > & sn,
ValidationLevel level = ValidationLevel::Full )

Consistency checks on a NetworkStruct, a port of jar/src/main/java/jline/api/sn/SnValidate.java and ValidationLevel.java.

Parameters
snthe struct to check
levelhow much of it to check
Returns
one message per defect, empty when the struct is consistent

Definition at line 191 of file sn_validate.h.

References Full, None, sn_validate(), sn_validate_dimensions(), sn_validate_population(), sn_validate_rates(), sn_validate_routing(), and sn_validate_servers().

Referenced by sn_validate().

◆ sn_validate_class_index()

template<class T>
std::string line::api::sn_validate_class_index ( const qn::NetworkStruct< T > & sn,
std::size_t r,
const std::string & paramName = "classIdx" )

Definition at line 221 of file sn_validate.h.

References sn_validate_class_index().

Referenced by sn_validate_class_index().

◆ sn_validate_dimensions()

template<class T>
std::vector< std::string > line::api::sn_validate_dimensions ( const qn::NetworkStruct< T > & sn)

The (nstations x nclasses) matrices agree with the declared dimensions.

Definition at line 67 of file sn_validate.h.

References sn_validate_dimensions().

Referenced by sn_validate(), and sn_validate_dimensions().

◆ sn_validate_node_index()

template<class T>
std::string line::api::sn_validate_node_index ( const qn::NetworkStruct< T > & sn,
std::size_t ind,
const std::string & paramName = "nodeIdx" )

Definition at line 230 of file sn_validate.h.

References sn_validate_node_index().

Referenced by sn_validate_node_index().

◆ sn_validate_node_type()

template<class T>
std::string line::api::sn_validate_node_type ( const qn::NetworkStruct< T > & sn,
std::size_t ind,
qn::NodeType expected )

Definition at line 240 of file sn_validate.h.

References line::lang::node_type_to_text(), and sn_validate_node_type().

Referenced by sn_validate_node_type().

◆ sn_validate_population()

template<class T>
std::vector< std::string > line::api::sn_validate_population ( const qn::NetworkStruct< T > & sn)

Class populations are neither NaN nor negative; an open class may be Inf.

Definition at line 125 of file sn_validate.h.

References sn_validate_population().

Referenced by sn_validate(), and sn_validate_population().

◆ sn_validate_rates()

template<class T>
std::vector< std::string > line::api::sn_validate_rates ( const qn::NetworkStruct< T > & sn)

Rates and SCVs are non-negative wherever the pair is enabled.

Definition at line 101 of file sn_validate.h.

References sn_validate_rates().

Referenced by sn_validate(), and sn_validate_rates().

◆ sn_validate_routing()

template<class T>
std::vector< std::string > line::api::sn_validate_routing ( const qn::NetworkStruct< T > & sn)

Every non-empty row of rt is a probability vector summing to one.

Definition at line 140 of file sn_validate.h.

References sn_validate_routing().

Referenced by sn_validate(), and sn_validate_routing().

◆ sn_validate_servers()

template<class T>
std::vector< std::string > line::api::sn_validate_servers ( const qn::NetworkStruct< T > & sn)

Server counts are positive, except at a Source or a Sink.

Definition at line 165 of file sn_validate.h.

References sn_validate_servers().

Referenced by sn_validate(), and sn_validate_servers().

◆ sn_validate_station_index()

template<class T>
std::string line::api::sn_validate_station_index ( const qn::NetworkStruct< T > & sn,
std::size_t ist,
const std::string & paramName = "stationIdx" )

Definition at line 212 of file sn_validate.h.

References sn_validate_station_index().

Referenced by sn_validate_station_index().