5#ifndef LINE_SOLVERS_FLUID_FLUID_MFQ_H
6#define LINE_SOLVERS_FLUID_FLUID_MFQ_H
69 const std::size_t M =
sn.nstations, K =
sn.nclasses;
70 std::size_t nsrc = 0, nq = 0, nsink = 0;
71 for (std::size_t i = 0; i < M; ++i) {
72 switch (
sn.stations[i].nodetype) {
73 case qn::NodeType::Source: ++nsrc; t.
source = i;
break;
74 case qn::NodeType::Sink: ++nsink;
break;
75 case qn::NodeType::Queue: ++nq; t.
queue = i;
break;
82 if (nsrc != 1 || nq != 1)
return t;
85 for (std::size_t r = 0; r < K; ++r) {
86 if (std::isfinite(
sn.classes[r].population))
return t;
106 const std::size_t n = d.
D0.rows();
109 for (std::size_t a = 0; a < n; ++a) {
111 for (std::size_t b = 0; b < n; ++b) {
127 const std::size_t n =
me.A.rows();
128 if (n == 0)
return 0.0;
129 std::vector<double> e(n, 1.0);
132 const std::vector<std::size_t> piv =
lu_factor(A);
133 std::vector<double> y = e;
136 for (std::size_t i = 0; i < n && i <
me.alpha.size(); ++i) s +=
me.alpha[i] * y[i];
147 "fluid mfq: the method solves a single Markov-modulated fluid queue and needs a model "
148 "of exactly one open class flowing Source -> Queue -> Sink");
153 const std::size_t na = arr.
D0.rows(), ns = svc.
D0.rows();
158 for (std::size_t a = 0; a < na; ++a)
159 for (std::size_t b = 0; b < na; ++b) {
163 for (std::size_t a = 0; a < ns; ++a)
164 for (std::size_t b = 0; b < ns; ++b) {
175 detail::mfq_dist2butools(arr, Qin, Rin);
176 detail::mfq_dist2butools(svc, Qout, Rout);
179 const bool simple_exp = (na == 1 && ns == 1);
181 const double rho = lambda / mu;
184 out.
QN = std::numeric_limits<double>::infinity();
185 out.
RN = std::numeric_limits<double>::infinity();
189 out.
QN = rho / (1.0 - rho);
190 out.
RN = 1.0 / (mu - lambda);
207 std::max(tol, 1e-14));
208 out.
RN = detail::mfq_me_mean(
me);
209 out.
QN = lambda * out.
RN;
UnsupportedError(const std::string &what)
A network plus its refreshed NetworkStruct.
The exception types the port throws.
LU factorization with partial pivoting, templated on the number type.
Markovian arrival process descriptors: stationary vectors, rate, moments, autocorrelation and the ind...
Dense matrix and non-owning view.
Sojourn-time distribution of a fluid queue whose SERVICE is itself a Markov-modulated fluid flow,...
MfqTopology mfq_is_single_queue(const qn::NetworkStruct< T > &sn)
Port of fluid_is_single_queue.m: the model must be one open class flowing Source -> Queue -> Sink and...
MfqResult fluid_mfq(const qn::NetworkStruct< T > &sn, const MfqTopology &top, double tol)
Solve the single fluid queue of sn.
MeRepresentation< T > mfq_fluflu_sojourn(const Matrix< T > &Qin, const Matrix< T > &Rin, const Matrix< T > &Qout, const Matrix< T > &Rout, bool srv0stop, bool transToPH, const T &prec)
Sojourn time of a drop in a fluid queue with fluid-modulated service.
T map_mean(const Map< T > &m)
Mean inter-arrival time, 1/lambda.
void lu_solve(const Matrix< T > &LU, const std::vector< std::size_t > &piv, std::vector< T > &b)
Solve LUx = Pb in place on b, using the factors from lu_factor.
std::vector< std::size_t > lu_factor(Matrix< T > &A)
In-place LU of A (n x n).
A queueing network and its refreshed NetworkStruct.
The metrics mfq reports for its single queue.
What the single-queue gate found, when it matches.
std::size_t cls
the first open class, which mfq analyzes
std::vector< std::size_t > open_classes
every open class, in class order
std::size_t source
0-based station index
Matrix< T > D0
The (D0,D1) pair when the type carries one directly.
A MAP as the pair of matrices (D0, D1).
A matrix-exponential or phase-type representation (alpha, A).