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

Classes

struct  FesAggregateResult
 What fes_aggregate returns. More...
struct  FesConditionalMetrics
 The per-population tables the conditional sum is taken over. More...
struct  FesDeaggInfo
 Everything needed to map an FES result back onto the original model. More...
struct  FesIsolated
 Demands and visit ratios of the isolated subnetwork. More...
struct  FesMapAggregateResult
 The load-dependent MAP that replaces a subnetwork, with its descriptors. More...
struct  FesMapDeaggregateResult
 Per-station metrics an aggregate stands for. More...
struct  FesMapMoments
 Descriptors a MAP(2) is fitted against. More...
struct  FesMapSolveResult
 System metrics of the delay plus flow-equivalent server model. More...
struct  FesOptions
 options of the reference; the solver field is implied by the convolution. More...
struct  FesValidateResult
 The reference's (isValid, errorMsg) pair. More...

Typedefs

template<class T>
using FesBetaFun = std::function<std::vector<T>(const std::vector<int>&)>
 Class-dependence handle: population vector -> per-class beta.
template<class T>
using CdScaling
 A class-dependent scaling map, sn.cdscaling.

Enumerations

enum class  SchedStrategy
 Scheduling disciplines, with the values of MATLAB SchedStrategy. More...

Functions

template<class T>
FesAggregateResult< T > fes_aggregate (const qn::NetworkStruct< T > &sn, const std::vector< std::size_t > &subsetIndices, const FesOptions &options=FesOptions())
 Flow-equivalent-server aggregation: replace a station subset by one station.
template<class T>
FesBetaFun< T > fes_beta_handle (const std::vector< std::vector< T > > &scalingTable, const std::vector< int > &cutoffs)
 Wraps a flow-equivalent-server throughput table as a per-class class-dependence function beta_{i,r}(n).
template<class T>
FesIsolated< T > fes_build_isolated (const Matrix< T > &rates, const Matrix< T > &stochCompS)
 Build the isolated subnetwork's demands and visit ratios.
template<class T>
FesConditionalMetrics< T > fes_compute_metrics (const Matrix< T > &L, const std::vector< int > &mi, const std::vector< bool > &isDelay, const std::vector< int > &cutoffs)
 Per-station metrics of the ISOLATED subnetwork at every population state, the companion of fes_compute_throughputs.
template<class T>
std::vector< std::vector< T > > fes_compute_throughputs (const Matrix< T > &L, const std::vector< int > &mi, const std::vector< bool > &isDelay, const std::vector< int > &cutoffs)
 Per-class throughput table of an isolated subnetwork, tabulated over the population lattice, for use as the load-dependent rates of a flow-equivalent server (Chandy, Herzog and Woo 1975).
template<class T>
FesMapAggregateResult< T > fes_map_aggregate (const std::vector< mam::Map< T > > &maps, const std::vector< double > &servers, std::size_t n, const std::vector< std::size_t > &grid, const std::string &method="ssolve")
 Recursive MAP flow-equivalent server for a station subset.
template<class T>
FesMapAggregateResult< T > fes_map_aggregate (const std::vector< mam::Map< T > > &maps, const std::vector< double > &servers, std::size_t n)
 Aggregation on the default population grid.
template<class T>
mam::Map< T > fes_map_interdeparture (const std::vector< mam::Map< T > > &maps, const std::vector< mam::Map< T > > &fes, std::size_t n)
 Inter-departure MAP of a closed subnetwork made of one MAP station and one MAP flow-equivalent server.
std::vector< std::size_t > fes_map_grid (std::size_t n, std::size_t nhead=FES_MAP_GRID_NHEAD, std::size_t ntail=FES_MAP_GRID_NTAIL)
 Populations at which the inter-departure MAP is evaluated.
template<class T>
std::vector< T > fes_map_interp (const std::vector< T > &x, const std::vector< T > &y, const std::vector< T > &xq)
 Monotone piecewise cubic Hermite interpolation of one series.
template<class T>
std::vector< mam::Map< T > > fes_map_levels (const mam::Map< T > &map, std::size_t n, double mi=1.0)
 Replicate a load independent MAP over n levels, scaling level k by min(k, mi).
template<class T>
std::vector< mam::Map< T > > fes_map_levels (const std::vector< mam::Map< T > > &levels, std::size_t n)
 Validate a load dependent descriptor and return its first n levels.
template<class T>
std::vector< T > fes_map_euler (const std::vector< T > &v, const Matrix< T > &T0, const T &dt, double tol, std::size_t iter_max)
 Approximate v (-T0)^-1 by the trapezoid rule with the Euler propagator.
