5#ifndef LINE_API_QSYS_QSYS_MMAPG1K_H
6#define LINE_API_QSYS_QSYS_MMAPG1K_H
91 std::size_t nmaxCap) {
93 "qsys_mmapg1k requires transcendental arithmetic");
95 if (D1c.empty())
throw InputError(
"qsys_mmapg1k: at least one class is required");
96 const std::size_t M = D0.
rows();
97 if (D0.
cols() != M)
throw InputError(
"qsys_mmapg1k: D0 must be square");
98 const std::size_t R = D1c.size();
102 for (std::size_t k = 0; k < R; ++k) {
103 if (D1c[k].rows() != M || D1c[k].cols() != M)
104 throw InputError(
"qsys_mmapg1k: every per-class D1 must match the order of D0");
105 for (std::size_t i = 0; i < M; ++i)
106 for (std::size_t j = 0; j < M; ++j) agg.
D1(i, j) += D1c[k](i, j);
110 const std::vector<T> e =
ones<T>(M);
116 out.
lambda.assign(R, zero);
119 for (std::size_t k = 0; k < R; ++k) {
120 const std::vector<T> col =
mulvec(D1c[k], e);
121 T lam = zero, blocked = zero;
122 for (std::size_t i = 0; i < M; ++i) {
123 lam += pit[i] * col[i];
124 blocked += r.
pKvec[i] * col[i];
127 out.
lossRatio[k] = (lam > zero) ? T(blocked / lam) : zero;
149 static_cast<std::size_t
>(200000));
The exception types the port throws.
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.
std::vector< T > map_prob(const Map< T > &m)
Stationary distribution of the phase process, pi (D0 + D1) = 0.
MapG1kResult< T > qsys_mapg1k(const mam::Map< T > &arrival, const ServiceLaw< T > &svc, std::size_t K, const T &tol, std::size_t nmaxCap)
MAP/G/1/K with tail drop.
MmapG1kResult< T > qsys_mmapg1k(const Matrix< T > &D0, const std::vector< Matrix< T > > &D1c, const ServiceLaw< T > &svc, std::size_t K, const T &tol, std::size_t nmaxCap)
MMAP[K]/G/1/K with tail drop.
std::vector< T > mulvec(const Matrix< T > &A, const std::vector< T > &v)
Matrix times column vector, A v.
std::vector< T > ones(std::size_t n)
Column vector of ones, the ubiquitous e in MAP algebra.
Number-type abstraction for the templated API port.
The MAP/G/1/K queue with tail drop: Markovian arrivals, an arbitrary service law F,...
A MAP as the pair of matrices (D0, D1).
Return value of qsys_mapg1k, mirroring the MATLAB result struct.
std::vector< T > plevel
P(level = l), l = 0..K.
T rho
offered load lambda S
std::vector< T > pKvec
P(level = K, phase j), summing to pK.
T lossProbability
1 - throughput/lambda
T meanQueueLength
E[number in system].
Return value of qsys_mmapg1k, mirroring the MATLAB result struct.
std::vector< T > lossRatio
per-class loss ratio, in [0,1]
std::vector< T > lambda
per-class arrival rate
T lossAggregate
aggregate loss ratio of the whole stream
std::vector< T > throughput
per-class throughput
Service-time descriptor, the C++ form of the MATLAB svc struct.