![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
The MAP/MAP/1 FCFS queue: mean number in system, waiting time, sojourn time, utilization and the queue-length distribution. More...
#include <cstddef>#include <vector>#include "line/api/mam/map_moment.h"#include "line/api/mam/mmap_lambda.h"#include "line/api/mam/mmapph1fcfs.h"#include "line/api/mam/qbd_mapmap1.h"#include "line/api/mam/qbd_r.h"#include "line/api/mc/ctmc_solve.h"#include "line/num/number.h"#include "line/util/error.h"#include "line/util/matrix.h"Go to the source code of this file.
Classes | |
| struct | line::qsys::MapMap1Result< T > |
| Return value of the MAP/MAP/1 family (qsys_mapmap1, qsys_mapph1, qsys_phph1), carrying the same quantities as the MATLAB result struct. More... | |
Namespaces | |
| namespace | line |
| Conservation laws of a layered queueing network, enumerated from its structure. | |
| namespace | line::qsys |
Functions | |
| template<class T> | |
| MapMap1Result< T > | line::qsys::qsys_mapmap1 (const mam::Map< T > &arrival, const mam::Map< T > &service, std::size_t dist_size, std::size_t numQLMoms, std::size_t numSTMoms) |
| MAP/MAP/1 as the reference solves it: the service MAP collapsed to its PH marginal (mapToPh), then the MAP/PH/1 queue by the exact QBD solution. | |
| template<class T> | |
| MapMap1Result< T > | line::qsys::qsys_mapmap1 (const mam::Map< T > &arrival, const mam::Map< T > &service, std::size_t dist_size) |
| qsys_mapmap1 with the reference's defaults numQLMoms = 3, numSTMoms = 3. | |
| template<class T> | |
| MapMap1Result< T > | line::qsys::qsys_mapmap1 (const mam::Map< T > &arrival, const mam::Map< T > &service) |
| qsys_mapmap1 with 100 materialized levels, the reference's numQLProbs. | |
The MAP/MAP/1 FCFS queue: mean number in system, waiting time, sojourn time, utilization and the queue-length distribution.
ALGORITHM, AND HOW IT DIFFERS FROM THE MATLAB REFERENCE. matlab/src/api/qsys/qsys_mapmap1.m obtains these quantities by calling BUTools' MMAPPH1FCFS, which is not transcribed here; this port computes the SAME quantities from the port's own quasi-birth-death machinery (line/api/mam/qbd_mapmap1.h), which solves the level-independent QBD whose level is the number in system and whose phase is the pair (arrival phase, service phase). The algorithm is therefore different, the quantity is the same.
THE SERVICE MAP IS COLLAPSED TO A PHASE-TYPE LAW, as the reference does. Before calling BUTools, qsys_mapmap1.m replaces the service MAP (D0,D1) by sigma = theta D1 / (theta D1 e), S = D0, theta (D0+D1) = 0, i.e. by the stationary marginal of a service time (its mapToPh). That embedded PH keeps the service-time MARGINAL exactly but DISCARDS the serial correlation between consecutive service times, so the reference solves a MAP/PH/1 queue in place of the MAP/MAP/1 queue it names. This port follows the reference: the service MAP is collapsed the same way and the resulting MAP/PH/1 queue is solved as a QBD, so the two agree also on a correlated service MAP (case 3 below). A caller who wants the genuine MAP/MAP/1 answer, with the service correlation honoured, has it in line::mam::qbd_mapmap1 (line/api/mam/qbd_mapmap1.h).
The higher moments the reference obtains from MMAPPH1FCFS are returned too: queueLengthMoments (numQLMoms raw moments of the number in system, from pi_0 and R in closed form, qbd_qlen_moment) and sojournTimeMoments (numSTMoms raw moments, from the phase-type sojourn-time law of mmapph1fcfs_stdistr_ph, the same age-process construction BUTools uses).
MEASURED AGREEMENT (MATLAB R2025a, T = double). Metric order is meanQueueLength / meanWaitingTime / meanSojournTime / utilization. Arrival MAPs used below: P(2) = Poisson, D0 = [-2], D1 = [2] C = correlated MMPP2, D0 = [-2.5 0.2; 0.1 -0.7], D1 = diag(2.3, 0.6), lambda = 7/6
ARITHMETIC. The function is gated on num_traits<T>::has_transcendental because qbd_mapmap1 reaches R by cyclic reduction, a fixed-point iteration driven to a tolerance that does not terminate in a finite number of field operations; running it at exact rational arithmetic would produce a rational with a denominator doubling every step and still not the exact R. See qbd_r.h. Everything downstream of R here – the mean, the level probabilities, the Little's-law conversions – is finite exact matrix algebra and carries no additional error.
Definition in file qsys_mapmap1.h.