template<class T>
FesMapMoments< T > fes_map_moments (const mam::Map< T > &map, const std::string &method="ssolve", double step_safety=0.1, double tol=1e-12, std::size_t iter_max=1000000)
 Moments and index of dispersion of an inter-departure MAP.
template<class T>
FesMapSolveResult< T > fes_map_solve (const std::vector< mam::Map< T > > &fes, const mam::Map< T > &think_map, std::size_t n)
 Closed model left by a MAP flow-equivalent server, and the per-station metrics behind it.
template<class T>
FesMapDeaggregateResult< T > fes_map_deaggregate (const std::vector< T > &pk, const std::vector< T > &L, const std::vector< int > &mi, const std::vector< bool > &isDelay)
std::string fes_node_type_text (qn::NodeType t)
 NodeType.toText, so that the refusal messages read as the reference's do.
template<class T>
FesValidateResult fes_validate (const qn::NetworkStruct< T > &sn, const std::vector< std::size_t > &subsetIndices)
 Input validation for Flow-Equivalent Server (FES) aggregation.
std::size_t ljd_linearize (const std::vector< int > &nvec, const std::vector< int > &cutoffs)
 Linearized index of a per-class population vector, for Limited Joint Dependence (LJD) tables.
std::vector< int > ljd_delinearize (std::size_t idx, const std::vector< int > &cutoffs)
 Inverse of ljd_linearize: the population vector behind an index.

Variables

const std::size_t FES_MAP_GRID_NHEAD = 10
 Leading populations kept in full by the default grid.
const std::size_t FES_MAP_GRID_NTAIL = 10
 Equispaced points above them.

Typedef Documentation

◆ CdScaling

template<class T>
using line::lang::CdScaling

A class-dependent scaling map, sn.cdscaling.

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

Definition at line 639 of file lang_types.h.

◆ FesBetaFun

template<class T>
using line::fes::FesBetaFun = std::function<std::vector<T>(const std::vector<int>&)>

Class-dependence handle: population vector -> per-class beta.

Definition at line 49 of file fes_beta_handle.h.

Enumeration Type Documentation

◆ SchedStrategy

enum class line::lang::SchedStrategy
strong

Scheduling disciplines, with the values of MATLAB SchedStrategy.

Definition at line 181 of file lang_types.h.

Function Documentation

◆ fes_aggregate()

template<class T>
FesAggregateResult< T > line::fes::fes_aggregate ( const qn::NetworkStruct< T > & sn,
const std::vector< std::size_t > & subsetIndices,
const FesOptions & options = FesOptions() )

◆ fes_beta_handle()

template<class T>
FesBetaFun< T > line::fes::fes_beta_handle ( const std::vector< std::vector< T > > & scalingTable,
const std::vector< int > & cutoffs )

Wraps a flow-equivalent-server throughput table as a per-class class-dependence function beta_{i,r}(n).

Parameters
scalingTable(K) linearized per-class throughput vectors, as produced by fes_compute_throughputs
cutoffs(K) the population vector the table was tabulated on

Definition at line 60 of file fes_beta_handle.h.

References fes_beta_handle(), and ljd_linearize().

Referenced by fes_aggregate(), and fes_beta_handle().

◆ fes_build_isolated()

template<class T>
FesIsolated< T > line::fes::fes_build_isolated ( const Matrix< T > & rates,
const Matrix< T > & stochCompS )

Build the isolated subnetwork's demands and visit ratios.

Parameters
rates(M_sub x K) service rates of the subset stations; an entry that is zero, negative or non-finite marks a disabled service and yields a zero demand, as in the reference
stochCompS(M_sub K x M_sub K) stochastic complement of the routing chain over the subset, indexed (i-1)*K + k

Definition at line 99 of file fes_build_isolated.h.

References line::Matrix< T >::cols(), fes_build_isolated(), line::InputError::InputError(), line::fes::FesIsolated< T >::L, line::Matrix< T >::Matrix(), line::num_abs(), line::Matrix< T >::rows(), line::solve(), and line::fes::FesIsolated< T >::visits.

Referenced by fes_aggregate(), and fes_build_isolated().

◆ fes_compute_metrics()

template<class T>
FesConditionalMetrics< T > line::fes::fes_compute_metrics ( const Matrix< T > & L,
const std::vector< int > & mi,
const std::vector< bool > & isDelay,
const std::vector< int > & cutoffs )

Per-station metrics of the ISOLATED subnetwork at every population state, the companion of fes_compute_throughputs.

