5#ifndef LINE_SOLVERS_SOLVER_NODE_TABLES_H
6#define LINE_SOLVERS_SOLVER_NODE_TABLES_H
68 const std::vector<double>& CN,
69 const std::vector<double>& XN,
70 const std::string& method) {
71 const std::size_t M =
sn.nstations, R =
sn.nclasses;
80 std::vector<std::vector<bool>> srcmask(M, std::vector<bool>(R,
false));
81 for (std::size_t i = 0; i < M; ++i) {
83 for (std::size_t c = 0; c < R; ++c) srcmask[i][c] =
true;
84 for (std::size_t c = 0; c < R; ++c) {
102 for (std::size_t c = 0; c < CN.size(); ++c)
104 for (std::size_t c = 0; c < XN.size(); ++c)
122 std::vector<bool> hidden(
sn.nclasses,
false);
123 for (
const auto& kv :
sn.nodeparam) {
124 if (kv.first == 0 || kv.first >
sn.nodes.size() ||
125 sn.nodes[kv.first - 1].nodetype != line::qn::NodeType::Cache)
127 for (
const std::vector<std::size_t>& row : kv.second.retrieval_classes)
128 for (std::size_t rc : row)
129 if (rc >= 1 && rc <=
sn.nclasses) hidden[rc - 1] =
true;
150 const std::size_t I =
sn.nodes.size(), R =
sn.nclasses;
157 for (std::size_t ist = 0; ist <
sn.nstations; ++ist) {
158 const std::size_t ind =
sn.station_to_node[ist];
160 for (std::size_t c = 0; c < R; ++c) {
161 m.
QN(ind - 1, c) = r.
QN(ist, c);
162 m.
UN(ind - 1, c) = r.
UN(ist, c);
163 m.
RN(ind - 1, c) = r.
RN(ist, c);
164 m.
WN(ind - 1, c) = r.
WN(ist, c);
188 std::map<std::size_t, line::api::CacheActualProb<T>> cacheprob;
189 for (std::size_t ci = 0; ci < r.
cache.caches.size(); ++ci) {
196 cacheprob[cm.
node] = p;
207 for (std::size_t cind = 1; cind <= I; ++cind) {
208 if (refsn.
nodes[cind - 1].nodetype != line::qn::NodeType::Cache)
continue;
209 typename std::map<std::size_t, line::qn::CacheParam<T>>::const_iterator np =
211 if (np == refsn.
nodeparam.end())
continue;
212 for (std::size_t ind = 1; ind <= I; ++ind) {
214 if (nt != line::qn::NodeType::ClassSwitch && nt != line::qn::NodeType::Sink)
continue;
215 for (std::size_t rr = 1; rr <= R; ++rr)
216 if (line::api::detail::sn_is_cache_class(np->second.hitclass,
217 np->second.missclass, rr))
218 m.
AN(ind - 1, rr - 1) = m.
TN(cind - 1, rr - 1);
What a solver observed about the Cache nodes of a model.
A network plus its refreshed NetworkStruct.
std::map< std::size_t, CacheParam< T > > nodeparam
Cache parameters by 1-based NODE index; only Cache nodes have an entry.
std::vector< NodeDef > nodes
every node, in creation order
Dense matrix and non-owning view.
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.
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.
NodeType
Node kinds, with the values of MATLAB NodeType.
Matrix< T > sn_get_residt_from_respt(const qn::NetworkStruct< T > &L, const Matrix< T > &RN)
Port of sn_get_residt_from_respt: the per-JOB residence time.
Matrix< T > filter_metric(const qn::NetworkStruct< T > &L, const Matrix< T > &metric, MetricKind kind, const std::vector< std::vector< bool > > *zero_mask)
Port of filterMetric: what @@NetworkSolver/getAvg does between the analyzer and the caller.
Matrix< T > sn_get_arvr_from_tput(const qn::NetworkStruct< T > &L, const Matrix< T > &TN)
std::vector< bool > node_table_hidden_classes(const line::qn::NetworkStruct< T > &sn)
The classes getAvgNodeTable omits: the auxiliary retrieval classes that Cache.setRetrievalSystem mint...
line::mva::AvgResult< T > avg_result_from_sim(const line::qn::NetworkStruct< T > &sn, const line::Matrix< double > &QN, const line::Matrix< double > &UN, const line::Matrix< double > &RN, const line::Matrix< double > &TN, const std::vector< double > &CN, const std::vector< double > &XN, const std::string &method)
The station AvgResult of a solver whose runner returns its own solution type, i.e.
NodeMetrics< T > node_metrics(const line::qn::NetworkStruct< T > &sn, const line::mva::AvgResult< T > &r)
Conservation laws of a layered queueing network, enumerated from its structure.
A queueing network and its refreshed NetworkStruct.
Number-type abstraction for the templated API port.
Ports of matlab/src/api/sn/sn_get_node_arvr_from_tput.m and sn_get_node_tput_from_tput....
The SolverMVA class surface: @@SolverMVA/runAnalyzer.m and the gates around it.
The converged cache split, per ORIGINAL class of one Cache node.
std::vector< T > delayed_hit
The metrics getAvg returns, after filtering.
std::shared_ptr< qn::NetworkStruct< T > > refreshed_struct
The struct whose cache self-switch carries the CONVERGED hit/miss split, filled by the cacheqn branch...
Matrix< T > RN
response time, per visit
Matrix< T > UN
utilization
Matrix< T > WN
residence time, per job
std::string method
the method asked for
std::string actualmethod
the algorithm that ran
Matrix< T > QN
queue length
std::vector< T > CN
system response time per class
std::vector< T > XN
system throughput per class
solvers::CacheMetrics< T > cache
What the cache branches observed, EMPTY on a model with no Cache node and on every solver that does n...
Matrix< T > AN
arrival rate
One Cache node's measured behaviour.
std::vector< T > hitprob
(K) TRUE hit fraction, EMPTY = not computed
std::vector< T > delayedprob
(K) delayed-hit fraction, EMPTY off a retrieval system
std::size_t node
1-based node index of the Cache
std::vector< T > missprob
(K)
The station table scattered to the NODE index space, plus the two flow columns the reference recomput...
line::Matrix< T > TN
(nnodes x nclasses)