![]() |
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/qbd_mapmap1.h"#include "line/api/mam/qbd_r.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 |
| 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) |
| MAP/MAP/1 by the exact QBD solution. | |
| 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 reference does one further thing this port deliberately does not. Before calling BUTools it replaces the service MAP (D0,D1) by the phase-type distribution
sigma = theta D1 / (theta D1 e), S = D0, theta (D0+D1) = 0,
i.e. by the stationary marginal of a service time. 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. The two coincide exactly when the service MAP is a renewal process (D1 = (-D0 e) sigma, which includes every PH-renewal service), and diverge otherwise. This port solves the genuine MAP/MAP/1 QBD, so on a correlated service MAP it does not agree with the reference and is not meant to: see the measured numbers below.
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
meanWaitingTime is meanSojournTime minus the mean service time 1/lambda_s, and utilization is lambda_a/lambda_s, both matching the reference's own definitions.
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.