5#ifndef LINE_API_FES_MAP_SOLVE_H
6#define LINE_API_FES_MAP_SOLVE_H
83 if (n < 1)
throw InputError(
"fes_map_solve: the population must be at least 1");
85 const std::vector<mam::Map<T>> think =
86 fes_map_levels(think_map, n, std::numeric_limits<double>::infinity());
90 const std::size_t dim = Q.
rows();
94 const std::vector<T> phiT1 =
vecmul(phi, T01.
D1);
98 for (
const T& v : phiT1) out.
X += v;
100 const std::size_t blk = dim / (n + 1);
101 out.
pk.assign(n + 1, zero);
103 for (std::size_t k = 0; k <= n; ++k) {
105 for (std::size_t j = 0; j < blk; ++j) s += phi[k * blk + j];
121 const std::vector<int>& mi,
122 const std::vector<bool>& isDelay) {
123 const std::size_t M = L.size();
124 const std::size_t n = pk.size() - 1;
128 out.
Q.assign(M, zero);
129 out.
U.assign(M, zero);
130 out.
X.assign(M, zero);
131 out.
R.assign(M, zero);
133 std::vector<std::size_t> queueIdx;
135 for (std::size_t i = 0; i < M; ++i) {
139 queueIdx.push_back(i);
143 std::vector<int> miq(queueIdx.size(), 1);
144 for (std::size_t j = 0; j < queueIdx.size(); ++j) {
145 Lq(j, 0) = L[queueIdx[j]];
146 miq[j] = mi[queueIdx[j]];
150 for (std::size_t k = 1; k <= n; ++k) {
151 if (pk[k] == zero)
continue;
152 const std::vector<int> N(1,
static_cast<int>(k));
154 const T Xk = r.
XN[0];
155 for (std::size_t j = 0; j < queueIdx.size(); ++j) {
156 out.
Q[queueIdx[j]] += pk[k] * r.
QN(j, 0);
157 out.
U[queueIdx[j]] += pk[k] * r.
UN(j, 0);
158 out.
X[queueIdx[j]] += pk[k] * Xk;
160 for (std::size_t i = 0; i < M; ++i) {
162 out.
Q[i] += pk[k] * Xk * L[i];
163 out.
U[i] += pk[k] * Xk * L[i];
164 out.
X[i] += pk[k] * Xk;
169 for (std::size_t i = 0; i < M; ++i)
170 if (out.
X[i] != zero) out.
R[i] = out.
Q[i] / out.
X[i];
Steady-state distribution of a continuous-time Markov chain.
The exception types the port throws.
Inter-departure MAP of a closed subnetwork made of one MAP station and one MAP flow-equivalent server...
Per-level processes of a load-dependent flow-equivalent server.
Dense linear algebra over the templated number type: products, identity, inverse, and powers.
Markovian arrival process descriptors: stationary vectors, rate, moments, autocorrelation and the ind...
Dense matrix and non-owning view.
FesMapDeaggregateResult< T > fes_map_deaggregate(const std::vector< T > &pk, const std::vector< T > &L, const std::vector< int > &mi, const std::vector< bool > &isDelay)
std::vector< mam::Map< T > > fes_map_levels(const mam::Map< T > &map, std::size_t n, double mi=1.0)
Replicate a load independent MAP over n levels, scaling level k by min(k, mi).
mam::Map< T > fes_map_interdeparture(const std::vector< mam::Map< T > > &maps, const std::vector< mam::Map< T > > &fes, std::size_t n)
Inter-departure MAP of a closed subnetwork made of one MAP station and one MAP flow-equivalent server...
FesMapSolveResult< T > fes_map_solve(const std::vector< mam::Map< T > > &fes, const mam::Map< T > &think_map, std::size_t n)
Closed model left by a MAP flow-equivalent server, and the per-station metrics behind it.
Matrix< T > map_infgen(const Map< T > &m)
Generator of the underlying phase process, D0 + D1.
T map_moment(const Map< T > &m, unsigned k)
Raw moment of order k of the inter-arrival time: k!
std::vector< T > ctmc_solve(const Matrix< T > &Qin)
Steady-state distribution of a continuous-time Markov chain.
MvaResult< T > pfqn_mva(const Matrix< T > &L, const std::vector< int > &N, const Matrix< T > &Z, const std::vector< int > &mi)
Exact Mean Value Analysis for closed product-form networks (Reiser and Lavenberg 1980).
std::vector< T > vecmul(const std::vector< T > &v, const Matrix< T > &A)
Row vector times matrix, v A.
Number-type abstraction for the templated API port.
Exact Mean Value Analysis for closed product-form networks (Reiser and Lavenberg 1980).
Per-station metrics an aggregate stands for.
System metrics of the delay plus flow-equivalent server model.
std::vector< T > pk
law of the jobs held by the flow-equivalent server
T R
response time of the aggregated subnetwork, N/X - E[Z]
T Q
mean jobs held by the flow-equivalent server
A MAP as the pair of matrices (D0, D1).
std::vector< T > XN
(R) per-class throughput
Matrix< T > QN
(M x R) mean queue length
Matrix< T > UN
(M x R) utilization