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

Classes

struct  BoolGraph
 A boolean sparse relation over element indices, e.g. More...
struct  Distrib
struct  LqnBalanceEquations
 The relation set of one layered model. More...
struct  LqnBoxBounds
 What lqn_boxbounds returns, in the layout of the reference's out struct. More...
class  LqnBuilder
struct  LqnCallGroup
 One routed call group: an activity, the strategy that picks among its targets, and the target ENTRIES in declaration order. More...
struct  LqnModel
 The intermediate model, and the second stage that flattens it. More...
struct  LqnMolInfo
 Everything lqn_mol reports beyond the four measure vectors. More...
struct  LqnMolOptions
 Tuning of the outer fixed point. More...
struct  LqnMolResult
 The four (nidx+1) vectors in the column convention SolverLN and LQNS report, so they line up with LN(model).getAvgTable cell for cell. More...
struct  LqnPrecedence
 One activity precedence of a task, with its activities resolved to indices. More...
struct  LqnRefCall
 One row of calls: the reference's [cidx, fromPos, toPos, aidx, vCall]. More...
struct  LqnRefGroup
 One group, the reference's R(g): the DAG below one REF task. More...
struct  LqnRefRoutes
 What lqn_ref_routes returns: the groups, or a non-empty why and no groups. More...
struct  LqnRelation
 One conservation law, as an aggregation over a node's structural neighbours. More...
struct  LqnSolution
 The iterates of a solved layered model, indexed by ABSOLUTE element index. More...
struct  LqnStruct
struct  LqnWriteReport
 What the schema could not carry, one human-readable line per loss. More...
struct  ServerPools
 Heterogeneous server pools declared on a layer server, the twin of the nservertypes / servertypenames / serverspertype / servercompat / heterorates block a Network carries in sn.nodeparam{i}. More...
struct  SparseGraph
 A sparse square matrix over element indices, held as a dense vector of rows with an explicit nonzero list per row. More...

Typedefs

template<class T>
using CdScaling
 A class-dependent scaling map, sn.cdscaling.

Enumerations

enum class  CallType
 Call kinds, with the values of MATLAB CallType. More...
enum class  LqnElement
 LQN element kinds, with the values of MATLAB LayeredNetworkElement. More...
enum class  PrecedenceType
 Activity precedence kinds, with the values of MATLAB ActivityPrecedenceType. More...
enum class  ReplacementStrategy
 Cache replacement policies, with the values of MATLAB ReplacementStrategy. More...
enum class  SchedStrategy
 Scheduling disciplines, with the values of MATLAB SchedStrategy. More...

Functions

template<class T>
LqnBalanceEquations< T > lqn_balance_equations (const LqnStruct< T > &lqn, const LqnSolution< T > *sol=nullptr)
 Enumerate the conservation laws of the layered model lqn.
template<class T>
LqnBoxBounds< T > lqn_boxbounds (const LqnStruct< T > &lqn)
 Evaluate the box bounds of lqn.
template<class T>
LqnMolResult< T > lqn_mol (const LqnStruct< T > &lsn, const LqnMolOptions &options=LqnMolOptions())
 Method of Layers on the SRVN decomposition of a layered queueing network whose entries carry no activity graph.
template<class T>
LqnRefRoutes< T > lqn_ref_routes (const LqnStruct< T > &lqn, const std::vector< std::size_t > &callers, double maxpaths=32.0, const std::vector< std::size_t > &server_set={})
 Resolve the reference routes into the layer whose callers are CALLERS.
template<class T>
LqnStruct< T > lqn_finalize (const LqnModel< T > &m)
 Port of @LayeredNetwork/getStruct.m: flatten the model into its struct.
template<class T>
LqnModel< T > read_lqnx_model (const std::string &path)
template<class T>
LqnStruct< T > read_lqnx (const std::string &path)
 Read a .lqnx model.
template<class T>
LqnWriteReport write_lqnx (const LqnModel< T > &m, const std::string &path, const std::string &model_name=std::string("LQN"), bool use_abstract_names=false, std::string *out_text=NULL)
 Write a layered model as a .lqnx document.
template<class T>
std::string lqnx_to_string (const LqnModel< T > &m, const std::string &model_name=std::string("LQN"), bool use_abstract_names=false)
 The .lqnx document as a STRING, for a caller with no file to write to – the CLI's model-generation mode hands the XML back through its JSON envelope, and a test can compare documents without a temporary directory.

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

Enumeration Type Documentation

◆ CallType

enum class line::lang::CallType
strong

Call kinds, with the values of MATLAB CallType.

Definition at line 469 of file lang_types.h.

◆ LqnElement

