![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
The MAP/D/c FCFS queue: c servers, deterministic service of length s, fed by a Markovian arrival process. More...
#include <cmath>#include <cstddef>#include <vector>#include "line/api/mam/map_moment.h"#include "line/api/mam/qbd_r.h"#include "line/api/qsys/qsys_mapd1.h"#include "line/num/number.h"#include "line/util/error.h"#include "line/util/expm.h"#include "line/util/linalg.h"#include "line/util/lu.h"#include "line/util/matrix.h"Go to the source code of this file.
Classes | |
| struct | line::qsys::MapDcResult< T > |
| Return value of qsys_mapdc, mirroring the MATLAB result struct. More... | |
Namespaces | |
| namespace | line |
| namespace | line::qsys |
Functions | |
| template<class T> | |
| MapDcResult< T > | line::qsys::qsys_mapdc (const mam::Map< T > &arrival, const T &s, unsigned c, std::size_t dist_size, unsigned max_arrivals, std::size_t max_levels, const T &tol) |
| MAP/D/c by Crommelin's exact embedded lattice chain. | |
| template<class T> | |
| MapDcResult< T > | line::qsys::qsys_mapdc (const mam::Map< T > &arrival, const T &s, unsigned c) |
| qsys_mapdc with 100 materialized levels, an arrival-count cap of 4096, a super-level cap of 20000 and tolerance 1e-14, matching the qsys_mapd1 defaults. | |
The MAP/D/c FCFS queue: c servers, deterministic service of length s, fed by a Markovian arrival process.
The multiserver generalization of qsys_mapd1.
ALGORITHM, AND HOW IT DIFFERS FROM THE MATLAB REFERENCE. matlab/src/api/qsys/qsys_mapdc.m calls Q-MAM's Q_CT_MAP_D_C, which is not transcribed here. This port computes the same quantities by Crommelin's embedded lattice chain, which is exact for deterministic service and is NOT an Erlang-k or a heavy-traffic approximation.
THE LATTICE CHAIN IS EXACT, AND WHY. Sample the system at the epochs t_n = n s and let N_n be the number in system at t_n, J_n the arrival phase. Every job in service at t_n started somewhere in (t_n - s, t_n], so it departs inside (t_n, t_{n+1}]; every job that starts service inside that interval departs after t_{n+1}. Hence exactly min(N_n, c) departures occur per interval – all of them when the system is below capacity, since then no job waits – and
N_{n+1} = max(N_n - c, 0) + A_n,
with A_n the number of MAP arrivals in the interval. (N_n, J_n) is therefore a Markov chain with transition blocks A_k = P_k(s), the MAP counting probabilities over an interval of exact length s. No residual service time has to be carried, which is what makes the deterministic case tractable where a general one would not be.
The stationary law of that chain IS the time-stationary law of N. N(t) converges in distribution as t -> infinity (the system is non-lattice: the MAP has continuous interarrival times), so N(n s) converges to the same limit, and a positive recurrent Markov chain converges only to its own stationary law. No PASTA argument and no time-averaging step are involved – unlike qsys_mapd1, whose chain is embedded at DEPARTURE epochs and therefore needs the explicit inter-departure averaging of its step 4.
FOUR STEPS.
meanWaitingTime is E[N]/lambda - s by Little's law and meanSojournTime is E[N]/lambda. This is exactly the definition the MATLAB reference adopted when its one-point quadrature was replaced; see the reference-defect note below.
INVARIANTS THE TESTS ASSERT (both are identities of the construction, not fitted quantities):
ORACLES.
ARITHMETIC. Gated on num_traits<T>::has_transcendental for two independent reasons, both inherited from qsys_mapd1: step 1 calls expm, which is a tolerance-controlled Pade approximation and cannot be exact in any arithmetic, and step 3 obtains G by a fixed-point iteration that does not terminate in a finite number of field operations. Steps 2 and 4 are finite exact matrix algebra and add no error of their own.
REFERENCE DEFECTS.
Definition in file qsys_mapdc.h.