Parameters
L(M_sub x K) service demands of the isolated subnetwork
mi(M_sub) servers per station; a delay station's entry is ignored
isDelay(M_sub) true where the station is a pure delay
cutoffs(K) per-class population cutoffs

Definition at line 60 of file fes_compute_metrics.h.

References line::Matrix< T >::cols(), fes_compute_metrics(), line::InputError::InputError(), ljd_delinearize(), line::pfqn::pfqn_mvams(), line::fes::FesConditionalMetrics< T >::QN, line::pfqn::MvaResult< T >::QN, line::Matrix< T >::rows(), line::fes::FesConditionalMetrics< T >::UN, and line::pfqn::MvaResult< T >::XN.

Referenced by fes_compute_metrics(), and line::ctmc::solver_ctmc_fes_aggregation().

◆ fes_compute_throughputs()

template<class T>
std::vector< std::vector< T > > line::fes::fes_compute_throughputs ( const Matrix< T > & L,
const std::vector< int > & mi,
const std::vector< bool > & isDelay,
const std::vector< int > & cutoffs )

Per-class throughput table of an isolated subnetwork, tabulated over the population lattice, for use as the load-dependent rates of a flow-equivalent server (Chandy, Herzog and Woo 1975).

Parameters
L(M_sub x K) service demands of the isolated subnetwork
mi(M_sub) servers per station; entries of delay stations are ignored (MATLAB stores Inf there)
isDelay(M_sub) true where the station is a pure delay
cutoffs(K) per-class population cutoffs
Returns
one linearized throughput vector per class, each of length prod_k (cutoffs[k] + 1)

Definition at line 61 of file fes_compute_throughputs.h.

References line::Matrix< T >::cols(), fes_compute_throughputs(), line::InputError::InputError(), ljd_linearize(), line::next_pop(), line::pfqn::pfqn_mvams(), line::Matrix< T >::rows(), and line::pfqn::MvaResult< T >::XN.

Referenced by fes_aggregate(), and fes_compute_throughputs().

◆ fes_map_aggregate() [1/2]

template<class T>
FesMapAggregateResult< T > line::fes::fes_map_aggregate ( const std::vector< mam::Map< T > > & maps,
const std::vector< double > & servers,
std::size_t n )

Aggregation on the default population grid.

Definition at line 143 of file fes_map_aggregate.h.

References fes_map_aggregate(), and fes_map_grid().

◆ fes_map_aggregate() [2/2]

template<class T>
FesMapAggregateResult< T > line::fes::fes_map_aggregate ( const std::vector< mam::Map< T > > & maps,
const std::vector< double > & servers,
std::size_t n,
const std::vector< std::size_t > & grid,
const std::string & method = "ssolve" )

Recursive MAP flow-equivalent server for a station subset.

Parameters
mapsservice process of each station, already scaled by its visit ratio
serversnumber of servers of each station, infinite for a delay
nlargest population the flow-equivalent server must serve
gridpopulations at which the inter-departure MAP is evaluated
methodmoment evaluation method, "ssolve" or "euler"

Definition at line 76 of file fes_map_aggregate.h.

References line::fes::FesMapMoments< T >::e1, line::fes::FesMapMoments< T >::e2, line::fes::FesMapMoments< T >::e3, line::fes::FesMapAggregateResult< T >::fes, fes_map_aggregate(), fes_map_interdeparture(), fes_map_interp(), fes_map_levels(), fes_map_moments(), line::fes::FesMapAggregateResult< T >::grid, line::fes::FesMapMoments< T >::idc, line::InputError::InputError(), line::mam::Map2FitIdcResult< T >::map, line::mam::map2_fit_idc(), line::mam::map_idc(), line::mam::map_moment(), line::fes::FesMapAggregateResult< T >::moments, line::fes::FesMapAggregateResult< T >::status, line::mam::Map2FitIdcResult< T >::status, and line::fes::FesMapAggregateResult< T >::throughput.

Referenced by fes_map_aggregate(), and fes_map_aggregate().

◆ fes_map_deaggregate()

template<class T>
FesMapDeaggregateResult< T > line::fes::fes_map_deaggregate ( const std::vector< T > & pk,
const std::vector< T > & L,
const std::vector< int > & mi,
const std::vector< bool > & isDelay )
Parameters
pklaw of the jobs held by the aggregate, index k = P(k jobs)
Lservice demands of the isolated subnetwork
miservers per station, ignored where isDelay
isDelaytrue where the station is a pure delay

Definition at line 120 of file fes_map_solve.h.