enum class line::lang::LqnElement
strong

LQN element kinds, with the values of MATLAB LayeredNetworkElement.

Definition at line 466 of file lang_types.h.

◆ PrecedenceType

enum class line::lang::PrecedenceType
strong

Activity precedence kinds, with the values of MATLAB ActivityPrecedenceType.

Definition at line 472 of file lang_types.h.

◆ ReplacementStrategy

Cache replacement policies, with the values of MATLAB ReplacementStrategy.

Definition at line 380 of file lang_types.h.

◆ 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

◆ lqn_balance_equations()

template<class T>
LqnBalanceEquations< T > line::lqn::lqn_balance_equations ( const LqnStruct< T > & lqn,
const LqnSolution< T > * sol = nullptr )

Enumerate the conservation laws of the layered model lqn.

When sol is non-null every relation is also instantiated and its residual reported. On a converged fixed point they vanish to the solver's own tolerance; a residual that does not is either a documented convention difference (see mult against maxmult) or a defect in the solution.

Definition at line 466 of file lqn_balance_equations.h.

References line::lqn::LqnBalanceEquations< T >::A_flow, line::lqn::LqnBalanceEquations< T >::A_host, line::lqn::LqnBalanceEquations< T >::A_little, line::lang::ASYNC, line::lqn::LqnRelation< T >::branch, line::lqn::LqnRelation< T >::clamped, line::lqn::LqnRelation< T >::coeff, line::lqn::LqnBalanceEquations< T >::convention, line::lqn::LqnRelation< T >::degenerate, line::lqn::LqnBalanceEquations< T >::eqs, line::lang::FWD, line::lqn::LqnBalanceEquations< T >::has_maxresidual, line::lqn::LqnRelation< T >::has_residual, line::lang::INF, line::lqn::LqnRelation< T >::kind, line::lqn::LqnRelation< T >::lhs, lqn_balance_equations(), line::Matrix< T >::Matrix(), line::lqn::LqnRelation< T >::maxmult, line::lqn::LqnBalanceEquations< T >::maxresidual, line::lqn::LqnRelation< T >::mult, line::lqn::LqnRelation< T >::perclassutil, line::lqn::LqnRelation< T >::phase2, line::lqn::LqnRelation< T >::relresidual, line::lqn::LqnRelation< T >::repl, line::lqn::LqnRelation< T >::residual, line::lqn::LqnRelation< T >::rhs, line::lqn::LqnRelation< T >::rhsconst, line::lqn::LqnRelation< T >::scaled, line::lqn::LqnRelation< T >::setup, line::lang::SYNC, line::lqn::LqnRelation< T >::target, line::lqn::LqnRelation< T >::targetname, line::lqn::LqnRelation< T >::termisentry, line::lqn::LqnRelation< T >::terms, line::lqn::LqnBalanceEquations< T >::text, line::lqn::LqnRelation< T >::text, and line::lqn::LqnBalanceEquations< T >::visits.

Referenced by lqn_balance_equations().

◆ lqn_boxbounds()

◆ lqn_finalize()

template<class T>
LqnStruct< T > line::lqn::lqn_finalize ( const LqnModel< T > & m)

Port of @LayeredNetwork/getStruct.m: flatten the model into its struct.

Definition at line 444 of file lqn_reader.h.

