5#ifndef LINE_API_LQN_LQN_BOXBOUNDS_H
6#define LINE_API_LQN_LQN_BOXBOUNDS_H
68 case SchedStrategy::FCFS:
70 case SchedStrategy::PS:
71 case SchedStrategy::DPS:
72 case SchedStrategy::GPS:
73 case SchedStrategy::PSPRIO:
74 case SchedStrategy::DPSPRIO:
75 case SchedStrategy::GPSPRIO:
77 case SchedStrategy::HOL:
79 case SchedStrategy::FCFSPRPRIO:
80 case SchedStrategy::LCFSPRPRIO:
90void lqn_box_visit_entry(
const LqnStruct<T>&
lqn, std::size_t eidx,
const T& mult, std::size_t nH,
91 std::vector<T>& d, std::vector<T>& vis);
95void lqn_box_visit_activity(
const LqnStruct<T>&
lqn, std::size_t aidx,
const T& mult,
96 std::size_t nH, std::vector<T>& d, std::vector<T>& vis) {
97 vis[aidx] = T(vis[aidx] + mult);
98 const std::size_t tidx =
lqn.parent[aidx];
99 const std::size_t hidx =
lqn.parent[tidx];
101 if (hidx >= 1 && hidx <= nH) d[hidx] = T(d[hidx] + mult * hd);
102 for (std::size_t cidx :
lqn.callsof[aidx])
104 lqn_box_visit_entry(
lqn,
lqn.callpair_dst[cidx],
105 T(mult *
lqn.callproc_mean[cidx]), nH, d, vis);
110void lqn_box_visit_entry(
const LqnStruct<T>& lqn, std::size_t eidx,
const T& mult, std::size_t nH,
111 std::vector<T>& d, std::vector<T>& vis) {
112 vis[eidx] = T(vis[eidx] + mult);
113 const std::size_t tidx = lqn.parent[eidx];
114 if (tidx >= 1 && tidx < vis.size()) vis[tidx] = T(vis[tidx] + mult);
115 for (std::size_t aidx : lqn.actsof[eidx])
116 if (lqn.parent[aidx] == lqn.parent[eidx])
117 lqn_box_visit_activity(lqn, aidx, mult, nH, d, vis);
132 const std::size_t nidx =
lqn.nidx, nH =
lqn.nhosts;
135 for (std::size_t t = 1; t <=
lqn.ntasks; ++t) {
136 const std::size_t tidx =
lqn.tshift + t;
137 if (
lqn.isref[tidx]) out.
refidx.push_back(tidx);
139 const std::size_t R = out.
refidx.size();
141 throw InputError(
"lqn_boxbounds: the model declares no reference task, so it has no chain");
145 std::vector<T> Nref(R, one), Zref(R, zero);
146 for (std::size_t r = 0; r < R; ++r) {
147 const std::size_t tidx = out.
refidx[r];
148 const double mult =
lqn.mult[tidx];
150 Zref[r] =
lqn.think[tidx].disabled ? zero :
lqn.think[tidx].mean;
151 std::vector<T> d(nH + 1, zero), vis(nidx + 1, zero);
152 for (std::size_t eidx :
lqn.entriesof[tidx])
153 detail::lqn_box_visit_entry(
lqn, eidx, one, nH, d, vis);
154 for (std::size_t h = 0; h <= nH; ++h) D(h, r) = d[h];
155 for (std::size_t i = 0; i <= nidx; ++i) Vis(i, r) = vis[i];
161 Matrix<T> V(nH, R, zero), S(nH, R, zero);
162 for (std::size_t h = 1; h <= nH; ++h)
163 for (std::size_t r = 0; r < R; ++r) {
164 S(h - 1, r) = D(h, r);
165 V(h - 1, r) = D(h, r) > zero ? one : zero;
167 std::vector<pfqn::MwrbbSched> sched(nH);
168 for (std::size_t h = 1; h <= nH; ++h) sched[h - 1] = detail::lqn_disc_code(
lqn.sched[h]);
169 const std::vector<int> prio(R, 0);
175 out.
TN_lo.assign(nidx + 1, zero);
176 out.
TN_up.assign(nidx + 1, zero);
177 out.
UN_lo.assign(nidx + 1, zero);
178 out.
UN_up.assign(nidx + 1, zero);
181 for (std::size_t i = 1; i <= nidx; ++i) {
182 bool visited =
false;
183 for (std::size_t r = 0; r < R; ++r)
184 if (Vis(i, r) > zero) visited =
true;
185 if (!visited)
continue;
187 for (std::size_t r = 0; r < R; ++r) {
192 for (std::size_t h = 1; h <= nH; ++h) {
194 for (std::size_t r = 0; r < R; ++r) {
200 for (std::size_t h = 1; h <= nH; ++h)
201 for (std::size_t r = 0; r < R; ++r) out.
D(h - 1, r) = D(h, r);
The exception types the port throws.
Enumerations and the minimal distribution descriptor shared by the model layer of the C++ port.
LayeredNetworkStruct, the flattened description of a layered queueing network.
Dense matrix and non-owning view.
SchedStrategy
Scheduling disciplines, with the values of MATLAB SchedStrategy.
LqnBoxBounds< T > lqn_boxbounds(const LqnStruct< T > &lqn)
Evaluate the box bounds of lqn.
MwrbbSched
Station discipline codes, matching the MATLAB sched argument.
MwrbbBounds< T > pfqn_mwrbb(const Matrix< T > &V, const Matrix< T > &S, const std::vector< T > &N, const std::vector< T > &Z, const std::vector< MwrbbSched > &sched, const std::vector< int > &prio)
Majumdar-Woodside robust box bounds on the per-class throughput of a closed multiclass network with m...
Conservation laws of a layered queueing network, enumerated from its structure.
Number-type abstraction for the templated API port.
Majumdar-Woodside robust box bounds on the per-class throughput of a closed multiclass network with m...
What lqn_boxbounds returns, in the layout of the reference's out struct.
std::vector< T > Xup
(R) per-chain throughput bounds
std::vector< bool > defined_T
std::vector< bool > defined_U
std::vector< std::size_t > refidx
(R) absolute indices of the reference tasks
std::vector< T > TN_lo
(nidx+1) bounds propagated to every element; defined marks the entries the reference leaves as NaN,...
Matrix< T > D
(nhosts x R) per-chain demand at each processor
Return value of pfqn_mwrbb, mirroring [Xlo, Xup, Wlo].