LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
line::qn::Layer< T > Class Template Reference

A layer network: everything a NetworkStruct holds, plus the LQN back-mapping. More...

#include <line/lang/qn/qn_layer.h>

Inheritance diagram for line::qn::Layer< T >:
Collaboration diagram for line::qn::Layer< T >:

Public Attributes

std::size_t clientIdx = 0
 1-based station index of the client Delay, 0 = none
std::size_t serverIdx = 0
 1-based station index of the server
std::vector< std::size_t > server_idx_of
 LQN element -> 1-based station index of its server here, 0 = not served here.
std::vector< std::size_t > host_stations
 station indices of the processor servers
std::vector< std::size_t > task_stations
 station indices of the task servers
bool flat = false
 true when built by the squashed layering
std::vector< std::pair< std::size_t, std::size_t > > attr_tasks
 (classIdx, tidx)
std::vector< std::pair< std::size_t, std::size_t > > attr_entries
 (classIdx, eidx)
std::vector< std::pair< std::size_t, std::size_t > > attr_activities
 (classIdx, aidx)
std::vector< std::array< std::size_t, 4 > > attr_calls
 (classIdx, cidx, callerActivity, calledEntry)
Public Attributes inherited from line::qn::NetworkStruct< T >
std::string name
std::string log_path
 Network.setLogPath / getLogPath: the directory every Logger writes into, and the logPath attribute of an exported JMT model.
std::vector< NodeDefnodes
 every node, in creation order
std::vector< Station< T > > stations
 stations[k-1] is the k-th station
std::vector< std::size_t > station_to_node
 (nstations) 1-based node index
std::vector< std::size_t > stateful_nodes
 1-based node indices, ascending
std::vector< JobClassclasses
std::vector< std::vector< Distrib< T > > > service
 service[i][r], 0-based station and class; a disabled entry marks a pair never visited.
std::map< std::pair< std::size_t, std::size_t >, Matrix< T > > P
 P[(r,s)] is an (nnodes x nnodes) block; absent means all zero.
std::map< std::pair< std::size_t, std::size_t >, Matrix< T > > Peff
 The routing after refresh_routing() has expanded the non-PROB strategies and folded the class switches in.
pfqn::SdrStruct sdr
 Krzesinski (1987) product-form state-dependent routing, in 0-based STATION indices; empty unless a node declares it with set_state_dep_routing.
pfqn::SdrStruct sdr_nodes
 Node-indexed twin of sdr.
std::vector< std::pair< std::size_t, std::size_t > > fj
 fj(f,j): the Join node j that closes the Fork node f, 1-based.
bool isfjaugmented = false
 sn.isfjaugmented: this struct came out of fj_tag, so its Fork nodes are STATEFUL and its Join nodes carry a per-class sibling count instead of the ordinary buffer/server split.
std::vector< std::size_t > fjclassmap
 sn.fjclassmap: the ORIGINAL class of each auxiliary sibling class, 0 for an original class.
std::map< std::size_t, FjJoinParamfjjoinparam
 sn.nodeparam{j}.fj for each Join node: the tag matrix and the required sibling multiplicity after_event_join fires on.
std::size_t sourceIdx = 0
 1-based station index of the Source, 0 = none
std::size_t sinkNode = 0
 1-based NODE index of the Sink, 0 = none (it is not a station)
std::map< std::size_t, CacheParam< T > > nodeparam
 Cache parameters by 1-based NODE index; only Cache nodes have an entry.
std::map< std::size_t, std::vector< T > > initmarking
 The DECLARED initial state of a stateful node, by 1-based node index.
std::map< std::size_t, std::vector< T > > stateprior
std::map< std::size_t, Matrix< T > > statespace
std::map< std::size_t, JoinDecljoindecl
std::map< std::size_t, ForkParam< T > > forkparam
 Variable forking levels, by 1-based Fork node; absent on a plain fork.
std::vector< Rewardreward
std::vector< Regionregions
std::map< std::size_t, TransitionParam< T > > transparam
 Transition (SPN) parameters, keyed by 1-based node index.