References fes_map_deaggregate(), line::pfqn::pfqn_mva(), line::fes::FesMapDeaggregateResult< T >::Q, line::pfqn::MvaResult< T >::QN, line::fes::FesMapDeaggregateResult< T >::R, line::fes::FesMapDeaggregateResult< T >::U, line::pfqn::MvaResult< T >::UN, line::fes::FesMapDeaggregateResult< T >::X, and line::pfqn::MvaResult< T >::XN.

Referenced by fes_map_deaggregate().

◆ fes_map_euler()

template<class T>
std::vector< T > line::fes::fes_map_euler ( const std::vector< T > & v,
const Matrix< T > & T0,
const T & dt,
double tol,
std::size_t iter_max )

Approximate v (-T0)^-1 by the trapezoid rule with the Euler propagator.

Parameters
vrow vector to be multiplied by (-T0)^-1
T0hidden transitions of the MAP, a stable matrix
dtintegration step, below 1/max(abs(diag(T0)))
tolrelative mass left when the integration stops
iter_maxmaximum number of integration steps

Definition at line 80 of file fes_map_moments.h.

References fes_map_euler(), and line::vecmul().

Referenced by fes_map_euler(), and fes_map_moments().

◆ fes_map_grid()

std::vector< std::size_t > line::fes::fes_map_grid ( std::size_t n,
std::size_t nhead = FES_MAP_GRID_NHEAD,
std::size_t ntail = FES_MAP_GRID_NTAIL )
inline

Populations at which the inter-departure MAP is evaluated.

Fitting one MAP per population is wasteful because the processes of neighbouring populations are similar; the reference evaluates the first ten populations and ten further equispaced points.

Definition at line 48 of file fes_map_interp.h.

References fes_map_grid(), FES_MAP_GRID_NHEAD, and FES_MAP_GRID_NTAIL.

Referenced by fes_map_aggregate(), and fes_map_grid().

◆ fes_map_interdeparture()

template<class T>
mam::Map< T > line::fes::fes_map_interdeparture ( const std::vector< mam::Map< T > > & maps,
const std::vector< mam::Map< T > > & fes,
std::size_t n )

Inter-departure MAP of a closed subnetwork made of one MAP station and one MAP flow-equivalent server.

Parameters
mapsper-level service processes of the station, index j-1 holding j jobs
fesper-level processes of the flow-equivalent server, index k-1 holding k jobs
nnumber of jobs circulating in the subnetwork
Returns
the pair (T0, T1) of the inter-departure MAP

Definition at line 56 of file fes_map_interdeparture.h.

References line::mam::Map< T >::D0, line::mam::Map< T >::D1, fes_map_interdeparture(), fes_map_levels(), line::InputError::InputError(), and line::Matrix< T >::Matrix().

Referenced by fes_map_aggregate(), fes_map_interdeparture(), and fes_map_solve().

◆ fes_map_interp()

template<class T>
std::vector< T > line::fes::fes_map_interp ( const std::vector< T > & x,
const std::vector< T > & y,
const std::vector< T > & xq )

Monotone piecewise cubic Hermite interpolation of one series.

Parameters
xsample abscissae, strictly increasing
ysample values
xqquery abscissae

Definition at line 99 of file fes_map_interp.h.

References fes_map_interp().

Referenced by fes_map_aggregate(), and fes_map_interp().

◆ fes_map_levels() [1/2]

template<class T>
std::vector< mam::Map< T > > line::fes::fes_map_levels ( const mam::Map< T > & map,
std::size_t n,
double mi = 1.0 )

Replicate a load independent MAP over n levels, scaling level k by min(k, mi).

Definition at line 38 of file fes_map_levels.h.

References line::mam::Map< T >::D0, line::mam::Map< T >::D1, and fes_map_levels().

Referenced by fes_map_aggregate(), fes_map_interdeparture(), fes_map_levels(), fes_map_levels(), and fes_map_solve().

◆ fes_map_levels() [2/2]

template<class T>
std::vector< mam::Map< T > > line::fes::fes_map_levels ( const std::vector< mam::Map< T > > & levels,
std::size_t n )

Validate a load dependent descriptor and return its first n levels.

Definition at line 57 of file fes_map_levels.h.

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

◆ fes_map_moments()

template<class T>
FesMapMoments< T > line::fes::fes_map_moments ( const mam::Map< T > & map,
const std::string & method = "ssolve",
double step_safety = 0.1,
double tol = 1e-12,
std::size_t iter_max = 1000000 )

Moments and index of dispersion of an inter-departure MAP.

