5#ifndef LINE_API_PFQN_STDF_HEUR_H
6#define LINE_API_PFQN_STDF_HEUR_H
98 const std::vector<int>& S,
99 const std::vector<std::size_t>& fcfsNodes,
const Matrix<T>& rates,
100 const std::vector<T>& tset) {
102 "pfqn_stdf_heur requires transcendental arithmetic: the level CDFs are matrix "
103 "exponentials, the inner constants come from a truncated correction series, and "
104 "the constants are combined in the log domain");
106 const std::size_t M = L.
rows();
107 const std::size_t R = L.
cols();
108 if (R != N.size())
throw InputError(
"pfqn_stdf_heur: L and N disagree on the class count");
109 if (S.size() != M)
throw InputError(
"pfqn_stdf_heur: S has the wrong length");
110 if (rates.
rows() != M || rates.
cols() != R)
111 throw InputError(
"pfqn_stdf_heur: rates has the wrong shape");
112 for (std::size_t k = 0; k < M; ++k)
113 if (S[k] < 1)
throw InputError(
"pfqn_stdf_heur: the server count must be at least one");
117 if (n < 0)
throw InputError(
"pfqn_stdf_heur: negative population");
120 if (Nt < 1)
throw InputError(
"pfqn_stdf_heur: the population must be at least one");
125 const std::size_t nt = tset.size();
127 const Matrix<T> mu = detail::stdf_mu<T>(S, Nt);
128 const std::vector<T> tv = detail::stdf_guard_tset(tset);
134 const bool singleStation = (M == 1);
136 for (std::size_t ki = 0; ki < fcfsNodes.size(); ++ki) {
137 const std::size_t k = fcfsNodes[ki];
138 if (k >= M)
throw InputError(
"pfqn_stdf_heur: FCFS station index out of range");
139 if (!(rates(k, 0) > zero))
140 throw InputError(
"pfqn_stdf_heur: the FCFS service rate must be strictly positive");
142 const Matrix<T> Lk = detail::stdf_drop_row(L, k);
143 const Matrix<T> muk = detail::stdf_drop_row(mu, k);
145 for (std::size_t r = 0; r < R; ++r) {
146 if (!(L(k, r) > fine))
continue;
147 std::vector<int> Nr = N;
150 for (
int n : Nr) sumNr += n;
160 for (std::size_t j = 0; j < ms.size(); ++j) muA(0, j) = ms[j];
163 for (std::size_t s = 0; s < R; ++s) Q1(k, s) = L(k, s) * ratio;
173 for (std::size_t s = 0; s < R; ++s) Q1sum += Q1(k, s);
174 Matrix<T> hkc(nt,
static_cast<std::size_t
>(Nt) + 1);
175 for (
int n = 0; n <= Nt; ++n) {
177 if (!(rates(k, r) > zero))
178 throw InputError(
"pfqn_stdf_heur: non-positive per-class service rate");
179 const T mean = T(one / rates(k, r));
183 std::vector<mam::Map<T>> parts;
186 for (std::size_t s = 0; s < R; ++s)
188 T(Q1(k, s) * lvl / Q1sum / rates(k, s))));
192 for (std::size_t t = 0; t < nt; ++t) hkc(t, static_cast<std::size_t>(n)) = F[t];
197 const double lGk = outer.lG;
200 for (std::size_t t = 0; t < nt; ++t) RD(t, 1) = tv[t];
203 for (std::size_t t = 0; t < nt; ++t) {
204 detail::stdf_gamma(mu, hkc, t, k, sumNr,
false, gammat, gammak);
206 for (std::size_t s = 0; s < R; ++s) {
207 if (Nr[s] <= 0)
continue;
208 std::vector<int> Nrs = Nr;
210 const double lY =
pfqn_rd(L, Nrs, Z, gammak).lGN;
211 H += L(k, s) * hkc(t, 0) / gammat(k, 0) *
214 if (!(H == H)) H = fine;
The exception types the port throws.
Cumulative distribution of the inter-arrival time of a MAP.
Dense matrix and non-owning view.
Map< T > map_exponential_mean(const T &mean)
Poisson process with the given mean inter-arrival time (map_exponential.m).
Map< T > map_sumind(const std::vector< Map< T > > &maps)
Sum of independent, not necessarily identical MAPs: after each component completes,...
std::vector< T > map_cdf(const Map< T > &m, const std::vector< T > &points)
Cumulative distribution of the inter-arrival time at the given points.
RdResult< T > pfqn_rd(const Matrix< T > &L0, const std::vector< int > &N, const Matrix< T > &Z, const Matrix< T > &mu0, double tol, NcMethod method)
Reduction heuristic (RD) for the normalizing constant of a closed LOAD-DEPENDENT product-form network...
MvaLdResult< T > pfqn_mvald(const Matrix< T > &L, const std::vector< int > &N, const Matrix< T > &Z, const Matrix< T > &mu, bool stabilize=true)
Exact MVA for a closed network of load-dependent stations.
StdfResult< T > pfqn_stdf_heur(const Matrix< T > &L, const std::vector< int > &N, const Matrix< T > &Z, const std::vector< int > &S, const std::vector< std::size_t > &fcfsNodes, const Matrix< T > &rates, const std::vector< T > &tset)
Heuristic sojourn-time distribution at the listed FCFS stations.
static const double kStdfFineTol
GlobalConstants.FineTol, as set by matlab/lineStart.m.
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_ld(const Matrix< T > &L, const std::vector< int > &N, const Matrix< T > &Z, const Matrix< T > &mu)
CoMoM for the repairman model with an arbitrary LOAD-DEPENDENT rate lattice at the single queueing st...
Number-type abstraction for the templated API port.
CoMoM for the repairman model with an arbitrary LOAD-DEPENDENT rate lattice at the single queueing st...
Aggregate load-dependent rate of m identical c-server FCFS stations.
Shift the load-dependent service-rate lattice of selected stations.
Exact Mean Value Analysis for mixed open/closed networks with multiserver stations.
Reduction heuristic (RD) for the normalizing constant of a closed LOAD-DEPENDENT product-form network...
Sojourn-time distribution at multiserver FCFS stations of a closed product-form network (J.
A MAP as the pair of matrices (D0, D1).
Result of pfqn_mvald, mirroring the seven MATLAB outputs.
double lG
log of the normalizing constant
Matrix< T > QN
(M x R) mean queue length
bool isNumStable
false once a marginal probability had to be clamped
Result of pfqn_stdf / pfqn_stdf_heur, mirroring the MATLAB cell array RD.
std::vector< std::vector< Matrix< T > > > RD
bool isNumStable
false once an aggregate solve reported instability
std::vector< T > tset
the time set after the zero guard