LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
lqn_struct.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2012-2026, QORE Lab, Imperial College London
3 * All rights reserved.
4 */
5#ifndef LINE_LANG_LQN_LQN_STRUCT_H
6#define LINE_LANG_LQN_LQN_STRUCT_H
7
8/**
9 * @file
10 * @ingroup line_lang
11 * LayeredNetworkStruct, the flattened description of a layered queueing network.
12 *
13 * Port of matlab/src/lang/layered/LayeredNetworkStruct.m and of the fields that
14 * matlab/src/lang/layered/@@LayeredNetwork/getStruct.m populates. The
15 * process-descriptor families are carried too: `itemproc` (cache popularity
16 * pmf), `setuptime`, `delayofftime` and `hostdem` (host demand per activity)
17 * are declared below as Distrib / pmf vectors.
18 *
19 * INDEXING. Element indices are 1-based and live in one flat space shared by
20 * the four element kinds, exactly as in MATLAB:
21 *
22 * hosts 1 .. nhosts (hshift = 0)
23 * tasks tshift+1 .. tshift+ntasks (tshift = nhosts)
24 * entries eshift+1 .. eshift+nentries (eshift = nhosts+ntasks)
25 * activities ashift+1 .. ashift+nacts (ashift = eshift+nentries)
26 *
27 * with nidx = ashift + nacts and cshift = nidx, so a call index cidx is
28 * addressed as nidx+cidx inside the entry-service matrix. Calls are numbered
29 * separately, 1..ncalls. Vectors are sized nidx+1 (or ncalls+1) and slot 0 is
30 * unused; this keeps every index expression identical to the reference, which
31 * is worth more here than the one wasted slot, because the arithmetic on these
32 * indices (parent-of-parent to reach a host, aidx-ashift to reach a phase) is
33 * dense and a systematic off-by-one would be silent.
34 *
35 * ARITHMETIC. Means, think times and call multiplicities are T. Element
36 * multiplicities, replication counts and job populations are `double`, matching
37 * MATLAB: they are counts, they can be infinite (an inf-scheduled task), and
38 * they enter the solvers as integer populations, so nothing is gained by
39 * carrying them in the exact type and the infinity would have to be emulated.
40 */
41
42#include <cmath>
43#include <map>
44#include <string>
45#include <unordered_map>
46#include <utility>
47#include <vector>
48
50#include "line/num/number.h"
51#include "line/util/error.h"
52#include "line/util/matrix.h"
53
54namespace line {
55namespace lqn {
56
57using lang::CallType;
58using lang::CdScaling;
59using lang::Distrib;
64
65/**
66 * Heterogeneous server pools declared on a layer server, the twin of the
67 * `nservertypes` / `servertypenames` / `serverspertype` / `servercompat` /
68 * `heterorates` block a Network carries in `sn.nodeparam{i}`.
69 *
70 * `compat(t, j)` is nonzero when pool t may serve OPERAND j -- task j of a host,
71 * entry j of a task, in declaration order, the same operand space the
72 * class- and joint-dependence handles read. SolverLN lowers the pools to the
73 * activated-server rate mu(n) = sum_t counts(t)*rates(t)*[pool t compatible with
74 * some operand present], which is order-independent, and hands it to the layer
75 * station as a joint dependence; see _kb/06-solver-catalog.md (LN section).
76 */
77template <class T>
79 std::vector<std::string> names; ///< (npools) declared pool name
80 std::vector<double> counts; ///< (npools) servers held by each pool
81 std::vector<T> rates; ///< (npools) per-pool rate multiplier
82 Matrix<T> compat; ///< (npools x noperands), nonzero = eligible
83
84 bool empty() const { return names.empty(); }
85 std::size_t npools() const { return names.size(); }
86};
87
88/**
89 * A sparse square matrix over element indices, held as a dense vector of rows
90 * with an explicit nonzero list per row.
91 *
92 * The LQN graph is very sparse (each activity has one or two successors) and
93 * the algorithms walk it by "successors of i", never by column, except for
94 * `find(graph(:,j))` in the reply search and `find(taskgraph(:,t))` in the
95 * multiplicity correction. Both column queries are rare, so they scan.
96 */
97template <class T>
99 std::size_t n = 0;
100 std::vector<std::vector<std::pair<std::size_t, T>>> row; ///< 1-based, row[0] unused
101
102 void resize(std::size_t nn) {
103 n = nn;
104 row.assign(nn + 1, {});
105 }
106 void set(std::size_t i, std::size_t j, const T& v) {
107 for (auto& e : row[i])
108 if (e.first == j) {
109 e.second = v;
110 return;
111 }
112 row[i].emplace_back(j, v);
113 }
114 T get(std::size_t i, std::size_t j) const {
115 for (const auto& e : row[i])
116 if (e.first == j) return e.second;
117 return num_traits<T>::from_int(0);
118 }
119 /** Successors of i in ascending index order, as MATLAB's find() returns them. */
120 std::vector<std::size_t> succ(std::size_t i) const {
121 std::vector<std::size_t> out;
122 const T zero = num_traits<T>::from_int(0);
123 for (const auto& e : row[i])
124 if (e.second != zero) out.push_back(e.first);
125 std::sort(out.begin(), out.end());
126 return out;
127 }
128 /** Predecessors of j in ascending index order. */
129 std::vector<std::size_t> pred(std::size_t j) const {
130 std::vector<std::size_t> out;
131 const T zero = num_traits<T>::from_int(0);
132 for (std::size_t i = 1; i <= n; ++i)
133 for (const auto& e : row[i])
134 if (e.first == j && e.second != zero) {
135 out.push_back(i);
136 break;
137 }
138 return out;
139 }
140 void erase(std::size_t i, std::size_t j) {
141 for (std::size_t k = 0; k < row[i].size(); ++k)
142 if (row[i][k].first == j) {
143 row[i].erase(row[i].begin() + k);
144 return;
145 }
146 }
147};
148
149/** A boolean sparse relation over element indices, e.g. iscaller. */
150struct BoolGraph {
151 std::size_t n = 0;
152 std::vector<std::vector<std::size_t>> row;
153
154 void resize(std::size_t nn) {
155 n = nn;
156 row.assign(nn + 1, {});
157 }
158 void set(std::size_t i, std::size_t j) {
159 for (std::size_t v : row[i])
160 if (v == j) return;
161 row[i].push_back(j);
162 }
163 bool get(std::size_t i, std::size_t j) const {
164 for (std::size_t v : row[i])
165 if (v == j) return true;
166 return false;
167 }
168 bool any_row(std::size_t i) const { return !row[i].empty(); }
169 bool any_col(std::size_t j) const {
170 for (std::size_t i = 1; i <= n; ++i)
171 if (get(i, j)) return true;
172 return false;
173 }
174 std::vector<std::size_t> col(std::size_t j) const {
175 std::vector<std::size_t> out;
176 for (std::size_t i = 1; i <= n; ++i)
177 if (get(i, j)) out.push_back(i);
178 return out;
179 }
180};
181
182/** One activity precedence of a task, with its activities resolved to indices. */
183template <class T>
185 PrecedenceType pretype = PrecedenceType::PRE_SEQ;
186 PrecedenceType posttype = PrecedenceType::POST_SEQ;
187 std::vector<std::size_t> preacts; ///< absolute activity indices
188 std::vector<std::size_t> postacts; ///< absolute activity indices
189 std::vector<T> preparams; ///< PRE_OR shares, or a PRE_AND quorum
190 std::vector<T> postparams; ///< POST_OR probabilities or the POST_LOOP count
191};
192
193/**
194 * One routed call group: an activity, the strategy that picks among its
195 * targets, and the target ENTRIES in declaration order.
196 *
197 * Not a template: it holds no numeric parameter, the per-target call means
198 * living on the member calls in `callproc` as usual.
199 */
201 std::size_t caller = 0; ///< absolute index of the dispatching activity
203 std::vector<std::size_t> targets; ///< absolute entry indices, in declaration order
204};
205
206template <class T>
207struct LqnStruct {
208 std::size_t nidx = 0, nhosts = 0, ntasks = 0, nentries = 0, nacts = 0, ncalls = 0;
209 std::size_t hshift = 0, tshift = 0, eshift = 0, ashift = 0, cshift = 0;
210
211 std::vector<std::string> names; ///< (nidx+1) declared name
212 std::vector<std::string> hashnames; ///< (nidx+1) name prefixed by kind: P:/T:/R:/E:/A:
213 std::vector<LqnElement> type; ///< (nidx+1)
214 std::vector<std::size_t> parent; ///< (nidx+1) host of a task, task of an entry/activity
215 std::vector<SchedStrategy> sched; ///< (tshift+ntasks+1)
216 std::vector<double> mult; ///< (tshift+ntasks+1) declared multiplicity, may be Inf
217 std::vector<double> maxmult; ///< (tshift+ntasks+1) sustainable multiplicity
218 std::vector<double> repl; ///< (tshift+ntasks+1) replication
219 std::vector<int> prio; ///< (tshift+ntasks+1) task priority, larger first (lqns); 0 on hosts (getStruct.m)
220
221 /**
222 * Queue-dependent service rates declared on a layer server (a host or a
223 * task), by element index, empty where absent.
224 *
225 * `lldscaling[i]` is the vector alpha(n) applied at total population n;
226 * `cdscaling[i]` and `jdscaling[i]` are the per-OPERAND handles beta(n) and
227 * eta(n), whose argument counts the jobs the layer station holds on behalf
228 * of task j of a host or entry j of a task, in declaration order. The peak
229 * vectors are required beside the handles, since utilization at such a
230 * station is reported as U = T*S/peak. `pools` carries a compatibility
231 * declaration, which SolverLN lowers to a jdscaling of its own.
232 *
233 * Only the class-switching layer builders emit these; the composed
234 * phase-type law replaces the station by an entry law and so refuses them
235 * by name -- see _kb/04-networkstruct.md and _kb/06-solver-catalog.md.
236 */
237 std::vector<std::vector<T>> lldscaling; ///< (tshift+ntasks+1)
238 std::vector<CdScaling<T>> cdscaling; ///< (tshift+ntasks+1)
239 std::vector<std::vector<T>> cdscalingpeak; ///< (tshift+ntasks+1)
240 std::vector<CdScaling<T>> jdscaling; ///< (tshift+ntasks+1)
241 std::vector<std::vector<T>> jdscalingpeak; ///< (tshift+ntasks+1)
242 std::vector<ServerPools<T>> pools; ///< (tshift+ntasks+1)
243
244 /**
245 * Fan-out and fan-in, keyed by task element index, absent = 0.
246 *
247 * `fanout[{caller, callee}]` is how many callee replicas one caller replica
248 * addresses, and is read by SolverLN to decide whether a replicated task
249 * layer can be pooled into a single station instead of materialised once
250 * per replica (`getStruct.m` builds the same matrix as `lsn.fanout`).
251 * `fanin` is the mirror declaration and is carried for round-trip fidelity
252 * only: no analyzer in ANY codebase reads it, MATLAB and the JAR likewise
253 * park it on the Task and never consult it.
254 */
255 std::map<std::pair<std::size_t, std::size_t>, double> fanout;
256 std::map<std::pair<std::size_t, std::size_t>, double> fanin;
257
258 /** fan-out from caller task `i` to callee task `j`; 0 when undeclared. */
259 double fanout_at(std::size_t i, std::size_t j) const {
260 const std::map<std::pair<std::size_t, std::size_t>, double>::const_iterator it =
261 fanout.find(std::make_pair(i, j));
262 return it == fanout.end() ? 0.0 : it->second;
263 }
264
265 std::vector<bool> isref; ///< (tshift+ntasks+1)
266 std::vector<bool> iscache; ///< (tshift+ntasks+1)
267 std::vector<bool> hasretrieval; ///< (tshift+ntasks+1) cache task with delayed-hit retrieval
268 std::vector<bool> hassetup; ///< (tshift+ntasks+1)
269
270 /**
271 * Cache tasks and item entries.
272 *
273 * `nitems` is indexed by ELEMENT and carries the item population on BOTH
274 * the cache task and each of its item entries, which is how getStruct.m
275 * writes it (`iscache` is the nitems>0 test, over hosts+tasks only).
276 * `itemcap` is the capacity of each cache list, so a plain single-level
277 * cache has one entry. `itemproc` is the item POPULARITY of an item entry,
278 * as an explicit pmf over its `nitems`: the reference stores a discrete
279 * Distribution (a Zipf, typically) and only ever reads its pmf, and this
280 * port has no discrete-distribution type to put there.
281 */
282 std::vector<std::size_t> nitems; ///< (nidx+1)
283 std::vector<std::vector<int>> itemcap; ///< (tshift+ntasks+1)
284 std::vector<ReplacementStrategy> replacestrat; ///< (tshift+ntasks+1)
285 std::vector<std::vector<T>> itemproc; ///< (nidx+1) popularity pmf
286
287 /**
288 * Setup tasks: the server powers down when idle and pays to restart.
289 *
290 * (tshift+ntasks+1); `hassetup` is the "a setup time is declared and is
291 * neither Immediate nor sub-tolerance" test, matching how the reference
292 * gates the feature in LQN2QN's functionTimesOf rather than the bare
293 * ~isempty of getStruct.
294 */
295 std::vector<Distrib<T>> setuptime;
296 std::vector<Distrib<T>> delayofftime;
297
298 std::vector<Distrib<T>> hostdem; ///< (nidx+1) host demand per activity (Immediate elsewhere)
299 std::vector<Distrib<T>> think; ///< (nidx+1) task think time
300 std::vector<Distrib<T>> actthink; ///< (nidx+1) activity think time
301 std::vector<bool> has_arrival; ///< (nidx+1) entry with an open arrival
302 std::vector<Distrib<T>> arrival; ///< (nidx+1) open arrival process of an entry
303
304 std::vector<std::vector<std::size_t>> tasksof; ///< (nhosts+1)
305 std::vector<std::vector<std::size_t>> entriesof; ///< (tshift+ntasks+1)
306 std::vector<std::vector<std::size_t>> actsof; ///< (ashift+1) by task and by entry
307 std::vector<std::vector<std::size_t>> callsof; ///< (nidx+1) call indices issued by an activity
308
309 std::vector<std::size_t> callpair_src; ///< (ncalls+1) calling activity (entry for FWD)
310 std::vector<std::size_t> callpair_dst; ///< (ncalls+1) called entry
311 std::vector<CallType> calltype; ///< (ncalls+1)
312 std::vector<T> callproc_mean; ///< (ncalls+1) mean number of calls
313 std::vector<std::string> callnames; ///< (ncalls+1)
314 std::vector<std::string> callhashnames; ///< (ncalls+1)
315
316 SparseGraph<T> graph; ///< element call/precedence graph, edge weights are branch shares
317 SparseGraph<T> dag; ///< graph with entry-task edges reversed and loop back-edges removed
318 SparseGraph<T> taskgraph; ///< task-to-task calls
320
321 /**
322 * Admission constraint `A n <= b` on the layer station of a host or task.
323 *
324 * (tshift+ntasks+1); an empty A means unconstrained. The COLUMNS are that
325 * host's tasks (`tasksof`) or that task's entries (`entriesof`), in that
326 * order -- element space, not class space. SolverLN::build_layer expands
327 * them into the layer's own classes and emits a Region on the server, an
328 * entry column becoming the CALL classes that target it and a task column
329 * the ACTIVITY classes of that task. Carried by the JSON interchange as
330 * `admissionConstraints`, NOT by .lqnx. See _kb/04-networkstruct.md.
331 */
332 std::vector<Matrix<T>> lincon_A;
333 std::vector<std::vector<T>> lincon_b;
334
335 /**
336 * Activity precedences of each task, as DECLARED, indexed by the task's
337 * absolute index.
338 *
339 * `graph` is the same information after the reader has expanded it into
340 * arcs, and that expansion is lossy for a loop: the back edge carries the
341 * branch PROBABILITY 1 - 1/count, so recovering the count from it inverts a
342 * division and loses the distinction between a loop and an ordinary cycle.
343 * SolverLN method 'srvn.ph' composes the activity graph into a phase-type law
344 * instead of routing it, and needs the count, so it reads this. Every other
345 * consumer reads `graph`.
346 */
347 std::vector<std::vector<LqnPrecedence<T>>> precedences; ///< (tshift+ntasks+1)
348
349 /**
350 * Synchronous calls DISPATCHED AS A GROUP, `lsn.callgroups`.
351 *
352 * `synchCallRoundRobin` / `synchCallJSQ` issue one call per invocation whose
353 * destination cycles over, or is chosen among, several target entries. The
354 * members are ordinary SYNC calls of mean `total/n` and are already in
355 * `callpair`; what this adds is that they are ONE dispatch decision rather
356 * than n independent Bernoulli draws, which is the whole point -- the mean
357 * call rate is the same and the variance is not.
358 *
359 * Representable only under the squashed layering, since the targets must
360 * share a submodel for a dispatch among them to mean anything, and only
361 * under a layer solver that resolves the strategy from the state.
362 */
363 std::vector<LqnCallGroup> callgroups;
364
365 std::vector<PrecedenceType> actpretype; ///< (nidx+1)
366 std::vector<PrecedenceType> actposttype; ///< (nidx+1)
367 std::vector<std::size_t> actquorum; ///< (nidx+1) AND-join quorum, on the join target
368 std::vector<int> actphase; ///< (nacts+1) phase of each activity, 1-based by act
369
370 /** Index of the host of the element, for a task or anything owned by one. */
371 std::size_t host_of(std::size_t idx) const {
372 if (type[idx] == LqnElement::HOST) return idx;
373 if (type[idx] == LqnElement::TASK) return parent[idx];
374 return parent[parent[idx]];
375 }
376
377 /**
378 * Servers of the host of element `idx` that its work can reach: the divisor of every
379 * LQN Util column (SolverLN, SolverLQNS, SolverLDES). It is maxmult capped by the
380 * declared multiplicity, and 1 at an infinite server or where there is no host.
381 */
382 double host_reach_mult(std::size_t idx) const {
383 std::size_t cur = idx;
384 for (std::size_t hops = 0; hops <= nidx; ++hops) {
385 if (cur < 1 || cur > nidx || cur >= type.size()) return 1.0;
386 if (type[cur] == LqnElement::HOST) {
387 // An INF host is never divided, whatever multiplicity a reader stored for it.
388 if (cur < sched.size() && sched[cur] == SchedStrategy::INF) return 1.0;
389 double m = cur < mult.size() ? mult[cur] : 1.0;
390 if (cur < maxmult.size() && maxmult[cur] > 0.0 && maxmult[cur] < m) m = maxmult[cur];
391 // A host stored with multiplicity MaxInt is unbounded and divides by 1, as in MATLAB.
392 return (m > 0.0 && std::isfinite(m) && m < line::lang::GlobalConstants::MaxInt) ? m : 1.0;
393 }
394 const std::size_t p = cur < parent.size() ? parent[cur] : 0;
395 if (p == 0 || p == cur) return 1.0;
396 cur = p;
397 }
398 return 1.0;
399 }
400};
401
402} // namespace lqn
403} // namespace line
404
405#endif // LINE_LANG_LQN_LQN_STRUCT_H
The exception types the port throws.
Enumerations and the minimal distribution descriptor shared by the model layer of the C++ port.
Dense matrix and non-owning view.
SchedStrategy
Scheduling disciplines, with the values of MATLAB SchedStrategy.
Definition lang_types.h:194
PrecedenceType
Activity precedence kinds, with the values of MATLAB ActivityPrecedenceType.
Definition lang_types.h:511
LqnElement
LQN element kinds, with the values of MATLAB LayeredNetworkElement.
Definition lang_types.h:505
RoutingStrategy
Routing strategies, with the values of MATLAB RoutingStrategy.
Definition lang_types.h:430
CallType
Call kinds, with the values of MATLAB CallType.
Definition lang_types.h:508
std::function< std::vector< T >(const std::vector< T > &)> CdScaling
A class-dependent scaling map, sn.cdscaling.
Definition lang_types.h:794
ReplacementStrategy
Cache replacement policies, with the values of MATLAB ReplacementStrategy.
Definition lang_types.h:419
Conservation laws of a layered queueing network, enumerated from its structure.
Definition aoi_dist2ph.h:51
Number-type abstraction for the templated API port.
static constexpr double MaxInt
Stand-in for an unbounded COUNT, MATLAB GlobalConstants.MaxInt.
Definition lang_types.h:834
A boolean sparse relation over element indices, e.g.
Definition lqn_struct.h:150
void set(std::size_t i, std::size_t j)
Definition lqn_struct.h:158
bool any_row(std::size_t i) const
Definition lqn_struct.h:168
std::vector< std::size_t > col(std::size_t j) const
Definition lqn_struct.h:174
bool any_col(std::size_t j) const
Definition lqn_struct.h:169
bool get(std::size_t i, std::size_t j) const
Definition lqn_struct.h:163
void resize(std::size_t nn)
Definition lqn_struct.h:154
std::vector< std::vector< std::size_t > > row
Definition lqn_struct.h:152
One routed call group: an activity, the strategy that picks among its targets, and the target ENTRIES...
Definition lqn_struct.h:200
std::vector< std::size_t > targets
absolute entry indices, in declaration order
Definition lqn_struct.h:203
lang::RoutingStrategy strategy
Definition lqn_struct.h:202
std::size_t caller
absolute index of the dispatching activity
Definition lqn_struct.h:201
One activity precedence of a task, with its activities resolved to indices.
Definition lqn_struct.h:184
std::vector< std::size_t > preacts
absolute activity indices
Definition lqn_struct.h:187
std::vector< T > preparams
PRE_OR shares, or a PRE_AND quorum.
Definition lqn_struct.h:189
std::vector< T > postparams
POST_OR probabilities or the POST_LOOP count.
Definition lqn_struct.h:190
PrecedenceType pretype
Definition lqn_struct.h:185
std::vector< std::size_t > postacts
absolute activity indices
Definition lqn_struct.h:188
PrecedenceType posttype
Definition lqn_struct.h:186
BoolGraph isasynccaller
Definition lqn_struct.h:319
std::vector< Distrib< T > > hostdem
(nidx+1) host demand per activity (Immediate elsewhere)
Definition lqn_struct.h:298
std::vector< std::vector< T > > jdscalingpeak
(tshift+ntasks+1)
Definition lqn_struct.h:241
std::vector< int > actphase
(nacts+1) phase of each activity, 1-based by act
Definition lqn_struct.h:368
std::vector< CallType > calltype
(ncalls+1)
Definition lqn_struct.h:311
std::vector< std::size_t > callpair_dst
(ncalls+1) called entry
Definition lqn_struct.h:310
std::vector< std::vector< LqnPrecedence< T > > > precedences
Activity precedences of each task, as DECLARED, indexed by the task's absolute index.
Definition lqn_struct.h:347
std::size_t host_of(std::size_t idx) const
Index of the host of the element, for a task or anything owned by one.
Definition lqn_struct.h:371
std::vector< std::string > callhashnames
(ncalls+1)
Definition lqn_struct.h:314
std::vector< Distrib< T > > setuptime
Setup tasks: the server powers down when idle and pays to restart.
Definition lqn_struct.h:295
std::map< std::pair< std::size_t, std::size_t >, double > fanout
Fan-out and fan-in, keyed by task element index, absent = 0.
Definition lqn_struct.h:255
std::vector< bool > hassetup
(tshift+ntasks+1)
Definition lqn_struct.h:268
std::vector< LqnElement > type
(nidx+1)
Definition lqn_struct.h:213
std::vector< std::size_t > nitems
Cache tasks and item entries.
Definition lqn_struct.h:282
std::vector< Distrib< T > > actthink
(nidx+1) activity think time
Definition lqn_struct.h:300
std::vector< std::vector< T > > lldscaling
Queue-dependent service rates declared on a layer server (a host or a task), by element index,...
Definition lqn_struct.h:237
std::vector< double > mult
(tshift+ntasks+1) declared multiplicity, may be Inf
Definition lqn_struct.h:216
std::vector< SchedStrategy > sched
(tshift+ntasks+1)
Definition lqn_struct.h:215
std::vector< std::size_t > callpair_src
(ncalls+1) calling activity (entry for FWD)
Definition lqn_struct.h:309
std::vector< std::size_t > parent
(nidx+1) host of a task, task of an entry/activity
Definition lqn_struct.h:214
std::vector< std::vector< T > > lincon_b
Definition lqn_struct.h:333
std::vector< ServerPools< T > > pools
(tshift+ntasks+1)
Definition lqn_struct.h:242
std::vector< T > callproc_mean
(ncalls+1) mean number of calls
Definition lqn_struct.h:312
std::vector< std::size_t > actquorum
(nidx+1) AND-join quorum, on the join target
Definition lqn_struct.h:367
std::vector< bool > iscache
(tshift+ntasks+1)
Definition lqn_struct.h:266
std::vector< bool > has_arrival
(nidx+1) entry with an open arrival
Definition lqn_struct.h:301
std::vector< std::vector< std::size_t > > callsof
(nidx+1) call indices issued by an activity
Definition lqn_struct.h:307
std::size_t nentries
Definition lqn_struct.h:208
std::vector< std::string > hashnames
(nidx+1) name prefixed by kind: P:/T:/R:/E:/A:
Definition lqn_struct.h:212
std::vector< std::string > callnames
(ncalls+1)
Definition lqn_struct.h:313
std::vector< CdScaling< T > > cdscaling
(tshift+ntasks+1)
Definition lqn_struct.h:238
std::vector< std::vector< int > > itemcap
(tshift+ntasks+1)
Definition lqn_struct.h:283
std::vector< std::vector< std::size_t > > entriesof
(tshift+ntasks+1)
Definition lqn_struct.h:305
std::vector< bool > hasretrieval
(tshift+ntasks+1) cache task with delayed-hit retrieval
Definition lqn_struct.h:267
double fanout_at(std::size_t i, std::size_t j) const
fan-out from caller task i to callee task j; 0 when undeclared.
Definition lqn_struct.h:259
std::vector< double > repl
(tshift+ntasks+1) replication
Definition lqn_struct.h:218
std::vector< std::string > names
(nidx+1) declared name
Definition lqn_struct.h:211
std::vector< Matrix< T > > lincon_A
Admission constraint A n <= b on the layer station of a host or task.
Definition lqn_struct.h:332
SparseGraph< T > dag
graph with entry-task edges reversed and loop back-edges removed
Definition lqn_struct.h:317
std::vector< Distrib< T > > think
(nidx+1) task think time
Definition lqn_struct.h:299
std::vector< std::vector< std::size_t > > tasksof
(nhosts+1)
Definition lqn_struct.h:304
std::vector< bool > isref
(tshift+ntasks+1)
Definition lqn_struct.h:265
std::vector< PrecedenceType > actpretype
(nidx+1)
Definition lqn_struct.h:365
std::vector< std::vector< std::size_t > > actsof
(ashift+1) by task and by entry
Definition lqn_struct.h:306
std::map< std::pair< std::size_t, std::size_t >, double > fanin
Definition lqn_struct.h:256
std::vector< PrecedenceType > actposttype
(nidx+1)
Definition lqn_struct.h:366
std::vector< LqnCallGroup > callgroups
Synchronous calls DISPATCHED AS A GROUP, lsn.callgroups.
Definition lqn_struct.h:363
std::vector< std::vector< T > > cdscalingpeak
(tshift+ntasks+1)
Definition lqn_struct.h:239
std::vector< Distrib< T > > delayofftime
Definition lqn_struct.h:296
std::vector< int > prio
(tshift+ntasks+1) task priority, larger first (lqns); 0 on hosts (getStruct.m)
Definition lqn_struct.h:219
std::vector< Distrib< T > > arrival
(nidx+1) open arrival process of an entry
Definition lqn_struct.h:302
std::vector< std::vector< T > > itemproc
(nidx+1) popularity pmf
Definition lqn_struct.h:285
std::vector< CdScaling< T > > jdscaling
(tshift+ntasks+1)
Definition lqn_struct.h:240
double host_reach_mult(std::size_t idx) const
Servers of the host of element idx that its work can reach: the divisor of every LQN Util column (Sol...
Definition lqn_struct.h:382
std::vector< ReplacementStrategy > replacestrat
(tshift+ntasks+1)
Definition lqn_struct.h:284
std::vector< double > maxmult
(tshift+ntasks+1) sustainable multiplicity
Definition lqn_struct.h:217
SparseGraph< T > graph
element call/precedence graph, edge weights are branch shares
Definition lqn_struct.h:316
SparseGraph< T > taskgraph
task-to-task calls
Definition lqn_struct.h:318
Heterogeneous server pools declared on a layer server, the twin of the nservertypes / servertypenames...
Definition lqn_struct.h:78
Matrix< T > compat
(npools x noperands), nonzero = eligible
Definition lqn_struct.h:82
std::vector< double > counts
(npools) servers held by each pool
Definition lqn_struct.h:80
std::vector< std::string > names
(npools) declared pool name
Definition lqn_struct.h:79
std::vector< T > rates
(npools) per-pool rate multiplier
Definition lqn_struct.h:81
std::size_t npools() const
Definition lqn_struct.h:85
A sparse square matrix over element indices, held as a dense vector of rows with an explicit nonzero ...
Definition lqn_struct.h:98
std::vector< std::size_t > succ(std::size_t i) const
Successors of i in ascending index order, as MATLAB's find() returns them.
Definition lqn_struct.h:120
void erase(std::size_t i, std::size_t j)
Definition lqn_struct.h:140
std::vector< std::vector< std::pair< std::size_t, T > > > row
1-based, row[0] unused
Definition lqn_struct.h:100
void resize(std::size_t nn)
Definition lqn_struct.h:102
T get(std::size_t i, std::size_t j) const
Definition lqn_struct.h:114
void set(std::size_t i, std::size_t j, const T &v)
Definition lqn_struct.h:106
std::vector< std::size_t > pred(std::size_t j) const
Predecessors of j in ascending index order.
Definition lqn_struct.h:129