std::map< std::size_t, RetrialParam< T > > retrialparam
 Retrial parameters, keyed by 1-based STATION index.
std::map< std::size_t, SetupDelayOffParam< T > > setupparam
 Setup / delay-off, keyed by 1-based STATION index.
std::map< std::size_t, BreakdownParam< T > > breakdownparam
 Server breakdown / repair, keyed by 1-based STATION index.
std::map< std::size_t, Matrix< T > > csmatrix
 The class-switch matrix of a ClassSwitch node, by 1-based NODE index.
std::size_t nstations = 0
std::size_t nclasses = 0
std::size_t nchains = 0
GdScaling< T > gdscaling
 sn.gdscaling: the network-level globally state-dependent (Whittle) rate scaling phi(n).
std::vector< T > gdscalingpeak
 sn.gdscalingpeak: the declared (nstations x nclasses) peak of gdscaling, row-major, used to report Util = T*S/peak.
int gdscalingcutoff = 10
 sn.gdscalingcutoff: the per-slot OPEN-class truncation used when gdscaling is materialized onto the JSON wire (closed classes are tabulated up to their own population).
Matrix< T > rates
 (nstations x nclasses) service rates and SCVs, with a PARALLEL disabled flag instead of MATLAB's NaN sentinel.
Matrix< T > scv
std::vector< std::vector< bool > > disabled
std::vector< std::vector< bool > > immfeed
 sn.immfeed: (nstations x nclasses) IMMEDIATE FEEDBACK, the reference's refreshStruct field.
std::vector< std::vector< bool > > chains
 (nchains x nclasses)
std::vector< std::vector< std::size_t > > inchain
 1-based class indices per chain
std::vector< std::size_t > refclass
 (nchains) 1-based class, 0 = none
std::vector< Matrix< T > > visits
 (nchains) each (nstateful x nclasses)
std::vector< Matrix< T > > nodevisits
 (nchains) each (nnodes x nclasses)
std::vector< double > cap
 sn.cap and sn.classcap: the total and per-class buffers.
std::vector< std::vector< double > > classcap
std::vector< std::vector< DropStrategy > > droprule
Matrix< T > rt
 sn.rt and sn.rtnodes: the class-expanded routing.
Matrix< T > rtnodes
std::vector< std::vector< std::size_t > > nvars
 sn.nvars, (nnodes x 3R+1): the LOCAL VARIABLE columns each node appends to its state, beyond the buffer and the servers.
std::vector< bool > isbasblocking
 sn.isbasblocking, per NODE: true where the node is the BLOCKING (upstream) side of a true-BAS relation and therefore carries the blocked marker in nvars column 2R+1.
std::vector< std::vector< bool > > isbasdestination
 sn.isbasdestination, (nstations x nclasses): true where a refusal at this station must BLOCK an upstream BAS station rather than drop the job.
std::map< std::size_t, PasParampasparam
std::vector< std::vector< bool > > replyblock
 sn.replyblock (nnodes x nclasses) and sn.syncreply (nclasses).
std::vector< std::size_t > syncreply
std::map< std::size_t, PollingParampollingparam
std::vector< bool > issignal
std::vector< lang::SignalTypesignaltype
std::vector< std::size_t > signaltarget
std::vector< lang::RemovalPolicysignalrempolicy
std::vector< std::vector< T > > signalremdist

Additional Inherited Members

Public Member Functions inherited from line::qn::NetworkStruct< T >
bool has_service_law (std::size_t i, std::size_t r) const
 Does (station i, class r) have a service law an analyzer may convert?
const ForkParam< T > * fork_param_of (std::size_t node) const
 The fork's override block, or null when it declares none.
bool has_breakdown_node (std::size_t ind) const
 sn.hasbreakdown(ind): does the NODE's server break down?
bool has_breakdown () const
 Any station at all, the guard every solver gate needs first.
PollingParam effective_polling (std::size_t ist) const
 The polling controller of station ist, from whichever API declared it.
