LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
qsys_mapmap1.h File Reference

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"
Include dependency graph for qsys_mapmap1.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 FCFS queue with the service MAP honoured, correlation included.
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.

Detailed Description

The MAP/MAP/1 FCFS queue: mean number in system, waiting time, sojourn time, utilization and the queue-length distribution.

ALGORITHM. matlab/src/api/qsys/qsys_mapmap1.m calls BUTools' MAPMAP1, which solves the level-independent QBD whose level is the number in system and whose phase is the pair (arrival phase, service phase), with the service phase frozen while the server is idle. This port solves the same QBD with its own machinery (line/api/mam/qbd_mapmap1.h) and takes the queue-length moments in closed form from pi_0 and R (qbd_qlen_moment). The sojourn-time moments come from BUTools' matrix-exponential law of the age at departure, U = L + R B, Rh = (-U)^-1 F, T = I_na (x) D0 + Rh B, eta = pi_0 F (I - Rh)^-1 / (pi_0 F (I - Rh)^-1 e), E[W^k] = k! eta (-T)^-k e.

THE SERVICE MAP IS USED AS A MAP. Until 2026-11 every codebase replaced the service MAP (D0,D1) by its stationary marginal PH, sigma = theta D1 / (theta D1 e), S = D0 (the old mapToPh), and solved MAP/PH/1 through MMAPPH1FCFS. That keeps the service-time marginal but discards the serial correlation between consecutive service times, so the function named MAP/MAP/1 answered a different queue: on the correlated case below it gave 2.0305355320573 against the true 2.5475575. A renewal service (any PH, as used by qsys_mapph1, qsys_phph1 and qsys_mapg1) is unaffected, since its MAP and its marginal PH are the same process.

MEASURED AGREEMENT (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

  1. M/M/1, qsys_mapmap1(P(2), service D0 = [-3], D1 = [3]): 2 / 2/3 / 1 / 2/3, the textbook values.
  2. Renewal service. Arrival C, service the Erlang-2 renewal MAP D0 = [-6 6; 0 -6], D1 = [0 0; 6 0]: 0.836463752964917 / 0.383635597779453 / 0.716968931112786 / 0.388888888888889, unchanged from the MAP/PH/1 route.
  3. Correlated service. Arrival C, service MAP D0 = [-5 0.4; 0.2 -1.4], D1 = diag(4.6, 1.2) (lambda_s = 7/3, rho = 1/2). meanQueueLength 2.5475575348, meanSojournTime 2.1836207441 (= QN / lambda by Little), the values of BUTools MAPMAP1 and of a truncated CTMC of the queue (3000 levels, 2.5475575). meanWaitingTime is meanSojournTime minus the mean service time 1/lambda_s, and utilization is lambda_a/lambda_s.

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.