5#ifndef LINE_API_QSYS_QSYS_MAPMAP1_H
6#define LINE_API_QSYS_QSYS_MAPMAP1_H
102std::vector<T> mapmap1_ph_moments(
const std::vector<T>& alpha,
const Matrix<T>& A, std::size_t n) {
104 if (n == 0)
return out;
105 const std::size_t m = A.
rows();
107 for (std::size_t i = 0; i < m; ++i)
108 for (std::size_t j = 0; j < m; ++j) negA(i, j) = -A(i, j);
110 std::vector<T> v = alpha;
111 for (std::size_t k = 1; k <= n; ++k) {
114 for (std::size_t j = 0; j < m; ++j) s += v[j];
133 std::size_t dist_size, std::size_t numQLMoms,
134 std::size_t numSTMoms) {
136 "qsys_mapmap1 requires transcendental arithmetic");
137 if (dist_size == 0)
throw InputError(
"qsys_mapmap1: dist_size must be positive");
145 const T mean_service = one / mu;
149 for (std::size_t k = 1; k <= numQLMoms; ++k)
154 const std::size_t N = q.
R.rows();
155 const std::size_t na = arrival.
order();
157 for (std::size_t i = 0; i < N; ++i)
158 for (std::size_t j = 0; j < N; ++j) negU(i, j) = -q.
U(i, j);
164 for (std::size_t i = 0; i < N; ++i)
165 for (std::size_t j = 0; j < N; ++j) {
166 Tst(i, j) = K(i, j) + RhB(i, j);
167 ImRh(i, j) = (i == j ? one : zero) - Rh(i, j);
171 for (std::size_t j = 0; j < N; ++j) etaSum += eta[j];
172 for (std::size_t j = 0; j < N; ++j) eta[j] = eta[j] / etaSum;
183 for (std::size_t k = 0; k < q.
pqueue.rows(); ++k) {
185 for (std::size_t j = 0; j < q.
pqueue.cols(); ++j) s += q.
pqueue(k, j);
194 std::size_t dist_size) {
195 return qsys_mapmap1(arrival, service, dist_size,
static_cast<std::size_t
>(3),
196 static_cast<std::size_t
>(3));
202 return qsys_mapmap1(arrival, service,
static_cast<std::size_t
>(100));
Steady-state distribution of a continuous-time Markov chain.
The exception types the port throws.
Markovian arrival process descriptors: stationary vectors, rate, moments, autocorrelation and the ind...
Dense matrix and non-owning view.
Marked MAP (MMAP) algebra: per-class rates, class probabilities, superposition, normalization and sca...
The MMAP[K]/PH[K]/1 FCFS queue: per-class mean number in system and per-class queue-length distributi...
QbdMapMap1Result< T > qbd_mapmap1(const Map< T > &arrival, const Map< T > &service_in, const T &util, std::size_t max_levels)
MAP/MAP/1 queue (qbd_mapmap1.m).
T qbd_qlen_moment(const std::vector< T > &pi0, const Matrix< T > &R, unsigned m)
Raw moment of order m of the number in system, E[N^m], assembled from the factorial moments with the ...
Matrix< T > kron(const Matrix< T > &A, const Matrix< T > &B)
Kronecker product.
T map_lambda(const Map< T > &m)
Stationary arrival rate, lambda = pi D1 e.
MapMap1Result< T > qsys_mapmap1(const mam::Map< T > &arrival, const mam::Map< T > &service, std::size_t dist_size, std::size_t numQLMoms, std::size_t numSTMoms)
MAP/MAP/1 FCFS queue with the service MAP honoured, correlation included.
Conservation laws of a layered queueing network, enumerated from its structure.
T num_factorial(unsigned n)
Factorial as a value of T.
std::vector< T > vecmul(const std::vector< T > &v, const Matrix< T > &A)
Row vector times matrix, v A.
Matrix< T > inverse(const Matrix< T > &A)
Inverse by LU with one factorization and n back substitutions.
Matrix< T > matmul(const Matrix< T > &A, const Matrix< T > &B)
Matrix product A B.
Matrix< T > eye(std::size_t n)
Identity of order n.
Number-type abstraction for the templated API port.
The MAP/MAP/1 queue solved as a quasi-birth-death process.
Quasi-birth-death processes: the rate matrix R, the fundamental matrix G, the caudal characteristic,...
A MAP as the pair of matrices (D0, D1).
std::size_t order() const
Result of qbd_mapmap1, mirroring the MATLAB return list.
std::vector< T > pi0
boundary vector, normalized
Matrix< T > pqueue
level distribution, row k = pi_k
Return value of the MAP/MAP/1 family (qsys_mapmap1, qsys_mapph1, qsys_phph1), carrying the same quant...
std::vector< T > sojournTimeMoments
raw moments E[W^k], k = 1..numSTMoms
T utilization
rho = lambda_a / lambda_s
std::vector< T > queueLengthMoments
raw moments E[N^k], k = 1..numQLMoms
T meanQueueLength
E[N], number in system.
T meanSojournTime
E[W] = E[Wq] + E[S].
std::vector< T > queueLengthDist
P(N = n), n = 0, 1, ...
T meanWaitingTime
E[Wq], time in queue.