5#ifndef LINE_API_SUM_SUM_CLOSING_H
6#define LINE_API_SUM_SUM_CLOSING_H
82 const Matrix<T>& L,
const std::vector<Servers>& mi,
83 const Matrix<T>& scv,
const std::vector<long>& N,
84 const std::vector<T>& Z,
87 "sum_closing requires transcendental arithmetic: it drives sum_closed, whose "
88 "bisection stops on a tolerance");
89 const std::size_t M = L.
rows(), R = L.
cols();
90 if (lambda0.size() != R || scva.size() != R || N.size() != R || Z.size() != R)
91 throw InputError(
"sum_closing: an input disagrees with L on the class count");
92 if (mi.size() != M)
throw InputError(
"sum_closing: L and mi disagree on the station count");
93 if (scv.
rows() != M || scv.
cols() != R)
throw InputError(
"sum_closing: scv has the wrong shape");
94 if (options.Kclosed <= 0)
throw InputError(
"sum_closing: the closing population must be positive");
99 std::vector<std::size_t> open;
100 for (std::size_t r = 0; r < R; ++r)
101 if (lambda0[r] > zero) open.push_back(r);
103 throw InputError(
"sum_closing: no open class, use sum_closed for closed networks");
104 const long Ropen =
static_cast<long>(open.size());
109 for (std::size_t i = 0; i < M; ++i)
110 for (std::size_t r = 0; r < R; ++r) {
111 Laug(i, r) = L(i, r);
112 scvaug(i, r) = scv(i, r);
114 std::vector<long> Naug = N;
115 for (std::size_t r : open) {
117 scvaug(M, r) = scva[r];
118 Naug[r] = options.Kclosed;
120 std::vector<Servers> miaug = mi;
131 for (std::size_t i = 0; i < M; ++i)
132 for (std::size_t r = 0; r < R; ++r) {
133 out.
QN(i, r) = in.
QN(i, r);
134 out.
UN(i, r) = in.
UN(i, r);
135 out.
RN(i, r) = in.
RN(i, r);
137 out.
TN.assign(R, zero);
138 for (std::size_t r = 0; r < R; ++r) {
139 if (out.
XN[r] > zero) {
141 for (std::size_t i = 0; i < M; ++i) q += out.
QN(i, r);
142 out.
TN[r] = q / out.
XN[r];
The exception types the port throws.
Dense matrix and non-owning view.
SumClosedResult< T > sum_closed(const Matrix< T > &L, const std::vector< long > &N, const std::vector< T > &Z, const std::vector< Servers > &mi, const Matrix< T > &scv, const SumOptions &options=SumOptions())
Summation method (SUM) and its extension (ESUM) for closed queueing networks, including non-product-f...
SumClosingResult< T > sum_closing(const std::vector< T > &lambda0, const std::vector< T > &scva, const Matrix< T > &L, const std::vector< Servers > &mi, const Matrix< T > &scv, const std::vector< long > &N, const std::vector< T > &Z, const ClosingOptions &options=ClosingOptions())
Closing method for open and mixed non-product-form queueing networks, solved with the summation metho...
Number-type abstraction for the templated API port.
Closing controls; Kclosed is the population given to the open classes.
static Servers of(long m)
Mirrors the [XN, QN, UN, RN, it] return list of the MATLAB function.
Matrix< T > QN
(M x R) mean queue lengths
Matrix< T > UN
(M x R) utilizations, per server at queueing stations
std::size_t it
iterations of the outer loop
Matrix< T > RN
(M x R) residence times, QN/XN
std::vector< T > XN
(R) class throughputs
Mirrors the [XN, QN, UN, RN, TN, it] return list of the MATLAB function.
std::vector< T > XN
(R) class throughputs
Matrix< T > QN
(M x R) queue lengths at the original stations
Matrix< T > UN
(M x R) utilizations at the original stations
std::vector< T > TN
(R) mean response time in the original network
Matrix< T > RN
(M x R) residence times at the original stations
Convergence controls, mirroring the trailing (tol, maxiter) arguments.
Summation method (SUM) and its extension (ESUM) for closed queueing networks, including non-product-f...