std::size_t nvars_of (std::size_t ind) const
 Total local-variable width of node ind (1-based).
std::size_t nof_stations () const
std::size_t nof_classes () const
std::size_t nof_nodes () const
std::size_t nof_stateful () const
std::vector< double > njobs () const
 sn.njobs: the population of each class, infinite for an open one.
double nclosedjobs () const
 sn.nclosedjobs: the total population of the closed classes.
ProcessType procid (std::size_t ist, std::size_t r) const
 sn.procid(i,r): the process type of a (station, class) pair.
std::size_t phases_of (std::size_t ist, std::size_t r) const
 sn.phases(i,r): the order of the process representation.
std::size_t phasessz_of (std::size_t ist, std::size_t r) const
 sn.phasessz(i,r) = max(sn.phases(i,r),1): THE WIDTH of class r's phase block in a state row, as opposed to phases_of, which is its CONTENT.
bool has_fork () const
bool has_sdr_routing () const
 MATLAB's any(sn.isstatedep(:,3)) NARROWED TO THE ONE STRATEGY THIS PORT EVALUATES PER STATE: Krzesinski's SDR.
std::vector< std::size_t > rr_outlinks (std::size_t ind, std::size_t r) const
 ROUND-ROBIN DISPATCH, the state that makes it deterministic.
std::vector< std::size_t > rr_weighted_outlinks (std::size_t ind, std::size_t r) const
 The WRROBIN cycle: each outlink repeated by its weight, weight 0 once.
std::size_t rr_var_slot (std::size_t ind, std::size_t r) const
 1-BASED index of the pointer of (ind, r) INSIDE the node's local-variable block, or 0 when that pair does not dispatch round-robin.
std::size_t rr_dest (std::size_t ind, std::size_t r, const std::vector< T > &varrow) const
 The destination node the pointer in VARROW names, or 0 when (ind, r) does not dispatch round-robin or the pointer is out of range.
void rr_advance (std::size_t ind, std::size_t r, std::vector< T > &varrow) const
 Advance the pointer of (ind, r) in VARROW by one position, cyclically.
bool has_rr_routing () const
 Whether ANY (node, class) pair dispatches round-robin.
bool has_immediate_feedback () const
 any(sn.immfeed(:)): whether any (station, class) pair feeds back.
std::size_t node_of_station (std::size_t st) const
 1-based node index of a station, and the reverse; 0 when absent.
std::size_t stateful_index (std::size_t ind) const
 1-based stateful index of node ind, 0 when the node is not stateful.
std::size_t stateful_of_station (std::size_t st) const
std::size_t add_station (const Station< T > &st)
 Add a station, which is also a node, and grow the service table.
std::size_t add_node (const std::string &nm, NodeType ty, bool stateful)
 Add a non-station node (a Fork, a Router).
std::size_t add_class (const JobClass &cl)
 Add a class and grow the service table.
void set_service (std::size_t station, std::size_t cls, const Distrib< T > &d)
void set_route (std::size_t r, std::size_t s, std::size_t i, std::size_t j, const T &p)
 P{r,s}(i,j) = p, with 1-based NODE and class indices.
void set_route_effective (std::size_t r, std::size_t s, std::size_t i, std::size_t j, const T &p)
 Write into the routing the consumers actually read.
get_route (std::size_t r, std::size_t s, std::size_t i, std::size_t j) const
 P{r,s}(i,j), AS THE USER SET IT.
route_eff (std::size_t r, std::size_t s, std::size_t i, std::size_t j) const
 The routing actually in force: the expansion when there is one, else P.
void refresh_struct ()
 The whole chain, in MATLAB's refreshStruct order.
bool holds_reply_for (std::size_t ind, std::size_t r) const
 True when node ind (1-based) holds a server across a synchronous call whose reply class is r (1-based), i.e.
bool serves_class (std::size_t ind, std::size_t r) const
 Whether a job of class r (0-based) can LEAVE node ind (1-based) again.