References line::lsn::ACTIVITY, line::lqn::LqnStruct< T >::actphase, line::lqn::LqnStruct< T >::actposttype, line::lqn::LqnStruct< T >::actpretype, line::lqn::LqnStruct< T >::actquorum, line::lqn::LqnModel< T >::acts, line::lqn::LqnStruct< T >::actsof, line::lqn::LqnStruct< T >::actthink, line::lqn::LqnStruct< T >::arrival, line::lqn::LqnStruct< T >::ashift, line::lqn::LqnCallGroup::caller, line::lqn::LqnStruct< T >::callgroups, line::lqn::LqnStruct< T >::callhashnames, line::lqn::LqnStruct< T >::callnames, line::lqn::LqnStruct< T >::callpair_dst, line::lqn::LqnStruct< T >::callpair_src, line::lqn::LqnStruct< T >::callproc_mean, line::lqn::LqnStruct< T >::callsof, line::lqn::LqnStruct< T >::calltype, line::lqn::LqnStruct< T >::cdscaling, line::lqn::LqnStruct< T >::cdscalingpeak, line::Matrix< T >::cols(), line::lqn::ServerPools< T >::compat, line::lqn::ServerPools< T >::counts, line::lqn::LqnStruct< T >::cshift, line::lqn::LqnStruct< T >::dag, line::lsn::LsnInput< T >::dag, line::lqn::LqnStruct< T >::delayofftime, line::lqn::Distrib< T >::disabled_dist(), line::lqn::LqnModel< T >::entries, line::lqn::LqnStruct< T >::entriesof, line::lsn::ENTRY, line::lsn::LsnInput< T >::entry_has_arrival, line::lqn::LqnStruct< T >::eshift, line::lqn::LqnStruct< T >::fanin, line::lqn::LqnStruct< T >::fanout, line::lang::GlobalConstants::FineTol, line::lsn::Multiplicity< T >::finite(), line::lqn::LqnStruct< T >::graph, line::lqn::LqnStruct< T >::has_arrival, line::lqn::LqnStruct< T >::hashnames, line::lqn::LqnStruct< T >::hasretrieval, line::lqn::LqnStruct< T >::hassetup, line::lsn::LsnInput< T >::hassetup, line::lsn::HOST, line::lqn::LqnStruct< T >::hostdem, line::lqn::LqnStruct< T >::hshift, line::lqn::Distrib< T >::immediate(), line::lsn::Multiplicity< T >::inf(), line::InputError::InputError(), line::lqn::LqnStruct< T >::isasynccaller, line::lqn::LqnStruct< T >::iscache, line::lqn::LqnStruct< T >::iscaller, line::lqn::LqnStruct< T >::isref, line::lsn::LsnInput< T >::isref, line::lqn::LqnStruct< T >::issynccaller, line::lqn::LqnStruct< T >::itemcap, line::lqn::LqnStruct< T >::itemproc, line::lqn::LqnStruct< T >::jdscaling, line::lqn::LqnStruct< T >::jdscalingpeak, line::lqn::LqnStruct< T >::lincon_A, line::lqn::LqnStruct< T >::lincon_b, line::lqn::LqnStruct< T >::lldscaling, lqn_finalize(), line::lsn::lsn_max_multiplicity(), line::Matrix< T >::Matrix(), line::lqn::LqnStruct< T >::maxmult, line::lqn::LqnStruct< T >::mult, line::lsn::LsnInput< T >::mult, line::lqn::LqnStruct< T >::nacts, line::lqn::LqnStruct< T >::names, line::lqn::ServerPools< T >::names, line::lqn::LqnStruct< T >::ncalls, line::lqn::LqnStruct< T >::nentries, line::lqn::LqnStruct< T >::nhosts, line::lqn::LqnStruct< T >::nidx, line::lqn::LqnStruct< T >::nitems, line::lqn::ServerPools< T >::npools(), line::lqn::LqnStruct< T >::ntasks, line::lqn::LqnStruct< T >::parent, line::lqn::LqnStruct< T >::pools, line::lqn::LqnPrecedence< T >::postacts, line::lqn::LqnPrecedence< T >::postparams, line::lqn::LqnPrecedence< T >::posttype, line::lqn::LqnPrecedence< T >::preacts, line::lqn::LqnStruct< T >::precedences, line::lqn::LqnPrecedence< T >::preparams, line::lqn::LqnPrecedence< T >::pretype, line::lqn::LqnStruct< T >::prio, line::lqn::LqnModel< T >::proc_cdscaling, line::lqn::LqnModel< T >::proc_cdscalingpeak, line::lqn::LqnModel< T >::proc_jdscaling, line::lqn::LqnModel< T >::proc_jdscalingpeak, line::lqn::LqnModel< T >::proc_lincon, line::lqn::LqnModel< T >::proc_linconrows, line::lqn::LqnModel< T >::proc_lldscaling, line::lqn::LqnModel< T >::proc_pools, line::lqn::LqnModel< T >::procs, line::lqn::ServerPools< T >::rates, line::lqn::LqnStruct< T >::repl, line::lqn::LqnStruct< T >::replacestrat, line::lqn::BoolGraph::resize(), line::Matrix< T >::rows(), line::lqn::LqnStruct< T >::sched, line::lqn::BoolGraph::set(), line::lqn::LqnStruct< T >::setuptime, line::lqn::LqnCallGroup::strategy, line::lqn::LqnCallGroup::targets, line::lsn::TASK, line::lqn::LqnStruct< T >::taskgraph, line::lqn::LqnModel< T >::tasks, line::lqn::LqnStruct< T >::tasksof, line::lqn::LqnStruct< T >::think, line::lqn::LqnStruct< T >::tshift, line::lqn::LqnStruct< T >::type, and line::lsn::LsnInput< T >::type.

Referenced by line::lqn::LqnBuilder< T >::build(), line::io::build_lqn_from_json(), line::opt::LineEvaluator::evaluate_layered_sensitivities(), line::io::lqn2java(), line::io::lqn2qn(), lqn_finalize(), read_lqnx(), and write_lqnx().