Parameters
mapthe pair (T0, T1) of the inter-departure MAP
method"ssolve" for the linear solve, "euler" for the quadrature
step_safetyfraction of the uniformization bound used as Euler step
tolrelative mass left when the Euler quadrature stops
iter_maxmaximum number of Euler integration steps

Definition at line 112 of file fes_map_moments.h.

References line::mc::ctmc_solve(), line::mam::Map< T >::D0, line::mam::Map< T >::D1, line::fes::FesMapMoments< T >::e1, line::fes::FesMapMoments< T >::e11, line::fes::FesMapMoments< T >::e2, line::fes::FesMapMoments< T >::e3, fes_map_euler(), fes_map_moments(), line::fes::FesMapMoments< T >::idc, line::InputError::InputError(), line::mam::map_infgen(), line::Matrix< T >::rows(), and line::vecmul().

Referenced by fes_map_aggregate(), and fes_map_moments().

◆ fes_map_solve()

template<class T>
FesMapSolveResult< T > line::fes::fes_map_solve ( const std::vector< mam::Map< T > > & fes,
const mam::Map< T > & think_map,
std::size_t n )

Closed model left by a MAP flow-equivalent server, and the per-station metrics behind it.

Parameters
fesflow-equivalent server, one MAP per level
think_mapthink time process (Z0,Z1)
nnumber of jobs in the closed model

Definition at line 81 of file fes_map_solve.h.

References line::mc::ctmc_solve(), line::mam::Map< T >::D1, fes_map_interdeparture(), fes_map_levels(), fes_map_solve(), line::InputError::InputError(), line::mam::map_infgen(), line::mam::map_moment(), line::fes::FesMapSolveResult< T >::pk, line::fes::FesMapSolveResult< T >::Q, line::fes::FesMapSolveResult< T >::R, line::Matrix< T >::rows(), line::vecmul(), and line::fes::FesMapSolveResult< T >::X.

Referenced by fes_map_solve().

◆ fes_node_type_text()

std::string line::fes::fes_node_type_text ( qn::NodeType t)
inline

NodeType.toText, so that the refusal messages read as the reference's do.

Definition at line 58 of file fes_validate.h.

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

Referenced by fes_node_type_text(), and fes_validate().

◆ fes_validate()

template<class T>
FesValidateResult line::fes::fes_validate ( const qn::NetworkStruct< T > & sn,
const std::vector< std::size_t > & subsetIndices )

Input validation for Flow-Equivalent Server (FES) aggregation.

Parameters
snthe network structure
subsetIndices1-based station indices to aggregate, matching the reference's index base so that the messages agree

Definition at line 85 of file fes_validate.h.

References line::fes::FesValidateResult::errorMsg, fes_node_type_text(), fes_validate(), line::fes::FesValidateResult::isValid, and line::api::sn_is_open_model().

Referenced by fes_aggregate(), and fes_validate().

◆ ljd_delinearize()

std::vector< int > line::fes::ljd_delinearize ( std::size_t idx,
const std::vector< int > & cutoffs )
inline

Inverse of ljd_linearize: the population vector behind an index.

The forward map is a mixed-radix numeral with class k in radix (Nk+1), so the inverse is the digit-by-digit division that reads it back. It is what lets a caller walk a tabulated dependence in index order and still know which population each entry belongs to.

Parameters
idxthe 1-based linearized index
cutoffsper-class cutoffs
Returns
the per-class population vector

Definition at line 70 of file ljd_linearize.h.

References ljd_delinearize().

Referenced by fes_compute_metrics(), and ljd_delinearize().

◆ ljd_linearize()

std::size_t line::fes::ljd_linearize ( const std::vector< int > & nvec,
const std::vector< int > & cutoffs )
inline

Linearized index of a per-class population vector, for Limited Joint Dependence (LJD) tables.

Parameters
nvecper-class populations
cutoffsper-class cutoffs, same length as nvec
Returns
the 1-based linearized index

Definition at line 45 of file ljd_linearize.h.

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

Referenced by fes_beta_handle(), fes_compute_throughputs(), ljd_linearize(), and line::ctmc::solver_ctmc_fes_aggregation().

Variable Documentation

◆ FES_MAP_GRID_NHEAD

const std::size_t line::fes::FES_MAP_GRID_NHEAD = 10

Leading populations kept in full by the default grid.

Definition at line 38 of file fes_map_interp.h.

Referenced by fes_map_grid().

◆ FES_MAP_GRID_NTAIL

const std::size_t line::fes::FES_MAP_GRID_NTAIL = 10

Equispaced points above them.

Definition at line 40 of file fes_map_interp.h.

Referenced by fes_map_grid().