std::vector< std::vector< bool > > reached_node_classes () const
 The (node, class) pairs a job can actually ARRIVE at, 0-based on both axes.
void check_service_reachable () const
 Refuses a class that is ROUTED TO a station which cannot serve it.
void refresh_immfeed ()
 Port of the sn.immfeed block of @@MNetwork/refreshStruct.m.
void refresh_router_stateful ()
 Port of MNetwork.refreshLocalVars: the per-node local-variable widths.
void refresh_local_vars ()
void refresh_replyblock ()
 sn.replyblock, DERIVED from sn.syncreply and the routing.
std::vector< std::size_t > downstream_stations (std::size_t ind) const
 The nodes directly downstream of ind, walking THROUGH stateless nodes and stopping at the first station on each path.
void refresh_bas_blocking ()
 Port of refreshLocalVars' true-BAS block and its declaresBlockedMarker helper: which nodes carry the blocked marker, and where a refusal blocks.
void refresh_sched_param ()
 Port of MNetwork.refreshScheduling's schedparam half.
void refresh_routing ()
 Port of the part of MNetwork.refreshRoutingMatrix this port reaches: the expansion of a routing STRATEGY into the probabilities rt is built from.
std::size_t join_siblings (std::size_t joinNode, std::size_t r=0) const
 Port of MNetwork.refreshCapacity.
std::vector< std::size_t > quorum_joins () const
 The 1-based Join nodes that fire on a STRICT quorum, i.e.
void refresh_capacity ()
void refresh_rt ()
 sn.rt and sn.rtnodes: the class-expanded routing matrices.
void refresh_cacheqn_actual_visits (const Matrix< T > &hitprob, const Matrix< T > &missprob)
 Re-resolve the cache read self-switch from the offered 1/2-1/2 to the ACTUAL hit/miss probabilities the cacheqn decomposition converged on, then recompute rt and the visits.
void refresh_rates ()
 Port of MNetwork.refreshRates: lower each service process onto a rate and an SCV.
void refresh_chains ()
 Port of MNetwork.refreshChains followed by sn_refresh_visits.
void apply_sink_closure ()
 Route every open chain from the Sink back into the Source, as the tail of MATLAB's getRoutingMatrix does before it takes the stochastic complement.
std::vector< std::size_t > all_nodes () const
 Every node index, 1-based, for the node-level visit computation.
Matrix< T > chain_visits (std::size_t c, const std::vector< std::size_t > &sel, bool complement, bool fork) const
 Port of the per-chain body of sn_refresh_visits, over an arbitrary node subset – the stateful nodes for visits, all nodes for nodevisits.
Matrix< T > visits_from_block (const Matrix< T > &Pc_in, const std::vector< std::size_t > &sel, const std::vector< std::size_t > &ic, std::size_t refnode) const
 The visit ratios of one chain from an already-formed chain routing block Pc (dim = sel.size() * nIC), the no-fork body of sn_refresh_visits: solve the embedded DTMC over the visited states and normalise by the total visits at the reference node.
void da_recompute_visits_from_rtnodes ()
 Recompute rt, visits and nodevisits after the caller has rewritten rtnodes in place – the cacheqn driver's per-sweep refresh.
Matrix< T > station_routing (const std::vector< std::size_t > &ic) const
 The chain-restricted routing over the STATEFUL nodes: the node-level routing with the non-stateful nodes eliminated by a stochastic complement, S = P11 + P12 (I - P22)^-1 P21.
Matrix< T > stoch_comp_stateful (const Matrix< T > &full, std::size_t nIC) const
 The stochastic complement of a NODE-level routing block over the stateful nodes, S = P11 + P12 (I - P22)^-1 P21.
bool has_open_classes () const
bool is_open_model () const
 sn_is_open_model: EVERY class is open, which is not has_open_classes.
bool has_multi_server () const
bool has_fractional_populations () const
bool has_class_switching () const
bool has_priorities () const
bool has_distinct_priorities () const
 Whether the classes carry more than one priority level.