◆ lqn_mol()

template<class T>
LqnMolResult< T > line::lqn::lqn_mol ( const LqnStruct< T > & lsn,
const LqnMolOptions & options = LqnMolOptions() )

Method of Layers on the SRVN decomposition of a layered queueing network whose entries carry no activity graph.

Parameters
lsnLayeredNetworkStruct of an entry-only, closed, synchronous LQN
optionsiteration cap, tolerance and under-relaxation factor

Definition at line 209 of file lqn_mol.h.

References line::lqn::LqnMolResult< T >::info, lqn_mol(), line::pfqn::pfqn_qdamva(), line::lqn::LqnMolResult< T >::QN, line::pfqn::QdAmvaResult< T >::R, line::lqn::LqnMolResult< T >::RN, line::lqn::LqnMolResult< T >::TN, and line::lqn::LqnMolResult< T >::UN.

Referenced by lqn_mol().

◆ lqn_ref_routes()

template<class T>
LqnRefRoutes< T > line::lqn::lqn_ref_routes ( const LqnStruct< T > & lqn,
const std::vector< std::size_t > & callers,
double maxpaths = 32.0,
const std::vector< std::size_t > & server_set = {} )

Resolve the reference routes into the layer whose callers are CALLERS.

Parameters
lqnthe layered struct (after lqn_fwd_rendezvous, as SolverLN holds it)
callerstask indices that call the layer's server
maxpathsrefuse the layer above this many REF routes into it (default 32)
server_setserver elements of the layer; a prefix node whose task is one of them refuses

A caller reachable from two REF tasks is two INDEPENDENT customer pools, and the whole LAYER falls back rather than that caller alone: a refused caller may lie on another group's path, which would count its threads twice.

Definition at line 384 of file lqn_ref_routes.h.

References lqn_ref_routes().

Referenced by lqn_ref_routes().

◆ lqnx_to_string()

template<class T>
std::string line::lqn::lqnx_to_string ( const LqnModel< T > & m,
const std::string & model_name = std::string("LQN"),
bool use_abstract_names = false )

The .lqnx document as a STRING, for a caller with no file to write to – the CLI's model-generation mode hands the XML back through its JSON envelope, and a test can compare documents without a temporary directory.

Definition at line 550 of file lqn_writer.h.

References lqnx_to_string(), and write_lqnx().

Referenced by lqnx_to_string(), and run_generate().

◆ read_lqnx()

template<class T>
LqnStruct< T > line::lqn::read_lqnx ( const std::string & path)

Read a .lqnx model.

Parameters
pathfile to read
Returns
the flattened struct SolverLN consumes

Definition at line 1688 of file lqn_reader.h.

References lqn_finalize(), read_lqnx(), and read_lqnx_model().

Referenced by line::io::read_layered_model(), and read_lqnx().

◆ read_lqnx_model()

◆ write_lqnx()

template<class T>
LqnWriteReport line::lqn::write_lqnx ( const LqnModel< T > & m,
const std::string & path,
const std::string & model_name = std::string("LQN"),
bool use_abstract_names = false,
std::string * out_text = NULL )

Write a layered model as a .lqnx document.

Parameters
mthe intermediate model, from the builder or from read_lqnx_model
pathfile to create
model_namethe name attribute of <lqn-model>
use_abstract_namesrename elements P1/T1/E1/A1, as writeXML's third argument does, for a document that is compared rather than read
out_textwhen non-null, the document is SERIALIZED INTO IT and no file is written (path is then ignored). The tree cannot be returned instead: xml::Element owns its children through unique_ptr and they hold raw parent back pointers, so a moved tree dangles.
Returns
what the schema could not carry

Definition at line 219 of file lqn_writer.h.

References line::lqn::LqnModel< T >::acts, line::xml::Element::add_child(), line::lqn::LqnWriteReport::dropped, line::lqn::LqnModel< T >::entries, line::lang::GlobalConstants::FineTol, line::InputError::InputError(), lqn_finalize(), line::xml::Element::name, line::lqn::LqnModel< T >::proc_lincon, line::lqn::LqnModel< T >::proc_linconrows, line::lqn::LqnModel< T >::procs, line::lang::sched_to_lqnx(), line::xml::serialize(), line::xml::Element::set_attr(), line::lqn::LqnModel< T >::tasks, line::UnsupportedError::UnsupportedError(), line::xml::write_file(), and write_lqnx().

Referenced by lqnx_to_string(), line::lqns::SolverLQNS< T >::run_analyzer(), line::io::write_lqnx(), and write_lqnx().