5#ifndef LINE_API_PFQN_COMOMRM_MS_H
6#define LINE_API_PFQN_COMOMRM_MS_H
78std::vector<T> comomrm_bidiag(
const std::vector<T>& L,
const std::vector<int>& N,
79 const std::vector<T>& Z,
const std::vector<T>& mu) {
80 const std::size_t R = N.size();
82 for (
int v : N) Nt += v;
83 if (
static_cast<int>(mu.size()) < Nt)
84 throw InputError(
"comomrm_bidiag: the rate lattice is shorter than the total population");
87 std::vector<T> h(
static_cast<std::size_t
>(Nt) + 1, zero);
90 for (std::size_t r = 0; r < R; ++r) {
91 for (
int nr = 1; nr <= N[r]; ++nr) {
93 std::vector<T> hn(
static_cast<std::size_t
>(Nt) + 1, zero);
95 for (std::size_t k = 0; k <= static_cast<std::size_t>(Nt); ++k) {
97 if (k <
static_cast<std::size_t
>(Nt)) {
98 const std::size_t j =
static_cast<std::size_t
>(Nt) - k;
99 if (mu[j - 1] == zero)
100 throw NumericError(
"comomrm_bidiag: a load-dependent rate is zero");
114ComomRmResult<T> comomrm_finish(
const std::vector<T>& h,
const T& Gremaind) {
117 for (
const T& x : h) s += x;
118 ComomRmResult<T> res;
119 res.G = Gremaind * s;
121 res.prob.assign(h.size(), zero);
123 for (std::size_t k = 0; k < h.size(); ++k) res.prob[k] = h[h.size() - 1 - k] / s;
143 throw InputError(
"pfqn_comomrm_ms: the solver accepts at most a single queueing station");
144 if (m < 1)
throw InputError(
"pfqn_comomrm_ms: the replication factor must be at least one");
145 if (S < 1)
throw InputError(
"pfqn_comomrm_ms: the server count must be at least one");
149 for (
int v : san.
N) Nt += v;
163 for (
int k = 1; k <= Nt; ++k)
167 const std::size_t Rk = san.
N.size();
169 for (std::size_t r = 0; r < Rk; ++r) {
170 if (!san.
L.empty()) Lv[r] = san.
L(0, r);
171 for (std::size_t k = 0; k < san.
Z.rows(); ++k) Zv[r] += san.
Z(k, r);
173 return detail::comomrm_finish(detail::comomrm_bidiag(Lv, san.
N, Zv, mu), san.
Gremaind);
NumericError(const std::string &what)
The exception types the port throws.
Dense matrix and non-owning view.
NcSanitizeResult< T > pfqn_nc_sanitize(const std::vector< T > &lambda, const Matrix< T > &L, const std::vector< int > &N, const Matrix< T > &Z, const T &atol)
Preprocessing shared by the normalizing-constant solvers: drop the classes that cannot contribute,...
std::vector< T > pfqn_mu_ms(int N, int m, int c)
Aggregate load-dependent rate of m identical c-server FCFS stations.
ComomRmResult< T > pfqn_comomrm_ms(const Matrix< T > &L, const std::vector< int > &N, const Matrix< T > &Z, int m, int S)
CoMoM for the MULTISERVER repairman model: one queueing station with S servers (optionally replicated...
Number-type abstraction for the templated API port.
Convolution algorithm for the exact normalizing constant of a closed product-form network (Buzen 1973...
Aggregate load-dependent rate of m identical c-server FCFS stations.
Preprocessing shared by the normalizing-constant solvers: drop the classes that cannot contribute,...
std::vector< T > prob
(Nt+1) queue-length marginal, prob[k] = P(n = k)
T Gremaind
multiplicative factor removed from G
Matrix< T > Z
retained think times, rescaled and reordered
Matrix< T > L
retained demands, rescaled and reordered
double lGremaind
its logarithm, for the log-space callers
std::vector< int > N
retained populations, reordered