bool sched_has_priority_aware () const
 Whether some station runs a discipline that READS the class priorities.
bool priorities_ignored () const
 Priorities were declared and no station will read them.
bool has_homogeneous_scheduling (SchedStrategy) const
 Port of sn_has_homogeneous_scheduling.
bool has_multi_class_heter_fcfs () const
bool sched_is_product_form () const
bool has_exponential_fcfs () const
 BCMP type 1 asks the FCFS service to be exponential.
double buffer_size (std::size_t ist) const
 Kendall's K of station IST (1-based), +inf when unbounded.
bool is_mm1k_loss () const
 Implementation of api::sn_is_mm1k_loss; that free function delegates here.
bool has_blocking () const
 Some station can REFUSE a job: its own buffer BINDS, or a finite capacity region caps a set of stations jointly.
bool has_product_form () const
bool has_product_form_not_het_fcfs (bool check_means=true) const
 Port of sn_has_product_form_not_het_fcfs: LCFS is excluded, and at FCFS the service must be exponential AND class-independent, which is what BCMP type 1 asks for.
void grow_routing ()
 Grow every routing block to the current node count.
void grow_block (Matrix< T > &B) const
double total_jobs () const
 Total population, as MATLAB's getNumberOfJobs summed.

Detailed Description

template<class T>
class line::qn::Layer< T >

A layer network: everything a NetworkStruct holds, plus the LQN back-mapping.

clientIdx / serverIdx are the two stations every layer has by construction (the callers' Delay and the served task's station); the attr_* vectors pair a 1-based class index with the index of the LQN element it stands for, in the LayeredNetworkStruct's own numbering.

Under the SQUASHED layering (flat) a layer serves MANY elements at once, so serverIdx is no longer the answer to "which station stands for element i": server_idx_of is, and it is populated under both layerings so a consumer can read it without knowing which one built the layer.

Definition at line 52 of file qn_layer.h.

Member Data Documentation

◆ attr_activities

template<class T>
std::vector<std::pair<std::size_t, std::size_t> > line::qn::Layer< T >::attr_activities

(classIdx, aidx)

Definition at line 63 of file qn_layer.h.

◆ attr_calls

template<class T>
std::vector<std::array<std::size_t, 4> > line::qn::Layer< T >::attr_calls

(classIdx, cidx, callerActivity, calledEntry)

Definition at line 65 of file qn_layer.h.

◆ attr_entries

template<class T>
std::vector<std::pair<std::size_t, std::size_t> > line::qn::Layer< T >::attr_entries

(classIdx, eidx)

Definition at line 62 of file qn_layer.h.

◆ attr_tasks

template<class T>
std::vector<std::pair<std::size_t, std::size_t> > line::qn::Layer< T >::attr_tasks

(classIdx, tidx)

Definition at line 61 of file qn_layer.h.

◆ clientIdx

template<class T>
std::size_t line::qn::Layer< T >::clientIdx = 0

1-based station index of the client Delay, 0 = none

Definition at line 54 of file qn_layer.h.

◆ flat

template<class T>
bool line::qn::Layer< T >::flat = false

true when built by the squashed layering

Definition at line 60 of file qn_layer.h.

◆ host_stations

template<class T>
std::vector<std::size_t> line::qn::Layer< T >::host_stations

station indices of the processor servers

Definition at line 58 of file qn_layer.h.

◆ server_idx_of

template<class T>
std::vector<std::size_t> line::qn::Layer< T >::server_idx_of

LQN element -> 1-based station index of its server here, 0 = not served here.

Definition at line 57 of file qn_layer.h.

◆ serverIdx

template<class T>
std::size_t line::qn::Layer< T >::serverIdx = 0

1-based station index of the server

Definition at line 55 of file qn_layer.h.

◆ task_stations

template<class T>
std::vector<std::size_t> line::qn::Layer< T >::task_stations

station indices of the task servers

Definition at line 59 of file qn_layer.h.


The documentation for this class was generated from the following file: