api.qsys

qsys_mm1k_transient(lambda, mu, K, n0, t, varargin)

[P, EN, P0, RES] = QSYS_MM1K_TRANSIENT(LAMBDA, MU, K, N0, T, ‘tol’, TOL, ‘method’, M)

Transient queue-length distribution of the M/M/1/K queue (K counts the job in service) started with N0 jobs: P(r, j+1) = P(N(T(r)) = j | N(0) = N0), j = 0..K, the mean EN(r) = E[N(T(r))] and the empty probability P0(r) = P(N(T(r)) = 0), for any load rho = LAMBDA/MU. P(:, K+1) is the time-t blocking probability seen by a Poisson arrival; as T grows it tends to the stationary loss probability of qsys_mm1k_loss (RES.pi is the stationary law).

Methods (‘method’, default ‘auto’):
‘spectral’ the eigen-expansion of Takacs, as given in Rubino 2020 eqs.
(3.5)-(3.6), here for any N0 = i:
P_ij(t) = pi_j + 2/(K+1) rho^{(j-i)/2} sum_{h=1}^{K}

e^{g_h t} w_h(i) w_h(j)/(1 + rho - 2 sqrt(rho) cos th_h),

th_h = h pi/(K+1), g_h = -(lambda+mu) + 2 sqrt(lambda mu) cos th_h, w_h(j) = sqrt(rho) sin((j+1) th_h) - sin(j th_h),

valid for rho = 1 as well. The rho^{(j-i)/2} prefactors make it ill-conditioned when rho^{K/2} is far from 1: RES.kappa bounds the amplification and the absolute error is about kappa*eps.

‘uniformization’ Jensen’s method on the K+1 states at rate LAMBDA+MU

(Rubino 2020 Sec. 2.2; Rubino-Krinik 2021 Sec. 2) with a rigorously bounded Poisson window: absolute error <= RES.errBound (<= TOL) on every probability, cost O(K (LAMBDA+MU) T).

‘auto’ ‘spectral’ when kappa*eps <= TOL, else ‘uniformization’.

RES fields: rho, method, kappa, errBound (per time), pi, tol.

References: G. Rubino, “Transient analysis of Markovian queueing systems: a survey with focus on closed-forms and uniformization”, Advanced Trends in Queueing Theory 2, ISTE/Wiley, 2020; L. Takacs, Introduction to the Theory of Queues, Oxford University Press, 1962.

Python twin: line_solver.api.qsys.qsys_mm1k_transient.

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_mg11_retrial(lambda, mu, cs, nu, policy)

[N, NORB, R, U, RES] = QSYS_MG11_RETRIAL(LAMBDA, MU, CS, NU, POLICY)

Exact mean performance of the M/G/1/1 retrial queue: Poisson arrivals of rate LAMBDA, one server with a general service time of rate MU (mean 1/MU) and squared coefficient of variation CS^2, no waiting room, and blocked customers that join an orbit and retry after exponential delays.

POLICY = RetrialPolicy.LINEAR (default, classical): each orbiting customer retries at rate NU, so the orbit retries at rate n*NU. Falin and Templeton (1997, Sec. 1.3):

E[Norb] = lambda^2*b2/(2*(1-rho)) + lambda*rho/(NU*(1-rho)), rho < 1.

POLICY = RetrialPolicy.CONSTANT: the orbit retries at rate NU whatever its size. A departure leaves the server idle and the next customer to take it is an orbiting one with probability a = NU/(lambda+NU), so the number in system at departures follows X’ = X - 1{X>0}*Bernoulli(a) + A, with A the Poisson(lambda*S) arrivals during a service. Its first two moments give

E[N] = (rho*(1-rho) + lambda^2*b2/2) / (a - rho), rho < a,

and, since N moves by +-1 and arrivals are Poisson, the departure-epoch mean is the time-average mean. Stability rho < a is Fayolle’s condition for c = 1 (see qsys_retrial_isstable).

OUTPUT:

N : mean number in system (orbit plus server) Norb : mean number in orbit R : mean response time, N/LAMBDA (Little) U : server utilization, rho = LAMBDA/MU res : struct with the fields above plus probIdle, probBlock (an

arriving customer finds the server busy, rho by PASTA), meanOrbitTime (Norb/LAMBDA), meanRetrials (expected number of failed retrials per customer, LINEAR only), probEmpty (P(N=0), CONSTANT only) and policy

References

G. I. Falin and J. G. C. Templeton, Retrial Queues, Chapman & Hall, 1997. T. Phung-Duc, Retrial queueing models: a survey on theory and applications, arXiv:1906.09560, 2019, Sec. 3.1.

qsys_gimc(LA, mu, c, varargin)

QSYS_GIMC Exact analysis of the GI/M/c queue.

RESULT = QSYS_GIMC(ADIST, MU, C) analyzes renewal arrivals with interarrival Distribution ADIST (its evalLST and getMean are used), C exponential servers of rate MU each and FCFS order.

RESULT = QSYS_GIMC(LST, MU, C, ‘lambda’, LAMBDA) gives the interarrival law as a function handle LST(s) = E[exp(-s A)] and the arrival rate LAMBDA = 1/E[A].

Let A = LAMBDA/MU < C, omega in (0,1) the root of omega = LST(C MU (1-omega)), g_j = LST(j MU), C_0 = 1, C_j = prod_{i<=j} g_i/(1-g_i), and

D = [1/(1-omega) + sum_{j=1}^{C} binom(C,j) (C(1-g_j)-j)/(C_j (1-g_j)(C(1-omega)-j))]^-1, U_n = D C_n sum_{j=n+1}^{C} binom(C,j) (C(1-g_j)-j)/(C_j (1-g_j)(C(1-omega)-j)).

The number found by an arrival has Pi_n = D omega^(n-C), n >= C-1, and Pi_n = sum_{i=n}^{C-1} (-1)^(i-n) binom(i,n) U_i, n <= C-2. Then

P(W > t) = D/(1-omega) exp(-C MU (1-omega) t), E[W] = D/(C MU (1-omega)^2),

T = W + S with S ~ Exp(MU), and the time-stationary law is

P_n = A Pi_{n-1}/min(n,C) (n >= 1), P_0 = 1 - sum_{n>=1} P_n.

For C = 1 this is the GI/M/1 queue (D = 1 - omega).

Options:

‘lambda’, LAMBDA - arrival rate (required with an LST handle) ‘tPoints’, T - return waiting and sojourn time CDFs at T ‘percentiles’, R - return percentiles of W and T (R in percent) ‘nmax’, NMAX - length of queueLengthDist and arrivalDist

(default: until the geometric tail is below 1e-14)

Returns a struct with fields:

meanQueueLength, varQueueLength, meanQueueLengthQ, varQueueLengthQ, meanWaitingTime, varWaitingTime, meanSojournTime, varSojournTime, probWait, condMeanWaitingTime, throughput, utilization (A/C), omega, queueLengthDist ([P_0..]), arrivalDist ([Pi_0..]), tPoints/waitingTimeCdf/sojournTimeCdf, percentiles/waitingTimePercentile/ sojournTimePercentile, analyzer

The alternating sums for Pi_n, n <= C-2, lose accuracy for large C; the result is checked against sum Pi_n = 1 and a numerical error is raised when the check fails.

References

J. Sztrik, Basic Queueing Theory, Univ. of Debrecen, 2021, Table 21. L. Takacs, Introduction to the Theory of Queues, Oxford Univ. Press, 1962.

See also QSYS_GM1, QSYS_PHMC, QSYS_MMK

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_mg1_conservation(lambda, mu, cs, W)

QSYS_MG1_CONSERVATION Kleinrock conservation law of the multiclass M/G/1 queue.

V = QSYS_MG1_CONSERVATION(LAMBDA, MU, CS) returns the invariant

V = sum_i rho_i E[W_i] = rho LAMBDA E[S^2] / (2 (1 - rho)),

which holds for every work-conserving non-preemptive discipline that does not use the service times (and for shortest processing time first), with rho_i = LAMBDA_i/MU_i, rho = sum rho_i, LAMBDA E[S^2] = sum_i LAMBDA_i (1+CS_i^2)/MU_i^2.

[V, RES] = QSYS_MG1_CONSERVATION(LAMBDA, MU, CS, W) also checks the per-class mean waiting times W of a candidate discipline: RES.residual is sum_i rho_i W_i - V. RES.fcfsWaitingTime is the common FCFS mean wait V/rho. A missing W gives RES.residual = NaN.

Reference: I. Adan and J. Resing, Queueing Systems, TU Eindhoven, 2015, Sec. 9.4; L. Kleinrock, Queueing Systems, Vol. II, Wiley, 1976, Sec. 3.4.

See also QSYS_MG1_PRIO, QSYS_MG1_SJF

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_mg1_prio_pr(lambda, mu, cs, varargin)

QSYS_MG1_PRIO_PR Exact analysis of the M/G/1 queue with preemptive-resume priorities.

[W, RHO] = QSYS_MG1_PRIO_PR(LAMBDA, MU, CS) returns the per-class mean response times of an M/G/1 queue where class 1 has the highest priority and a job in service is preempted by any arrival of a higher class, resuming later where it stopped. With rho_i = LAMBDA_i/MU_i, sigma_i = sum_{j<=i} rho_j, sigma_0 = 0 and E[S_i^2] = (1 + CS_i^2)/MU_i^2,

E[T_i] = E[S_i]/(1 - sigma_{i-1}) + sum_{j<=i} LAMBDA_j E[S_j^2] / (2 (1 - sigma_{i-1})(1 - sigma_i)).

[W, RHO, RES] = QSYS_MG1_PRIO_PR(…, ‘ES3’, ES3) also returns the per-class response-time variance, which needs the third raw service moments ES3.

Outputs:

W - per-class mean response times (column) RHO - Q/(1+Q) with Q = sum(LAMBDA.*W), as in QSYS_MG1_PRIO RES - struct with meanSojournTime, meanWaitingTime (E[T_i] - E[S_i]),

meanQueueLength (per class, Little), utilization (sum rho_i), varSojournTime (with ‘ES3’), analyzer

References

J. Sztrik, Basic Queueing Theory, Univ. of Debrecen, 2021, Table 24. I. Adan and J. Resing, Queueing Systems, TU Eindhoven, 2015, Sec. 9.2.

See also QSYS_MG1_PRIO, QSYS_MMC_PRIO

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_mmcc(lambda, mu, c)

QSYS_MMCC Exact analysis of the Erlang loss system M/M/c/c (and M/G/c/c).

RESULT = QSYS_MMCC(LAMBDA, MU, C) analyzes C servers with no waiting room, Poisson arrivals of rate LAMBDA and mean service time 1/MU. With offered traffic A = LAMBDA/MU,

P_n = (A^n/n!) / sum_{k=0}^{C} A^k/k!, n = 0..C,

and the blocking probability is the Erlang B formula B(C,A) = P_C, computed with the stable recursion B(0,A) = 1, B(c,A) = A B(c-1,A)/(c + A B(c-1,A)). All results are insensitive to the service-time distribution beyond its mean, except that the sojourn time equals the service time.

Returns a struct with fields:

blockingProb - Erlang B, B(C,A) throughput - carried rate LAMBDA (1 - B) lostRate - LAMBDA B offeredTraffic - A carriedTraffic - A (1 - B) = mean number of busy servers overflowTraffic - A B meanQueueLength - mean number in system, A (1 - B) varQueueLength - Var(N) utilization - per-server utilization, A (1 - B)/C meanSojournTime - 1/MU queueLengthDist - [P_0 … P_C] analyzer - identifier string

Example

r = qsys_mmcc(8, 1, 10);

References

A. K. Erlang, Solution of some problems in the theory of probabilities of significance in automatic telephone exchanges, 1917. I. Adan and J. Resing, Queueing Systems, TU Eindhoven, 2015, Secs. 11.2-11.3.

See also QSYS_ENGSET, QSYS_MMCK, LOSSN_ERLANGFP

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_mg1kk(alpha, K, svc, ES)

QSYS_MG1KK Exact analysis of the finite-source M/G/1/K/K (machine repair) queue.

RESULT = QSYS_MG1KK(ALPHA, K, SVC) analyzes K sources, each operating for an exponential time of rate ALPHA before requesting service, and one FCFS server with a general service time S given by the Distribution SVC (its evalLST and getMean are used).

RESULT = QSYS_MG1KK(ALPHA, K, LST, ES) gives the service law as a function handle LST(s) = E[exp(-s S)] and its mean ES.

Utilization (Takacs 1962): with B_0 = 1, B_n = prod_{i=1}^{n} (1 - LST(i ALPHA))/LST(i ALPHA),

P_0 = [1 + K ALPHA ES sum_{n=0}^{K-1} binom(K-1,n) B_n]^-1,

throughput X = (1 - P_0)/ES, and the cycle relations give E[T] = K/X - 1/ALPHA, E[N] = X E[T], E[W] = E[T] - ES, E[Q] = X E[W].

The number at the facility left behind by a departure is the Markov chain embedded at departure epochs: during a service started with j >= 1 at the facility, each of the K-j operating sources requests service with probability 1 - exp(-ALPHA S), so the number of arrivals has law

a_n(i) = binom(n,i) sum_{l=0}^{i} (-1)^l binom(i,l) LST(ALPHA (n-i+l)).

Its stationary law equals the arrival-epoch law Pi_n (n = 0..K-1), and the time-stationary law follows from the arrival rate (K-n) ALPHA P_n in state n:

P_n = X Pi_n / ((K-n) ALPHA), n < K, P_K = 1 - sum_{n<K} P_n.

The alternating sum loses accuracy as K grows and at light load; the distribution is checked against the Takacs P_0 and, if they part, a warning is issued and queueLengthDist, arrivalDist and varQueueLength are NaN. The means come from the Takacs sum of positive terms and are returned regardless.

Returns a struct with fields:

meanQueueLength, varQueueLength, meanQueueLengthQ, meanWaitingTime, meanSojournTime, throughput, utilization (= 1 - P_0), meanOperating, queueLengthDist ([P_0..P_K]), arrivalDist ([Pi_0..Pi_{K-1}]), analyzer

Example

r = qsys_mg1kk(0.1, 5, Erlang.fitMeanAndOrder(1, 2));

References

L. Takacs, Introduction to the Theory of Queues, Oxford Univ. Press, 1962. J. Sztrik, Basic Queueing Theory, Univ. of Debrecen, 2021, Sec. 3.7 (Table 11).

See also QSYS_MMCKK, QSYS_MG1, QSYS_DDCKK

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_mg1_exceptional(lambda, mu, cs, muf, csf)

QSYS_MG1_EXCEPTIONAL Exact mean analysis of the M/G/1 queue with an exceptional first customer.

[W, WQ, U, Q, RES] = QSYS_MG1_EXCEPTIONAL(LAMBDA, MU, CS, MUF, CSF)

FCFS single server with Poisson arrivals (rate LAMBDA). The customer that starts a busy period has service B_f with rate MUF and coefficient of variation CSF; every other customer has service B with rate MU and coefficient of variation CS. With E[R] = E[B^2]/(2E[B]) and E[R_f] = E[B_f^2]/(2E[B_f]), the fraction of customers that find the system empty is x = (1 - LAMBDA E[B]) / (1 + LAMBDA E[B_f] - LAMBDA E[B]), rho_f = LAMBDA x E[B_f], rho = LAMBDA (1-x) E[B], and

Wq = (rho_f E[R_f] + rho E[R]) / (1 - LAMBDA E[B]), W = Wq + x E[B_f] + (1-x) E[B].

Stability requires LAMBDA E[B] < 1. Setup times U are the special case B_f = U + B.

Outputs:

W - mean response time Wq - mean waiting time U - fraction of time the server is busy, rho_f + rho Q - mean number in system, LAMBDA*W RES - struct with probEmpty (x), rhoFirst (rho_f), rhoOther (rho),

meanQueueLengthQ, analyzer

Reference: I. Adan and J. Resing, Queueing Systems, TU Eindhoven, 2015, Sec. 10.3.

See also QSYS_MG1, QSYS_MG1_SETUP

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_mxg1(lambda_batch, mu, cs, E_X, E_X2_or_Var_X, varargin)

QSYS_MXG1 - M^X/G/1 FCFS queue with batch Poisson arrivals

[W, Wq, U, Q] = QSYS_MXG1(LAMBDA_BATCH, MU, CS, E_X, E_X2) [W, Wq, U, Q] = QSYS_MXG1(LAMBDA_BATCH, MU, CS, BATCH_SIZES, PMF) [W, Wq, U, Q] = QSYS_MXG1(LAMBDA_BATCH, MU, CS, E_X, VAR_X, ‘variance’)

Exact mean-value solution of the FCFS single-server queue fed by a Poisson stream of batches (rate LAMBDA_BATCH) whose jobs have i.i.d. general service times with rate MU and coefficient of variation CS (as in QSYS_MG1). Jobs of the same batch are served in random order, so the waiting time of an ARBITRARY job includes the service of the batch mates queued ahead of it.

Batch-size input forms (same as QSYS_MXM1):
  1. Moments: E_X (mean batch size), E_X2 (second raw moment)

  2. Pmf: BATCH_SIZES (vector of sizes), PMF (weights, renormalised)

  3. Variance: E_X, VAR_X and the trailing flag ‘variance’

Outputs:

W - mean response time of an arbitrary job (Wq + 1/MU) Wq - mean waiting time of an arbitrary job U - server utilization, rho = LAMBDA_BATCH*E[X]/MU Q - mean number of jobs in the system (Little’s law)

With E[S] = 1/MU and E[S^2] = (1+CS^2)/MU^2 (Haverkort 1998, eq. 5.31):

Wq = lambda E[X] E[S^2] / (2(1-rho)) + E[X(X-1)] E[S] / (2 E[X] (1-rho))

CS = 1 gives QSYS_MXM1 and a batch size of 1 gives QSYS_MG1.

Reference: B. R. Haverkort, Performance of Computer Communication Systems: A Model-Based Approach, Wiley, 1998, Section 5.4.

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_phm1(alpha, T, mu)

QSYS_PHM1 Exact PH/M/1 (GI/M/1 with phase-type inter-arrivals).

RESULT = QSYS_PHM1(ALPHA, T, MU) solves the GI/M/1 sigma-root

sigma = psi_A(mu*(1 - sigma)), psi_A(s) = ALPHA*(s*I - T)(-T*1)

and returns time-average performance metrics.

Inputs:

ALPHA - PH entry probability row vector (1 x k) T - PH sub-generator (k x k) MU - Exponential service rate (positive scalar)

RESULT struct fields:

meanQueueLength - L = rho/(1 - sigma) meanWaitingQueue - Lq = rho*sigma/(1 - sigma) meanWaitingTime - Wq = Lq/lambda meanSojournTime - W = Wq + 1/MU utilization - rho = lambda/MU sigma - GI/M/1 root in (0, 1) analyzer - identifier string

See also qsys_gm1(), qsys_dmc()

qsys_mxm1(lambda_batch, mu, E_X, E_X2_or_Var_X, varargin)

QSYS_MXM1 - MX/M/1 queue with batch arrivals

[W, Wq, U, Q] = QSYS_MXM1(LAMBDA_BATCH, MU, E_X, E_X2) [W, Wq, U, Q] = QSYS_MXM1(LAMBDA_BATCH, MU, BATCH_SIZES, PMF)

Analytical solution for MX/M/1 queueing system with batch Markovian arrivals and exponential service.

Input formats:
  1. Moment-based: qsys_mxm1(lambda_batch, mu, E_X, E_X2) - lambda_batch: Batch arrival rate - mu: Service rate - E_X: Mean batch size - E_X2: Second moment of batch size

  2. PMF-based: qsys_mxm1(lambda_batch, mu, batch_sizes, pmf) - lambda_batch: Batch arrival rate - mu: Service rate - batch_sizes: Array of batch sizes (e.g., [1, 2, 4, 8]) - pmf: Probability mass function for batch sizes

  3. Variance-based: qsys_mxm1(lambda_batch, mu, E_X, Var_X, ‘variance’) - lambda_batch: Batch arrival rate - mu: Service rate - E_X: Mean batch size - Var_X: Variance of batch size - ‘variance’: Flag to indicate variance mode

Outputs:

W - Mean time in system Wq - Mean waiting time in queue U - Server utilization Q - Mean queue length (including service)

The formula accounts for both queueing delay and internal batch delay:
Wq = rho/(mu*(1-rho)) + (E[X²] - E[X])/(2*mu*E[X]*(1-rho))

^M/M/1 term ^Internal batch delay

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_mtgs0_mol(lambdaFun, serviceCcdf, ES, s, tvals, varargin)

QSYS_MTGS0_MOL Modified-offered-load approximation for a time-varying system.

RESULT = QSYS_MTGS0_MOL(LAMBDAFUN, SERVICECCDF, ES, S, TVALS) approximates the blocking probability of the Mt/G/S/0 loss system at the times TVALS, with arrival rate LAMBDAFUN, service ccdf SERVICECCDF of mean ES.

THE ONE IDEA. A stationary loss system with offered load a blocks with probability B(s,a). In a time-varying system the question is WHICH LOAD to put in that formula. The pointwise stationary approximation (PSA) uses the instantaneous one, lambda(t)ES. The modified offered load (MOL) uses the offered load of the corresponding INFINITE-SERVER system,

m(t) = ES E[lambda(t - Se)] = int_0^Inf lambda(t-x)P(S>x)dx,

which is EXACT for that system and therefore carries the time lag and the smoothing the finite-server system also has. MOL is then B(s,m(t)). The difference between the two is precisely the lag: PSA peaks when the arrival rate peaks, MOL peaks later, and the real system peaks later too.

WHAT TO EXPECT. Measured against the exact time-varying birth-death chain on a sinusoidal rate, MOL cuts the mean RELATIVE error roughly threefold (0.13 against 0.44 at s = 100) because it gets the phase right. It does not always win on ABSOLUTE error, which is dominated by the peak of the cycle where both are weakest. Under constant input MOL is exact.

Options: ‘delay’ (use Erlang C, i.e. the delay probability of an Mt/M/s queue rather than the blocking probability of a loss system), plus every option of QSYS_MTGINF, which computes the offered load.

Returns a struct with fields times, offeredLoad, instantLoad, probBlockMOL, probBlockPSA, meanBusyMOL and arrivalRate.

Reference: W. A. Massey, W. Whitt (1994). An analysis of the modified offered load approximation for the nonstationary Erlang loss model. Annals of Applied Probability 4(4), 1145-1160; W. Whitt (1991). The pointwise stationary approximation for Mt/Mt/s queues is asymptotically correct as the rates increase. Management Science 37(3), 307-314.

See also QSYS_MTGINF, QSYS_MMK_QED, LOSSN_ERLANGFP.

qsys_tandem_lindley(A, S, W0)

QSYS_TANDEM_LINDLEY Tandem network Lindley recursion on a sample path.

RESULT = QSYS_TANDEM_LINDLEY(A, S) propagates the waiting times of a series of K single-server FCFS stations in tandem, driven by the primitives of the sample path. A is the length-N vector of interarrival times at the first station, A(n) separating customers n and n+1, and S is the N-by-K matrix of service times, S(n,k) being the service time of customer n at station k. All waiting times start from zero.

RESULT = QSYS_TANDEM_LINDLEY(A, S, W0) starts customer 1 from the given length-K vector of waiting times instead of from an empty network.

At the first station this is Lindley’s recursion,

W(n+1,1) = max(W(n,1) + S(n,1) - A(n), 0).

Downstream the interarrival time is not a primitive: the arrival epoch of customer n at station k is its departure epoch from station k-1, so the interarrival time at station k is the interdeparture time upstream. Writing G(n,k) for the interarrival time at station k between customers n and n+1, with G(n,1) = A(n), the exact interdeparture identity is

G(n,k+1) = G(n,k) + W(n+1,k) - W(n,k) + S(n+1,k) - S(n,k),

equivalently and more transparently

G(n,k+1) = max(G(n,k) - W(n,k) - S(n,k), 0) + S(n+1,k),

an idle period at station k followed by the next customer’s service there. The recursion at station k is then

W(n+1,k) = max(W(n,k) + S(n,k) - G(n,k), 0).

Nothing here is distributional, so the recursion is exact for arbitrary interarrival and service times, dependent or not, and is the reference a simulated tandem sample path can be checked against directly. It reproduces a direct event-driven tandem simulation to 1e-12 over four stations.

Note that proposition 1 of the reference states this identity without the S(n+1,k) - S(n,k) term, which makes it wrong as a sample-path identity: the omitted difference has mean zero, so the mean interdeparture time survives, but individual waiting times do not. Implementing it as published gives station-1 waiting times that are correct and downstream ones that are not, by up to several mean service times. The form above is used instead.

Returns a struct with fields:

W - N-by-K waiting times, W(n,k) for customer n at station k G - N-by-K interarrival times, G(n,k) between customers n and n+1 at

station k, so G(:,1) is A; the last row is NaN, there being no customer N+1 to separate from

T - N-by-K sojourn times, W + S departure- N-by-K departure epochs of each customer from each station analyzer - Identifier string

Examples

A = exprnd(1/0.8, 1000, 1); S = exprnd(1, 1000, 2); r = qsys_tandem_lindley(A, S); mean(r.W(:,1)) % upstream mean wait mean(r.W(:,2)) % downstream mean wait

Reference: S. Palomo, J. Pender, “Learning the Tandem Network Lindley Recursion”, Proc. Winter Simulation Conference, 2021, equations 2 and 3 and proposition 1, the last corrected as described above; D. V. Lindley, “The Theory of Queues with a Single Server”, Proc. Camb. Phil. Soc. 48, 1952.

See also QSYS_MM1_TANDEM_LINDLEY, QSYS_MM1_LINDLEY, QSYS_HH1_LINDLEY

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_mm1_tandem_lindley(lambda, mu1, mu2, Wk, Wk1)

QSYS_MM1_TANDEM_LINDLEY Conditional downstream waiting time in an M/M/1 tandem.

RESULT = QSYS_MM1_TANDEM_LINDLEY(LAMBDA, MU1, MU2, WK, WK1) returns the conditional mean waiting time of customer n+1 at the downstream station of a two-station single-server tandem queue, given that customer n waited WK at the upstream station and WK1 at the downstream one. LAMBDA is the external arrival rate at the upstream station, MU1 and MU2 the two service rates. WK and WK1 are scalars or arrays of the same size.

The point of the tandem recursion is that the interarrival time at the downstream station is the interdeparture time upstream, not an independent draw. With A ~ Exp(LAMBDA) the interarrival time upstream and S1, S1’ the service times upstream of customers n and n+1, that interdeparture time is

D = max(A - WK - S1, 0) + S1’,

an idle period followed by the next service, and the downstream Lindley step is W2_{n+1} = (WK1 + S2 - D)^+ with S2 ~ Exp(MU2) independent of D.

Because A is exponential, max(A - WK - S1, 0) is zero with probability 1-q and Exp(LAMBDA) with probability

q = e^{-LAMBDA WK} MU1/(LAMBDA+MU1) = P(the upstream server goes idle),

so D is either Exp(MU1) or the sum of Exp(MU1) and Exp(LAMBDA). Averaging the downstream step over both cases needs only two elementary transforms of

g(d) = E[(WK1 + S2 - d)^+] = WK1 - d + 1/MU2 for d <= WK1,

= e^{-MU2 (d-WK1)}/MU2 for d > WK1,

namely J(c) = int_0^inf e^{-cu} g(u) du and Jw(c) = int_0^inf u e^{-cu} g(u) du, both closed form, giving

E[W2_{n+1} | WK, WK1] = (1-q) MU1 J(MU1) + q C, C = LAMBDA MU1 (J(MU1) - J(LAMBDA))/(LAMBDA-MU1) if LAMBDA ~= MU1,

= MU1^2 Jw(MU1) if LAMBDA == MU1.

As WK grows the upstream server never idles, q vanishes, and the mean tends to MU1 J(MU1) = E[g(S1’)], as it must.

Two caveats, both inherited from the reference and both quantified here.

First, this is exact for the step taken in isolation, that is when the conditioning pair is independent of the four primitives that drive the step. In a running tandem it is not: the downstream wait WK1 was itself determined by an interdeparture time containing S1, so conditioning on (WK, WK1) is not conditioning on a Markov state of the tandem. Measured against a 4e6-customer simulation of the real tandem at LAMBDA = 0.8, MU1 = MU2 = 1, the formula is within 0.4% to 1.3% away from the empty state and 7% at WK = WK1 = 0, where the entanglement is strongest. Treat it as exact for one isolated step and as a good approximation in a running tandem.

Second, this closed form was derived here rather than transcribed from the reference’s theorem 4, because that theorem rests on its proposition 1, which omits a service-time difference and so does not describe a tandem queue; see QSYS_TANDEM_LINDLEY. The two differ: at LAMBDA = 0.8, MU1 = MU2 = 1 and WK = WK1 = 0 the published route gives 0.3016 against 0.3457 here, the latter matching simulation of the step to 6e-4 relative error.

As in the reference, the upstream interarrival time is taken to be Exp(LAMBDA), which by Burke’s theorem is also the stationary interdeparture law, so the same formula is applied at any pair of consecutive stations of a longer M/M/1 tandem, with the caveat above compounding.

Returns a struct with fields:

mean - Conditional mean downstream waiting time, size of WK interdepMean - Conditional mean interdeparture time E[D | WK] = 1/MU1 + q/LAMBDA idleProb - q, the probability the upstream server idles, size of WK analyzer - Identifier string

Examples

r = qsys_mm1_tandem_lindley(0.8, 1.0, 1.0, 2.0, 3.0); r.mean % 2.9061 qsys_mm1_tandem_lindley(0.8, 1, 1, 0, 0).mean % 0.3457, both stations empty

Reference: S. Palomo, J. Pender, “Learning the Tandem Network Lindley Recursion”, Proc. Winter Simulation Conference, 2021, proposition 1 and theorem 4, corrected as described above.

See also QSYS_TANDEM_LINDLEY, QSYS_MM1_LINDLEY, QSYS_HH1_LINDLEY

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_bmapphnn_retrial(D, beta, S, N, alpha, gamma, p, R, varargin)

QSYS_BMAPPHNN_RETRIAL Analyzes a BMAP/PH/N/N bufferless retrial queue.

RESULT = QSYS_BMAPPHNN_RETRIAL(D, BETA, S, N, ALPHA, GAMMA, P, R) analyzes a BMAP/PH/N/N bufferless retrial queueing system with admission control.

This implements the algorithm from: Dudin et al., “Analysis of BMAP/PH/N-Type Queueing System with Flexible Retrials Admission Control”, Mathematics 2025, 13(9), 1434.

Inputs:
D - Cell array {D0, D1, …, DK} of BMAP matrices

D0: hidden transition matrix (V x V) D1, …, DK: arrival matrices for batches of size 1, …, K

BETA - PH service initial probability vector (1 x M) S - PH service subgenerator matrix (M x M) N - Number of servers (also capacity, hence bufferless) ALPHA - Retrial rate per customer in orbit GAMMA - Impatience (abandonment) rate per customer in orbit P - Probability of batch rejection when not enough servers R - Admission threshold (scalar or 1 x V vector per BMAP state)

When n > R(nu), arriving customers go to orbit

Optional parameters:
‘MaxLevel’ - Fixed orbit truncation level. When empty or non-positive

(default) the level is chosen adaptively: it is doubled until the mass retained at the top level contributes less than ‘TailTolerance’ of the mean orbit length. A fixed level disables the adaptive refinement.

‘Tolerance’ - Convergence tolerance (default: 1e-10) ‘TailTolerance’- Relative orbit-truncation error target (default: 1e-6) ‘MaxDim’ - Cap on the total generator dimension explored by the

adaptive refinement (default: 2e5)

‘MaxBlockSize’ - Cap on the per-level block size V*d (default: 5000).

Exceeding it is an error: the phase-type service order and the server count make the level block intractable.

‘Verbose’ - Print progress messages (default: false)

Returns a struct with fields:

L_orbit - Mean number of customers in orbit N_server - Mean number of busy servers L_system - Mean number in system (orbit + servers) Utilization - Server utilization (N_server / N) Throughput - System throughput P_idle - Probability all servers are idle P_empty_orbit - Probability orbit is empty P_empty_system - Probability system is empty (idle and empty orbit) pi - Stationary distribution (levels x Vd) truncLevel - Truncation level used truncError - Relative orbit-truncation error estimate at truncLevel analyzer - Name of analyzer used

Example

% M/M/3/3 retrial queue (exponential arrivals and service) D = {-2.0, 2.0}; % Exp(2) arrivals beta = 1; S = -1; % Exp(1) service N = 3; alpha = 0.5; % Retrial rate gamma = 0; % No impatience p = 0; % No batch rejection R = 2; % Admission threshold result = qsys_bmapphnn_retrial(D, beta, S, N, alpha, gamma, p, R);

See also qsys_mapph1(), qsys_is_retrial()

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_mmapgk1(MMAP, svc, varargin)

QSYS_MMAPGK1 Per-type waiting times of the MMAP[K]/G[K]/1 FCFS queue.

RESULT = QSYS_MMAPGK1(MMAP, SVC) analyzes a single-server FCFS queue with:
MMAP - cell {D0, D1, …, DK}: a marked Markovian arrival process of order

ma whose type-k arrivals carry the block Dk

SVC - cell of K service laws, one per type. Each entry is a LINE

Distribution object, a cell {D0s, D1s} holding a phase-type representation, or a struct with fields

.lst function handle s -> E[exp(-s S)], admitting COMPLEX s .moments raw moments [E[S], E[S^2], …], at least numWMoms+1 of

them

The struct form is what a solver hands in: sn.lst already carries the transform of the ORIGINAL law, while sn.proc carries only its phase-type fit, and it is the original that this analysis needs. The service laws may be GENERAL and need not share a family across types.

RESULT = QSYS_MMAPGK1(…, ‘wPoints’, T) also evaluates the per-type waiting time CDF at the times T by numerical transform inversion. RESULT = QSYS_MMAPGK1(…, ‘numWMoms’, N) returns N moments per type (default 3). RESULT = QSYS_MMAPGK1(…, ‘quadNodes’, Q) sets the quadrature order used for a service law with no closed-form matrix transform (default 120).

THE METHOD, which is He’s, theorem for theorem. FCFS makes the actual waiting time of a customer the WORKLOAD it finds on arrival, so everything follows from the joint transform of workload and arrival phase, f(s)_j = E[exp(-s V) 1{phase = j}], which by He’s Theorem 4.1 (eq. 4.6) satisfies

f(s) [ s I + D0 + sum_k Dk gk(s) ] = s v0, (*)

with v0 the idle-phase vector, his y0. The unknown v0 needs NO search for the roots of the determinant: the matrix U solving

U = D0 + sum_k Dk Fk(U), Fk(U) = int_0^inf exp(U t) dFk(t),

is his eq. (4.4), the generator of the underlying Markov process obtained by EXCISING the busy periods, and eq. (4.5) with Theorem 4.2 give y0 Q = 0 and y0 e = 1 - rho, i.e.

v0 = (1 - rho) pi_U.

The same vector is what the analyticity of (*) forces: for every left eigenpair (w, u) of U one has w [D0 + sum_k Dk gk(-u) + (-u) I] = 0, so the roots of (*) in the closed right half plane are exactly s = -u over the spectrum of U, and imposing v0 r_i = 0 at each right null vector reproduces the stationary vector to 2.5e-13. The stationary route is the one taken, as it needs no complex eigenvector and no rule for telling the structural root at the origin from a genuine one.

The per-type actual waiting time is the workload seen by a type-k arrival, biased by that type’s own arrival block, which is his Theorem 5.1 eq. (5.1) summed over the post-arrival phase:

E[exp(-s Wk)] = f(s) Dk e / lambda_k.

SCOPE. He allows an arrival to be a BATCH carrying a sequence of types, and his Theorem 5.3 then multiplies the transform by prod_{i<n} f*_{h_i}(s), the service of the customers ahead of the tagged one WITHIN its own batch. This function covers the single-customer-per-arrival case, his Special case 3.3, where that product is empty – which is exactly the MMAP convention LINE carries, {D0, D1, D^(1), …, D^(K)} with one customer per epoch.

Returns a struct with fields:

lambda - per-type arrival rates (1 x K) utilization - rho = sum_k lambda_k E[S_k] idleVector - v0, the idle-phase vector, summing to 1 - rho waitLST - function handle s -> row vector of E[exp(-s Wk)] waitMoments - (K x numWMoms) per-type waiting time moments meanWaitingTime - per-type mean waiting time (1 x K) meanSojournTime - per-type mean sojourn time (1 x K) meanQueueLength - E[N], by Little over all types waitCDF - (K x numel(wPoints)) per-type waiting time CDF waitPoints - the requested points analyzer - name of the analyzer used

Reference:

Qi-Ming He, “The versatility of MMAP[K] and the MMAP[K]/G[K]/1 queue”, Queueing Systems 38(4):397-418, 2001.

See also qsys_mapg1(), qsys_mapphc(), MMAPPH1FCFS

qsys_gig1_approx_gelenbe(lambda, mu, ca, cs)

[W,RHOHAT]=QSYS_GIG1_APPROX_GELENBE(LAMBDA,MU,CA,CS)

Gelenbe’s diffusion approximation with instantaneous-return boundary:

p(0) = 1-rho, p(n) = rho*(1-rhat)*rhat^(n-1), n>=1 rhat = exp(-2*(1-rho)/(rho*ca^2+cs^2))

hence E[N] = rho/(1-rhat) and the mean response time (time in system) W = E[N]/lambda = 1/(mu*(1-rhat)).

Reference: Gelenbe, E. (1975). On approximate computer system models. Journal of the ACM 22(2), 261-269.

qsys_gig1_approx_klb(lambda, mu, ca, cs)

[W,rhohat]=QSYS_GIG1_APPROX_KLB(LAMBDA,MU,CA,CS)

qsys_gigk_approx_cosmetatos(lambda, mu, ca, cs, k)

[W,RHOHAT]=QSYS_GIGK_APPROX_COSMETATOS(LAMBDA,MU,CA,CS,K)

GI/G/k approximation by interpolation of the M/M/k, M/D/k and D/M/k queues (Cosmetatos 1982; Page 1982):

Wq = [ca^2*cs^2 + ca^2*(1-cs^2)*phi1/2 + (1-ca^2)*cs^2*phi3/2]*Wq(M/M/k)

where phi1 and phi3 are the Cosmetatos (1975) correction factors for M/D/k and D/M/k, with the safeguards of Whitt (1993). The D/D/k corner has Wq=0. The interpolation requires ca^2<=1 and cs^2<=1; outside this region the Lee-Longton scaling Wq = ((ca^2+cs^2)/2)*Wq(M/M/k) is used.

Inputs:

LAMBDA - Arrival rate MU - Service rate per server CA - Coefficient of variation of inter-arrival time CS - Coefficient of variation of service time K - Number of servers

Returns:

W - Average time in system (response time) RHOHAT - Modified utilization (so that M/M/1 formulas still hold)

References: Cosmetatos, G.P. (1975). Approximate explicit formulae for the average queueing time in the processes (M/D/r) and (D/M/r). INFOR 13, 328-331. Page, E. (1982). Tables of waiting times for M/M/n, M/D/n and D/M/n and their use to give approximate waiting times in more general queues. J. Opl. Res. Soc. 33, 453-473.

qsys_gigk_approx(lambda, mu, ca, cs, k)

W=QSYS_GIGK_APPROX(LAMBDA,MU,CA,CS,K)

qsys_ggisgi_fluid(lambda, mu, s, patienceCcdf, varargin)

QSYS_GGISGI_FLUID Steady state of the G/GI/s+GI fluid model.

RESULT = QSYS_GGISGI_FLUID(LAMBDA, MU, S, PATIENCECCDF) computes the unique steady state of the deterministic fluid model of a multiserver queue with customer abandonment: arrival rate LAMBDA, S servers each of rate MU, general service times and general patience times whose complementary cdf is the function handle PATIENCECCDF, F^c(t) = P(patience > t).

THE MODEL. Scale the content by S and let S grow. Customers become quanta of fluid but their sojourns do not shrink, so the ages survive the limit: the state is the density b(x) of fluid that has been IN SERVICE for time x and the density q(x) of fluid that has been WAITING for time x. With rho = lambda/(s*mu),

rho <= 1 b(x) = rho G^c(x), q = 0, no abandonment, no wait rho > 1 b(x) = G^c(x), q(x) = rho F^c(x) on [0,w] and 0 beyond

where the queue boundary w solves F^c(w) = 1/rho (eq. 3.6). That one equation carries the whole overloaded regime: fluid that survives its patience for w enters service, so the surviving fraction F^c(w) must equal the fraction 1/rho the servers can absorb.

WHAT THE DISTRIBUTIONS CONTRIBUTE (Corollary 3.1). The rates and the number in service depend on G and F only through their means. The wait w, the queue content and its age profile depend on F BEYOND its mean but on G only through its mean. The age profile in service depends on G beyond its mean. Neither the number of servers nor anything about the arrival process beyond its rate appears at all, which is why this model says nothing about the QED regime and everything about the overloaded one.

Options:
‘servingCcdf’, G - the service-time ccdf, needed only for the in-service

age density; defaults to exponential of rate MU

‘agePoints’, X - ages at which to return the two densities ‘tol’, T - bisection tolerance for w, default 1e-12 ‘maxTime’, TMAX - largest age searched for w, default grows automatically

Returns a struct with fields:

regime - ‘underloaded’, ‘balanced’ or ‘overloaded’ trafficIntensity - rho = lambda/(s*mu) offeredWait - w, the wait of every customer who is served, 0 unless overloaded meanWait - E[W] over all customers, = int_0^w F^c(t)dt = m_a F_e(w) meanWaitServed - w again, the fluid wait being deterministic meanWaitAbandon - E[patience | patience <= w] probAbandon - 1 - 1/rho when overloaded, 0 otherwise meanQueueLength - Q = lambda * meanWait, in customers meanNumberInService - B = min(lambda/mu, s), in customers meanNumber - B + Q utilization - min(rho,1) throughput - min(lambda, s*mu) abandonRate - lambda - throughput agePoints, serviceAgeDensity, queueAgeDensity - the densities per server at

the requested ages, b(x) and q(x)

ACCURACY. This is the s -> Inf limit, so it is an approximation at finite S that improves with S and with the overload. Whitt (2004) reports it as crude at s = 100, rho = 1.02 and good at s = 100, rho = 1.10.

Example

% 100 agents, 10% overload, exponential patience of mean 5 res = qsys_ggisgi_fluid(110, 1, 100, @(t) exp(-t/5));

Reference: W. Whitt (2006). Fluid models for multiserver queues with abandonments. Operations Research 54(1), 37-54, Theorem 3.1 and Corollary 3.2.

See also QSYS_ERLANGA, QSYS_MGISRGI_WHITT.

qsys_gig1_rq(rho, mu, cs2, IaFun)

[Z,W,Q,X] = QSYS_GIG1_RQ(rho,mu,cs2,IaFun) - Robust Queueing (RQ) approximation for a single G/GI/1 queue partially characterized by its arrival rate, index of dispersion for counts (IDC) and the first two moments of the service time. Implements the mean steady-state workload

Z* = sup_{x>=0} { -(1-rho) x + sqrt( 2 rho x (I_a(x) + c2_s) / mu ) }

and the derived steady-state performance measures. Reference: W. Whitt and W. You (2018), “A Robust Queueing Network Analyzer Based on Indices of Dispersion”, eqs. (13),(16)-(18).

Inputs:

rho : traffic intensity lambda/mu (0<rho<1) mu : service rate cs2 : service SCV c2_s IaFun : handle, IaFun(x) -> arrival IDC I_a(x) at time argument x>0

Outputs:

Z : mean steady-state workload E[Z] W : mean steady-state waiting time E[W] Q : mean steady-state queue length E[Q] (number waiting + in service) X : mean number in system (= Q here for single class), kept for interface

qsys_gig1_rqt(lambda, mu, Gamma_a, Gamma_s, alpha_a, alpha_s)

[W,RHOHAT,SWORST]=QSYS_GIG1_RQT(LAMBDA,MU,GAMMA_A,GAMMA_S,ALPHA_A,ALPHA_S)

Robust Queueing Theory (RQT) worst-case system time of a G/G/1 FCFS queue, the single-server case of QSYS_GIGK_RQT. The closed-form bound is Theorem 2,

W <= (alpha-1)/alpha^(alpha/(alpha-1)) * lambda^(1/(alpha-1))

(Gamma_a+Gamma_s)^(alpha/(alpha-1)) / (1-rho)^(1/(alpha-1)) + 1/lambda,

and SWORST is the exact worst case over the uncertainty sets, eq. (12).

Inputs:

LAMBDA - Arrival rate MU - Service rate GAMMA_A - Variability parameter of the arrival uncertainty set GAMMA_S - Variability parameter of the service uncertainty set ALPHA_A - Arrival tail coefficient in (1,2] (default 2) ALPHA_S - Service tail coefficient in (1,2] (default 2)

Returns:

W - Closed-form bound on the system time (Theorem 2) RHOHAT - Modified utilization (so that M/M/1 formulas still hold) SWORST - Exact worst-case system time over the uncertainty sets, eq. (12)

Reference: C. Bandi, D. Bertsimas, N. Youssef (2015). Robust Queueing Theory. Operations Research 63(3), 676-700.

qsys_mmck(lambda, mu, c, K, varargin)

QSYS_MMCK Exact closed-form analysis of an M/M/c/K queue.

RESULT = QSYS_MMCK(LAMBDA, MU, C, K) analyzes an M/M/c/K queue with:

LAMBDA - Poisson arrival rate (positive scalar) MU - Exponential service rate per server (positive scalar) C - Number of servers (positive integer) K - System capacity, total jobs allowed (integer, K >= C)

Stationary distribution (Erlang-B/C truncated form):

a = lambda/mu, rho = a/c p_n = (a^n / n!) * p_0 for 0 <= n <= c p_n = (a^c / c!) * rho^(n-c) * p_0 for c <= n <= K p_0 = 1 / [ sum_{n=0}^{c-1} a^n/n! + (a^c/c!) * sum_{n=0}^{K-c} rho^n ]

Returns a struct with fields:

meanQueueLength - Mean number of jobs in system, L meanQueueLengthQ - Mean number waiting in queue, Lq meanWaitingTime - Mean waiting time in queue, Wq (Little) meanSojournTime - Mean sojourn time, W = Wq + 1/mu utilization - Per-server utilization, lambda_eff/(c*mu) throughput - Effective throughput, lambda*(1 - p_K) lossProbability - Blocking probability, p_K queueLengthDist - Distribution as 1x(K+1) row: [p_0, p_1, …, p_K] varQueueLength - Var(N) arrivalDist - law seen by accepted arrivals, Pi_n = p_n/(1-p_K), n < K probWait - P(W > 0) = sum_{n>=c} Pi_n condMeanWaitingTime- E[W | W > 0] varWaitingTime, varSojournTime tPoints, waitingTimeCdf, sojournTimeCdf (option ‘tPoints’, T) percentiles, waitingTimePercentile, sojournTimePercentile (option

‘percentiles’, R with R in percent)

analyzer - Identifier string

Examples

r = qsys_mmck(1, 1, 2, 4); % M/M/2/4 with rho = 0.5 r.meanQueueLength % 1.1304 r.lossProbability % 0.0435

An accepted arrival that finds n >= c waits for n-c+1 completions at rate c*mu, so W is a mixture of Erlang laws and T = W + S with S ~ Exp(mu) (Sztrik 2021, Table 8; Zukerman 2025, Sec. 12.4).

See also QSYS_MMCKK, QSYS_MM1K_LOSS, QSYS_MMK, QSYS_MAPDC

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_mg1_srpt(lambda, mu, cs)

QSYS_MG1_SRPT Compute mean response time for M/G/1/SRPT queue

[W, RHO] = QSYS_MG1_SRPT(LAMBDA, MU, CS) computes the mean response time for each job class in an M/G/1 queue with Shortest Remaining Processing Time (SRPT) scheduling.

SRPT is a size-based policy: it always serves the job with the smallest remaining processing time, preempting whenever a shorter job arrives. The class-conditional response time is obtained from the Schrage-Miller formula (Eqs (1)-(3) of Bansal-Harchol-Balter, SIGMETRICS 2003, citing Schrage-Miller 1966). For a job of size x:

E[T(x)] = E[W(x)] + E[R(x)] E[W(x)] = lambda*(m2(x) + x^2*(1-F(x))) / (2*(1-rho(x))^2) (waiting) E[R(x)] = integral_0^x dt/(1-rho(t)) (residence)

where f(t) is the overall (mixture) job-size density, F(t) its CDF,

rho(x) = lambda * integral_0^x t*f(t) dt (load from jobs of size <= x) m2(x) = integral_0^x t^2 f(t) dt

The per-class mean is E[T_r] = integral_0^inf E[T(x)] f_r(x) dx, with f_r the class-r size density and f = sum_r (lambda_r/lambda) f_r the mixture. Because E[T(x)] depends only on the job size (SRPT is size-based, not class-based), this integral is exact. The integrals are evaluated by cumulative trapezoidal quadrature on a common grid.

Each class is represented by a job-size distribution matched to its (mean=1/mu_r, scv=cs_r^2): exponential when cs_r=1, a two-phase balanced hyperexponential when cs_r>1, and a Tijms mixture of Erlang-(k-1)/Erlang-k when cs_r<1. For the fully exponential case this reproduces the exact M/M/1/SRPT hyperexponential-mixture result. A class with cs_r=0 is a point mass at 1/mu_r; any such class sends the whole call to the exact quadrature of private/qsys_mg1_sizequad (‘srpt’), since the size law then has an atom.

Parameters:
  • lambda – Vector of arrival rates per class

  • mu – Vector of service rates per class

  • cs – Vector of coefficients of variation per class (cs=1 for exponential)

Returns:

W – Vector of mean response times per class (original class order) rho : System load measure Q/(1+Q) with Q = sum(lambda.*W)

References

  • L. E. Schrage and L. W. Miller, “The queue M/G/1 with the shortest remaining processing time discipline”, Operations Research, 14:670-684, 1966.

  • N. Bansal and M. Harchol-Balter, “Analysis of SRPT scheduling: investigating unfairness”, SIGMETRICS 2001, Sec. 4, Eqs (1)-(3).

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_ldps_workload(lambda, B, alpha, N, t, ngrid)

[F,t,p] = QSYS_LDPS_WORKLOAD(lambda,B,alpha,N,t) - Stationary distribution of the quantity of work in a single-stage load-dependent processor sharing station with Poisson arrivals and blocking.

Assumed model (Cohen, 1979, Sect. 9; the model of Sect. 7 with one stage):
  • a single service stage fed by a Poisson arrival stream of rate lambda;

  • blocking capacity N: a request arriving when N requests are already present is lost and leaves no trace on the state;

  • generalized processor sharing: when x requests are present each of them accrues service at rate f(x), so the stage completes work at total rate x*f(x). This function is parametrized by the LINE load-dependent total rate scaling alpha(x)=x*f(x), i.e. the argument of setLoadDependence at a PS station;

  • required service times are i.i.d. with absolutely continuous distribution B and finite mean beta.

The result is insensitive to B beyond its shape only through the equilibrium residual distribution Psi below; the state probabilities p depend on B only through beta.

Let psi_t denote the total amount of service still to be given to the requests present at time t. Cohen (1979) eqs. (9.1)-(9.3) give

Pr{psi_t < psi} = sum_{h=0}^{N} p_h Psi^{h*}(psi), p_h = (rho^h/h!) phi(h) / sum_{k=0}^{N} (rho^k/k!) phi(k), rho=lambda*beta phi(h) = 1/prod_{k=1}^{h} f(k), phi(0)=1, Psi(psi) = int_0^psi (1-B(v))/beta dv,

with Psi^{h*} the h-fold convolution of Psi and Psi^{0*} degenerate at zero. Substituting f(k)=alpha(k)/k the factorial cancels, leaving

p_h propto rho^h / prod_{k=1}^{h} alpha(k),

which is the familiar load-dependent birth-death form. Psi is the equilibrium (residual life) distribution of B, so psi_t is a mixture of h-fold convolutions of residual service times, with an atom p_0 at zero.

Inputs:

lambda : Poisson arrival rate (finite, positive) B : Distribution object for the required service time (continuous,

finite positive mean)

alpha : rate scaling alpha(n)=n*f(n) for n=1..N (finite, positive) N : blocking capacity (finite positive integer) t : optional grid at which the CDF is returned. Default: an

automatically sized grid covering the bulk of the distribution.

ngridoptional number of points of the internal uniform quadrature

grid on which the convolutions are formed. Default 2001.

Outputs:
FF(j) = Pr{psi_t <= t(j)}. Note F(1)=p(1)=Pr{psi_t=0} when t(1)=0,

since the workload has an atom at zero of size p_0.

t : grid at which F is reported p : (1,N+1) vector, p(h+1)=Pr{x_t=h}, the stationary number in system

This is the model of Cohen (1979) Sect. 9 only. It is not the weighted GPS/DPS discipline of SchedStrategy.GPS, whose per-class weights this formula does not represent.

Reference: J.W. Cohen, “The multiple phase service network with generalized processor sharing”, Acta Informatica 12, 245-284 (1979), Sect. 9.

qsys_mm1_ps(lambda, mu)

[W,W2,ALPHA] = QSYS_MM1_PS(LAMBDA, MU)

Exact sojourn-time moments of the multiclass M/M/1-PS queue.

Class j arrives in a Poisson stream of rate LAMBDA(j) and requires an exponential amount of service with rate MU(j). The processor is shared equally by all jobs in service, so the class of a job affects its sojourn time both through its own service rate and through the mix of rates of the jobs it shares the processor with. With ALPHA = 1 - sum_j LAMBDA(j)/MU(j) the unutilized fraction of the processor, the moments of the sojourn time W_r of a tagged class-r job are

E[W_r] = 1/(ALPHA*MU(r)) E[W_r^2] = 2/(ALPHA*MU(r))^2 * [1 - sum_j lambda_j (mu_j-mu_r)/(mu_j(mu_j+mu_r))]

/ [1 - sum_j lambda_j/(mu_j+mu_r)]

which is equation (7) of Mitra and Morrison (1983). Both are exact, not asymptotic: the open system is the N -> infinity limit of the closed terminal-driven system whose moments that paper expands in 1/N, and the leading term of the expansion is exact in the limit. For a single class the second moment reduces to the classical 4/(mu^2 (1-rho)^2 (2-rho)) of Coffman, Muntz and Trotter (1970).

Input:

lambda - per-class Poisson arrival rates (1,R), non-negative mu - per-class exponential service rates (1,R), positive

Output:

W - per-class mean sojourn times (1,R) W2 - per-class second moments of the sojourn time (1,R) alpha - unutilized fraction of the processor, 1 - sum_j lambda_j/mu_j

Reference: D. Mitra, J. A. Morrison, “Asymptotic Expansions of Moments of the Waiting Time in Closed and Open Processor-Sharing Systems with Multiple Job Classes”, Adv. Appl. Prob. 15(4), 1983, equation (7).

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_gm1(sigma, mu, varargin)

W=QSYS_GM1(SIGMA,MU)

qsys_ggnm_diffusion(lambda, mu, n, m, ca, cs, varargin)

QSYS_GGNM_DIFFUSION Diffusion approximation for the G/GI/n/m queue.

RESULT = QSYS_GGNM_DIFFUSION(LAMBDA, MU, N, M, CA, CS) approximates the steady state of a queue with a general arrival process of rate LAMBDA and variability CA, iid general service of mean 1/MU and variability CS, N servers and M extra waiting spaces (M = Inf for an unbounded queue).

THE APPROXIMATION IS ONE DIFFUSION WITH TWO REGIONS. Below the staffing level the queue behaves like an infinite-server system, whose limit is NORMAL with variance-to-mean ratio the ASYMPTOTIC PEAKEDNESS

z = 1 + (ca^2 - 1) omega_G, omega_G = int G^c(x)^2 dx / int G^c(x) dx

(eqs. 1.6-1.7); above it the queue behaves like a single-server queue, whose limit is EXPONENTIAL with variability v = (ca^2 + cs^2)/2 (eq. 3.7). The steady-state law is a normal piece spliced to an exponential piece and every measure below is an integral of that density (eq. 3.14).

WHAT z SAYS. The service-time distribution enters the delay probability ONLY through omega_G, which is 1 for deterministic service, 1/2 for exponential, and falls toward 0 as service gets more variable. So at ca^2 = 1 the delay probability does not depend on the service law at all (z = 1), which is the long-standing M/GI/n-by-M/M/n approximation; away from ca^2 = 1 it does, and this is how much.

With M = Inf the delay probability is alpha(beta/sqrt(z)) for the Halfin-Whitt function alpha (eq. 3.10), so this generalizes QSYS_MMK_QED.

Options:

‘serviceCcdf’, G - G^c(x) = P(S > x); the exponential of rate MU by default ‘tol’, TOL - service-tail cut for the peakedness integral, 1e-12 ‘panels’, P - Simpson panels for it, default 4000

Returns a struct with fields beta (the QED server slack), gamma (the scaled waiting room), peakedness (z), peakednessWeight (omega_G), variability (v), probDelay, probBlock, meanQueueLength, meanNumber, meanWait, utilization, throughput and trafficIntensity.

Example

res = qsys_ggnm_diffusion(95, 1, 100, 20, 1.5, 0.8);

Reference: W. Whitt (2004). A diffusion approximation for the G/GI/n/m queue. Operations Research 52(6), 922-941.

See also QSYS_MMK_QED, QSYS_GIGK_APPROX_WHITT, QSYS_ERLANGA.

qsys_mapmap1(C0, C1, D0, D1, varargin)

QSYS_MAPMAP1 Analyzes a MAP/MAP/1 queue using BUTools MAPMAP1.

RESULT = QSYS_MAPMAP1(C0, C1, D0, D1) analyzes a MAP/MAP/1 queue with:

C0 - Arrival MAP hidden transition matrix (n x n) C1 - Arrival MAP arrival transition matrix (n x n) D0 - Service MAP hidden transition matrix (m x m) D1 - Service MAP observable transition matrix (m x m)

MAPMAP1 solves the QBD over (number in system, arrival phase, service phase), so the serial correlation of the service MAP is honoured. Until 2026-11 the service MAP was collapsed to its stationary marginal PH and the queue solved as MAP/PH/1 by MMAPPH1FCFS, which dropped that correlation.

RESULT = QSYS_MAPMAP1(…, ‘numQLMoms’, K) computes K queue length moments RESULT = QSYS_MAPMAP1(…, ‘numQLProbs’, N) computes N queue length probs RESULT = QSYS_MAPMAP1(…, ‘numSTMoms’, K) computes K sojourn time moments

Returns a struct with fields:

meanQueueLength - Mean number of customers in system meanWaitingTime - Mean waiting time in queue meanSojournTime - Mean sojourn time (waiting + service) utilization - Server utilization queueLengthDist - Queue length distribution P(Q=n) queueLengthMoments- Raw moments of queue length sojournTimeMoments- Raw moments of sojourn time analyzer - Name of analyzer used

See also MAPMAP1, qsys_mapph1(), qsys_phph1()

qsys_gigk_rqt_gamma(rho, mu, Gamma_a, sigma_s, k, alpha_a, regime)

[GAMMA_S,THETA]=QSYS_GIGK_RQT_GAMMA(RHO,MU,GAMMA_A,SIGMA_S,K,ALPHA_A,REGIME)

Service variability parameter of the Robust Queueing Theory (RQT) framework, obtained from the first two moments by the adaptation of Section 7.1,

Gamma_s = (2 (theta0 + theta1 sigma_s^2/k + theta2 Gamma_a^2 rho^2 k))^((a-1)/a)
  • Gamma_a k^((a-1)/a),

where (theta0,theta1,theta2) are regressed so that the worst-case system time of Theorem 3 approximates the MEAN system time of the corresponding stochastic queue. The arrival side needs no adaptation: Gamma_a = sigma_a for an external renewal stream, and the network traffic equations (NPFQN_TRAFFIC_RQT) carry it to the internal streams. Since the last term cancels Gamma_a at alpha=2, the adaptation acts on the sum Gamma_a + Gamma_s/k^(1/alpha) that Theorem 3 reads.

THE FACTOR 2 IS NOT IN THE PRINTED FORMULA and is restored here. Section 7.1 states that the functional form is motivated by Kingman’s bound, which the alpha=2 bound of Theorem 3 reproduces when (Gamma_a+Gamma_s)^2 = 2(sigma_a^2 + sigma_s^2); the published (theta0,theta1,theta2) are all near unity, i.e. they are corrections to that bound rather than a substitute for its factor 2. Dropping the factor puts M/M/1 about 40% BELOW its exact mean system time at rho=0.9 and M/M/3 about 45% below, which contradicts the errors of at most 9.5% that Tables 2-3 report; restoring it gives +4.7% and +8.8%, inside that envelope. See _kb/06-solver-catalog.md.

CAUTION: even so the form is not dimensionally homogeneous, since theta0 is an additive constant on a scale of variances, so it is only valid in the time unit the regression was run in. This routine therefore evaluates it in units of the mean service time, 1/mu = 1, and converts the result back. Do not call it with a time scale of your own choosing.

Inputs:

RHO - Traffic intensity lambda/(k*mu) MU - Service rate of each server, which sets the time unit GAMMA_A - Variability parameter of the arrival uncertainty set SIGMA_S - Standard deviation of the service time K - Number of servers (default 1) ALPHA_A - Effective arrival tail coefficient in (1,2] (default 2) REGIME - Adaptation regime, Table 1: ‘independent’ (default, service

distribution unknown), ‘normal’ or ‘pareto’

Returns:

GAMMA_S - Variability parameter of the service uncertainty set THETA - The (theta0,theta1,theta2) triple used

Reference: C. Bandi, D. Bertsimas, N. Youssef (2015). Robust Queueing Theory. Operations Research 63(3), 676-700, Section 7.1 and Table 1.

mexify_qsys

@brief MATLAB Coder script to generate MEX functions for qsys_ module.

This script generates MEX (MATLAB Executable) versions of qsys_ functions for improved performance. All functions in this module are pure numerical computations (scalar or vector input/output).

See also CODER, CODER.CONFIG, CODER.TYPEOF, CODEGEN.

qsys_mmapg1k(D0, D1c, svc, K, varargin)

RESULT = QSYS_MMAPG1K(D0, D1C, SVC, K)

Exact per-class throughput and loss ratio of an MMAP[K]/G/1/K queue with tail drop: marked Markovian arrivals, arbitrary service time distribution F common to all classes, and a finite buffer of K packets (the position held by the packet in transmission included).

Two classes of equal arrival rate but different interarrival variability or autocorrelation receive different loss ratios, which is the effect that motivates [1]. Aggregate-only finite-buffer analyses cannot express it: they return a single blocking probability p and set T_k = lambda_k*(1-p), making the loss ratio identical across classes by construction.

D0 - M x M hidden transition matrix of the arrival MMAP D1C - 1 x R cell array, D1C{k} = M x M arrival matrix of class k.

D0 + sum_k D1C{k} must be an irreducible generator.

SVC - service time descriptor, see QSYS_MAPG1K K - buffer size in packets, K >= 1

Options are forwarded to QSYS_MAPG1K (‘tol’, ‘nmax’).

Returns a struct with fields:

throughput(k) - throughput of class k [pkts/s] lossRatio(k) - loss ratio of class k, in [0,1] lambda(k) - arrival rate of class k [pkts/s] lambdaAggregate, throughputAggregate, lossAggregate p0, pK - empty/full buffer probabilities pKvec - 1 x M, P(buffer full, phase j) plevel - 1 x (K+1), time-stationary P(level = l) meanQueueLength - E[number in system] meanServiceTime, rho, utilization

Method. The aggregate MAP {D0, sum_k D1C{k}} drives QSYS_MAPG1K, whose embedded chain returns the joint law of buffer level and MAP phase. A class-k arrival leaves phase i at rate (D1C{k}*e)_i, so the rate of class-k arrivals that meet a full buffer is pKvec*D1C{k}*e, and

lambda_k = pi*D1C{k}*e, L_k = (pKvec*D1C{k}*e)/lambda_k,

with pi the stationary phase law of the aggregate. This is exact: no independence between classes is assumed and no PASTA argument is used, the phase resolution of pKvec doing the work instead.

Relation to [1]. Reference [1] instead keeps one flow exact and replaces the rest by a Poisson stream of the same rate, invoking Palm-Khinchin, and repeats that once per flow. That approximation is needed only when the joint arrival process is unavailable, its exact form costing prod_n M_n phases for N independent flows. When the joint MMAP is already at hand, as it is inside a solver that propagates MMAPs between stations, the phase resolution above is both exact and cheaper. Use QSYS_MAPG1K_PERFLOW for the setting of [1], where flows are given as N separate MAPs.

Assumes a single server and a service law that is iid and independent of class. Per-class service makes the departure rate depend on which class holds the server, which this model does not represent.

References: [1] Chydzinski, A. Per-Flow Throughput of a FIFO Buffer. Applied System

Innovation 2026, 9, 112.

See also QSYS_MAPG1K, QSYS_MAPG1K_PERFLOW, QSYS_MG1K_LOSS.

qsys_mgisrgi_whitt(lambda, mu, s, r, patience, varargin)

QSYS_MGISRGI_WHITT Engineering solution of the M/GI/s/r+GI queue.

RESULT = QSYS_MGISRGI_WHITT(LAMBDA, MU, S, R, PATIENCE) computes every standard steady-state measure of the call-center model M/GI/s/r+GI: Poisson arrivals at rate LAMBDA, iid general service times of mean 1/MU, S servers, R extra waiting spaces and iid patience times with a general distribution.

THE TWO APPROXIMATIONS. The general patience law is replaced by STATE- DEPENDENT Markovian abandonment: a customer who is jth from the end of a queue abandons at rate delta_j = h(j/lambda), where h = f/(1-F) is the patience hazard rate, because a customer in that position has been waiting for about j/lambda (eq. 3.3). The total abandonment rate with k waiting is then Delta_k = sum_{j<=k} delta_j (eq. 3.4). The general service law is replaced by an exponential of the same mean (Section 5), which is accurate here because with many servers and non-negligible abandonment the model behaves like a loss system, where the service law is insensitive beyond its mean. What is left is the Markovian M/M/s/r+M(n) model, solved as a birth-and-death process.

WHAT THE PATIENCE LAW CONTRIBUTES. Only the hazard function NEAR THE ORIGIN, not the mean and not the tail: waits are O(1/sqrt(s)) in the many-server regime, so a customer either abandons early or never. That is the paper’s main modelling insight and the reason a two-moment patience fit is not enough.

PATIENCE accepts three forms:
scalar THETA - exponential patience of rate THETA, h(t) = THETA. The

approximations are then EXACT and the model is Erlang A (see QSYS_ERLANGA).

function handle - the hazard rate h(t), used as in eq. (3.3). struct(‘ccdf’,G) - the complementary cdf G(t) = 1-F(t), used through the

integrated form Delta_k = -log G(k/lambda) of eq. (3.6), which is the variant to use when the density is not smooth.

RESULT = QSYS_MGISRGI_WHITT(…, ‘wPoints’, T) also returns the waiting-time cdfs at the times T, obtained by numerically inverting the transforms of eqs. (7.22)-(7.23) and (7.32)-(7.33) with the Abate-Whitt EULER algorithm. Other options: ‘maxQueue’ (truncation level used when R is Inf, default 100000), ‘tol’ (relative tail tolerance for that truncation, default 1e-14), ‘invMethod’ and ‘invN’ (inversion method and node count, default ‘euler’, 41).

Returns a struct with fields:

queueLengthDist - P(N = k) for k = 0..s+r, N the number in system probLoss - P(an arrival is blocked) = p_{s+r}, zero when R is Inf probNoWait - P(W = 0) among entering customers probServed - P(S), an entering customer is eventually served probAbandon - P(A) = 1 - P(S) meanNumber - E[N] varNumber - Var[N] meanQueueLength - E[Q] varQueueLength - Var[Q], Q = (N-s)^+ meanWaitServed - E[W|S] varWaitServed - Var[W|S] meanWaitAbandon - E[W|A] varWaitAbandon - Var[W|A] meanWait - E[W] over entering customers, zeros included secondMomentWait - E[W^2] over entering customers utilization - E[min(N,s)]/s, the fraction of servers busy throughput - rate of served customers, lambda(1-P_loss)P(S) abandonRate - rate of abandoning customers, lambda(1-P_loss)P(A) abandonRates - delta_j, j = 1..r totalAbandonRates - Delta_k, k = 0..r waitPoints - the times T, when requested cdfWaitServed - P(W <= t | S) cdfWaitAbandon - P(W <= t | A) cdfWait - P(W <= t) over entering customers

ACCURACY. Exact for M/M/s/r+M. Elsewhere the paper reports errors of a few percent against simulation, degrading as the service SCV moves away from 1.

Example

% M/M/100/200+M with mean patience 1, from Table 1 of the paper res = qsys_mgisrgi_whitt(102, 1/10, 100, 200, 1);

Reference: W. Whitt (2005). Engineering solution of a basic call-center model. Management Science 51(2), 221-235.

See also QSYS_ERLANGA, QSYS_GGSGI_FLUID, LAPLACE_INVERT_EULER.

qsys_gig1_approx_heyman(lambda, mu, ca, cs)

W=QSYS_GIG1_APPROX_HEYMAN(LAMBDA,MU,CA,CS)

qsys_gtmtst_fluid(lambdaFun, sFun, muFun, patienceCcdf, T, varargin)

QSYS_GTMTST_FLUID The Gt/Mt/st+GI many-server fluid queue.

RESULT = QSYS_GTMTST_FLUID(LAMBDAFUN, SFUN, MUFUN, PATIENCECCDF, T) solves the time-varying many-server fluid queue on [0,T]: arrival rate LAMBDAFUN(t), staffing SFUN(t), exponential service at rate MUFUN(t), general patience with complementary cdf PATIENCECCDF, unlimited waiting room.

THE MODEL ALTERNATES BETWEEN TWO REGIMES, and the whole algorithm is the bookkeeping of that alternation:

UNDERLOADED the queue is empty and every arrival enters service at once, so

the system is the infinite-server fluid model and B obeys B’(t) = lambda(t) - mu(t)B(t) (eq. 18 in its Mt form). It ends when B reaches s while lambda exceeds the rate Gamma(t) = s’(t) + s(t)mu(t) at which capacity frees up (15).

OVERLOADED every server is busy, B(t) = s(t), fluid enters service at

exactly Gamma(t), and the queue is described by its BOUNDARY WAITING TIME w(t), the age of the oldest fluid still waiting. Content of age x is what arrived x ago and has not abandoned, q(t,x) = lambda(t-x)F^c(x), and the boundary moves by the delay differential equation (21)

w’(t) = 1 - Gamma(t) / [lambda(t-w(t)) F^c(w(t))].

It ends when w returns to 0 with lambda no longer above Gamma (14).

WHY w AND NOT Q. The queue content is a functional of w, but not the other way round: two systems with the same Q and different age profiles abandon at different rates. Tracking the boundary keeps the age profile exact, which is what makes a general patience law admissible at all.

Options:

‘dt’, DT - grid step, default T/2000 ‘B0’, B - fluid in service at time 0, default 0 ‘w0’, W - boundary waiting time at time 0, default 0 ‘sPrime’, SP - s’(t); differentiated from SFUN numerically when absent ‘patiencePdf’, F - the patience density, for the abandonment rate;

differenced from the ccdf when absent

‘lambdaPast’, L - the arrival rate before time 0, needed only when the

queue starts non-empty

Returns a struct on the grid with fields times, regime (1 overloaded, 0 underloaded), B, Q, X = B+Q, w, v (potential waiting time), sigma (service completion rate), alpha (abandonment rate), utilization, arrivalRate, staffing and capacityRate (Gamma).

Example

fc = @(x) exp(-0.5*x); res = qsys_gtmtst_fluid(@(t) 100+30*sin(t), 100, 1, fc, 40);

Reference: Y. Liu, W. Whitt (2012). The Gt/GI/st+GI many-server fluid queue. Queueing Systems 71, 405-444; Y. Liu, W. Whitt (2014). Algorithms for time-varying networks of many-server fluid queues. INFORMS J. on Computing 26(1), 59-73.

See also QSYS_GGISGI_FLUID, QSYS_MTGINF, NPFQN_GTMTST_FLUID.

qsys_mapg1(D0, D1, serviceMoments, varargin)

QSYS_MAPG1 Analyzes a MAP/G/1 queue using BUTools MMAPPH1FCFS.

RESULT = QSYS_MAPG1(D0, D1, SERVICEMOMENTS) analyzes a MAP/G/1 queue with:

D0 - MAP hidden transition matrix (n x n) D1 - MAP arrival transition matrix (n x n) SERVICEMOMENTS - First k raw moments of service time [E[S], E[S^2], …]

(k = 2 or 3 for best accuracy)

The general service time is fitted to a Phase-Type distribution using moment matching before analysis.

RESULT = QSYS_MAPG1(…, ‘numQLMoms’, K) computes K queue length moments RESULT = QSYS_MAPG1(…, ‘numQLProbs’, N) computes N queue length probs RESULT = QSYS_MAPG1(…, ‘numSTMoms’, K) computes K sojourn time moments

Returns a struct with fields:

meanQueueLength - Mean number of customers in system meanWaitingTime - Mean waiting time in queue meanSojournTime - Mean sojourn time (waiting + service) utilization - Server utilization queueLengthDist - Queue length distribution P(Q=n) queueLengthMoments- Raw moments of queue length sojournTimeMoments- Raw moments of sojourn time analyzer - Name of analyzer used

See also MMAPPH1FCFS, APHFrom3Moments, qsys_mapph1()

qsys_mm1_dps(lambda, mu, w, tol, maxCutoff)

[T,RHO] = QSYS_MM1_DPS(LAMBDA, MU, W, TOL, MAXCUTOFF)

Numerically exact M/M/1 Discriminatory Processor Sharing (DPS) queue.

Solves the multiclass DPS continuous-time Markov chain on the per-class population vector (n_1..n_K): arrivals lambda(k), class-k completion rate mu(k)*n_k*w(k)/sum_j n_j*w(j). The state space is truncated at a total population level chosen from the geometric tail bound and doubled until the per-class mean counts are stable, so the result is exact to solver precision and conserves the M/M/1 total for equal service rates by construction.

Input:

lambda - per-class Poisson arrival rates (1,K) mu - per-class exponential service rates (1,K) w - per-class DPS weights (1,K), positive tol - convergence tolerance on the mean counts (default 1e-10) maxCutoff - hard bound on the truncation level (default 2048)

Output:

T - per-class mean response times (1,K) via Little’s law rho - total utilization sum_k lambda(k)/mu(k)

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_mg1k_loss(lambda, svc_density, K)

[LOSSPROB,RHO]=QSYS_MG1K_LOSS(LAMBDA,SVC_DENSITY,K)

Exact M/G/1/K loss probability via the Markov chain embedded at service-start epochs (transform-free analysis in the spirit of Niu-Cooper).

State: number of customers waiting in the queue immediately after a service start, q in {0,…,K-2} (capacity K includes the job in service; just after a departure at most K-1 jobs remain, one of which enters service). With a_j = P(j Poisson arrivals during a service time):

q=0if no arrival occurs during the service the system empties and

the next service starts with the next arrival (q’=0), so both a_0 and a_1 lead to q’=0 and j>=2 arrivals lead to q’=j-1;

q>=1: q’ = q-1+j, with arrivals beyond the free capacity lost

(aggregated in the last column).

The loss probability follows from the renewal-reward argument

E[cycle] = E[S] + sigma_0*a_0/lambda, lambda_eff = 1/E[cycle], P_loss = 1 - lambda_eff/lambda = 1 - 1/(rho + sigma_0*a_0)

where sigma is the stationary distribution at service-start epochs.

TEST: mu=3; lambda=2; K=5; [lossprob_mg1k,rho]=qsys_mg1k_loss(lambda,@(t)mu.*exp(-mu.*t),K) (exact M/M/1/5 value: 0.04812030)

Reference: Niu, Cooper. Transform-Free Analysis of M/G/1/K and Related Queues. Mathematics of Operations Research 18(2), 1993, 486-510.

qsys_mm1(lambda, mu, varargin)

W=QSYS_MM1(LAMBDA,MU)

[W, RHO] = QSYS_MM1(LAMBDA, MU) returns the mean response time W and the utilization RHO = LAMBDA/MU of the M/M/1 queue.

[W, RHO, RES] = QSYS_MM1(LAMBDA, MU, ‘tPoints’, T, ‘percentiles’, P, ‘nmax’, N) also returns a struct with

meanQueueLength, varQueueLength, meanQueueLengthQ, varQueueLengthQ, meanWaitingTime, varWaitingTime, meanSojournTime, varSojournTime, probWait (rho), condMeanWaitingTime, throughput, utilization, queueLengthDist ([P_0..P_N], default N until the tail is below 1e-14), meanBusyPeriod, varBusyPeriod, meanIdlePeriod, tPoints, waitingTimeCdf, sojournTimeCdf, busyPeriodPdf (with ‘tPoints’) percentiles, waitingTimePercentile, sojournTimePercentile (with ‘percentiles’)

The busy-period density is f(t) = sqrt(MU/LAMBDA) exp(-(LAMBDA+MU) t) I_1(2 t sqrt(LAMBDA MU))/t.

References: J. Sztrik, Basic Queueing Theory, 2021, Table 3; I. Adan and J. Resing, Queueing Systems, 2015, Secs. 4.2-4.6.

qsys_mapg1k(D0, D1, svc, K, varargin)

RESULT = QSYS_MAPG1K(D0, D1, SVC, K)

Exact analysis of a MAP/G/1/K queue with tail drop: Markovian arrivals, arbitrary service time distribution F, and a finite buffer of K packets (the position held by the packet in transmission included).

Unlike QSYS_MAPG1, the service time is NOT fitted to a phase-type distribution: F enters exactly, through the functionals A_m and Q_m evaluated by uniformization of the arrival MAP. Unlike QSYS_MG1K_LOSS, which embeds the same way but assumes Poisson input, arrivals may be a general MAP, so flows with equal rate but different interarrival variability or autocorrelation are told apart.

D0, D1 - MAP parameter matrices (M x M), D0 + D1 an irreducible generator SVC - service time descriptor, a struct with field ‘type’:

‘gamma’fields alpha (shape), theta (scale). Covers Exp

(alpha=1) and Erlang (alpha integer).

‘det’ : field d (constant service time) ‘ph’ : fields alpha (1 x p row), T (p x p subgenerator) ‘density’ : field pdf (handle), optional field tmax

K - buffer size in packets, K >= 1

RESULT = QSYS_MAPG1K(…, ‘tol’, TOL) sets the uniformization truncation tolerance (default 1e-12). RESULT = QSYS_MAPG1K(…, ‘nmax’, N) caps the uniformization order.

Returns a struct with fields:

p0 - stationary probability of an empty buffer pK - stationary probability of a full buffer lossProbability - loss ratio of the aggregate arrival stream, 1-T/lambda throughput - aggregate throughput [pkts/s] lambda - aggregate arrival rate of the MAP meanServiceTime - S = E[service time] utilization - 1 - p0 rho - offered load lambda*S nmax - uniformization order used sigma - stationary law of the embedded chain, K*M entries pKvec - 1 x M, P(buffer full, phase j), summing to pK p0vec - 1 x M, P(buffer empty, phase j), summing to p0 plevel - 1 x (K+1), time-stationary P(level = l), l = 0..K meanQueueLength - E[number in system], sum_l l*plevel(l+1)

Method. The chain embedded at departure epochs is used, in the state (n,j): n = 0..K-1 packets left behind by a departure, j = MAP phase. With A_m the matrix of “m arrivals during a service, phase i -> j”,

n >= 1: n’ = n-1+min(m, K-n), via A_m, overflow sum_{m>=K-n} A_m n == 0: the phase first jumps by (-D0)^{-1}*D1 (the idle period ends at

an arrival), and the service then proceeds as from n = 1.

Its stationary law sigma gives, by Markov renewal reward,

E[cycle] = S + sum_j sigma(0,j)*idle_j, idle = (-D0)^{-1}*e T = 1/E[cycle], p0 = (sum_j sigma(0,j)*idle_j)/E[cycle] = 1 - T*S pK = E[time at level K per cycle]/E[cycle], from Q_m,

where Q_m is the expected time within a service with exactly m arrivals so far. Time-stationary p0 and pK follow, so no PASTA assumption is needed on the MAP side.

This is not the transform solution of Theorem 1 of [1], which is stated in terms of a sequence R_m obeying R(z) = z*(A(z)-z*I)^{-1}. That sequence grows geometrically, at a rate set by the smallest zero of det(A(z)-z*I), while the quantity extracted from it stays O(s) as s -> 0+; cond(G(s)) therefore grows like that ratio^K and crosses the double-precision ceiling near K = 20 for the flows of [1] under gamma service with CV = 2, and near K = 10 under constant service, where A_0 = exp(D0*d) has entries O(1e-8). Reference [1] evaluates its formulae in arbitrary precision, so the restriction is invisible there. The embedded chain used here has every entry a probability or a time and is stable for any K and any F.

TEST (M/M/1/5, exact loss 0.04812030):

r=qsys_mapg1k(-2,2,struct(‘type’,’gamma’,’alpha’,1,’theta’,1/3),5); r.pK

References: [1] Chydzinski, A. Per-Flow Throughput of a FIFO Buffer. Applied System

Innovation 2026, 9, 112.

[2] Niu, Z.; Cooper, R.B. Transform-Free Analysis of M/G/1/K and Related

Queues. Mathematics of Operations Research 1993, 18, 486-510.

See also QSYS_MAPG1K_PERFLOW, QSYS_MAPG1, QSYS_MG1K_LOSS, QSYS_MMCK.

qsys_mapmapc(D0, D1, S0, S1, c, varargin)

QSYS_MAPMAPC Analyzes a MAP/MAP/c FCFS queue with a carried service phase.

RESULT = QSYS_MAPMAPC(D0, D1, S0, S1, C) analyzes a c-server FCFS queue with:

D0, D1 - arrival MAP of order ma S0, S1 - service MAP of order p, a CORRELATED (non-renewal) process C - number of identical servers

RESULT = QSYS_MAPMAPC(…, ‘maxNumComp’, N) caps the number of queue length probabilities returned (default 500). RESULT = QSYS_MAPMAPC(…, ‘numWMoms’, K) returns K waiting-time moments (default 3).

THE SERVICE LAW. The service MAP is ONE station-level process whose successive draws are chained in service-START order, idle periods included: each job starts in the phase the previous draw ENDED in. That is how JMT and both LDES engines sample a MAP service, and it is the law SolverCTMC follows through its pair form (solver_ctmc_mapc). A renewal reading of the marginal, which is what qsys_mapphc and the single-fast-server surrogate do, discards the autocorrelation of the service times.

THE STATE SPACE. With c > 1 servers a draw can start while earlier ones are still running, so its landing phase must be fixed when it starts. With V = (-S0)S1, a draw started in h lands in j with probability V(h,j); a busy server is a PAIR (i,j) of current phase i and landing j, run under S0 conditioned on ending in j. Each level holds the MULTISET of busy pairs and the landing phase h of the draw started last, which is where the next draw starts. LDQBD_MPHC(…, CARRY=true) builds those blocks; this function lifts them to a MAP arrival stream and solves the level-independent QBD above level c matrix-geometrically, exactly as QSYS_MAPPHC does for a renewal service. At C = 1 the chain is the frozen-phase MAP/MAP/1 queue.

Returns a struct with fields:

meanQueueLength - E[N], number in system meanWaitingTime - E[Wq], time in queue meanSojournTime - E[W] = E[Wq] + E[service] utilization - rho = lambda E[service] / c, per server queueLengthDist - P(N = n), n = 0, 1, … waitingTimeMoments - E[Wq^k], k = 1..numWMoms probWait - P(Wq > 0), an arrival finds every server busy phaseCount - configurations of a repeating level (pairs x landing) analyzer - name of the analyzer used

References

S. Asmussen and J.R. Moller, “Calculation of the steady state waiting time distribution in GI/PH/c and MAP/PH/c queues”, Queueing Systems 37(1):9-29, 2001. M. F. Neuts, “Matrix-geometric solutions in stochastic models”, Johns Hopkins University Press, 1981.

See also qsys_mapphc(), qsys_mmapmap1(), ldqbd_mphc(), solver_ctmc_mapc()

qsys_gigk_approx_whitt(lambda, mu, ca, cs, k)

[W,RHOHAT]=QSYS_GIGK_APPROX_WHITT(LAMBDA,MU,CA,CS,K)

GI/G/k approximation of Whitt (1993), eqs. (2.16)-(2.25):

Wq = phi(rho,ca^2,cs^2,k) * ((ca^2+cs^2)/2) * Wq(M/M/k)

where phi interpolates the Cosmetatos M/D/k (phi1) and D/M/k (phi3) correction factors. Exact for M/M/k; reduces to the Cosmetatos M/D/k approximation for cs=0. Implements eq. (2.25) as printed, which was validated here against the paper’s Tables 5-7 (New column).

Inputs:

LAMBDA - Arrival rate MU - Service rate per server CA - Coefficient of variation of inter-arrival time CS - Coefficient of variation of service time K - Number of servers

Returns:

W - Average time in system (response time) RHOHAT - Modified utilization (so that M/M/1 formulas still hold)

Reference: Whitt, W. (1993). Approximations for the GI/G/m queue. Production and Operations Management 2(2), 114-161.

qsys_mg1(lambda, mu, cs, varargin)

W=QSYS_MG1(LAMBDA,MU,CS)

[W, RHOHAT] = QSYS_MG1(LAMBDA, MU, CS) returns the Pollaczek-Khinchine mean response time of the M/G/1 queue with service rate MU and coefficient of variation CS, and RHOHAT = Q/(1+Q) with Q the mean number in system.

[W, RHOHAT, RES] = QSYS_MG1(…, ‘ES3’, ES3) also returns a struct with

meanQueueLength, meanQueueLengthQ, meanWaitingTime, meanSojournTime, probWait (rho), condMeanWaitingTime, throughput, utilization (rho), and, when the third raw service moment ES3 is given, varWaitingTime, varSojournTime, varQueueLength, varQueueLengthQ, analyzer.

References: J. Sztrik, Basic Queueing Theory, 2021, Table 14; I. Adan and J. Resing, Queueing Systems, 2015, Secs. 7.6-7.8.

qsys_mg1_setf(lambda, mu, cs)

QSYS_MG1_SETF Compute mean response time for M/G/1/SETF queue

[W, RHO] = QSYS_MG1_SETF(LAMBDA, MU, CS) computes the mean response time for each job class in an M/G/1 queue with SETF (Shortest Elapsed Time First) scheduling.

SETF is the non-preemptive version of FB/LAS (Feedback/Least Attained Service). Under SETF: - Jobs are ordered by their attained service (elapsed processing time) - The job with the least attained service has highest priority - However, once a job begins service, it runs to completion (non-preemptive)

The difference from FB/LAS is that arriving jobs with less attained service must wait until the currently serving job completes, rather than preempting it.

A job that waits under SETF has never been served (service is never interrupted), so every waiting job has attained service 0 and the ranking reduces to the tie break, arrival order. SETF on a single server is therefore FCFS, and the per-class mean response time is the exact M/G/1 Pollaczek-Khinchine value for any size law:

E[T_k]^SETF = lambda*E[X^2]/(2*(1-rho)) + E[S_k]

with E[X^2] = sum_i (lambda_i/lambda) (1+cs_i^2)/mu_i^2. This is also what SolverLDES simulates (attained-service comparator, FCFS tie break).

This function used to return E[T(x)]^FB + E[R]/(1-rho_x) evaluated at the single size x = 1/mu_k, which is neither a class mean nor SETF: on M/M/1 with lambda=1, mu=2 it gave 1.6033 against the exact 1/(mu-lambda) = 1.

Parameters:
  • lambda – Vector of arrival rates per class

  • mu – Vector of service rates per class

  • cs – Vector of coefficients of variation per class

Returns:

W – Vector of mean response times per class rho : Overall system utilization (modified for Little’s law)

References

  • M. Nuyens and A. Wierman, “The Foreground-Background queue: A survey”, Performance Evaluation, 2008.

  • A. Wierman and M. Harchol-Balter, “Classifying scheduling policies with respect to unfairness in an M/GI/1”, SIGMETRICS 2003.

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_mm1_transient(lambda, mu, n0, t, nmax, varargin)

[P, EN, P0, RES] = QSYS_MM1_TRANSIENT(LAMBDA, MU, N0, T, NMAX, ‘tol’, TOL, ‘method’, M)

Transient queue-length distribution of the M/M/1 queue started with N0 jobs: P(r, j+1) = P(N(T(r)) = j | N(0) = N0), j = 0..NMAX, the mean number in system EN(r) = E[N(T(r))] over ALL states, and the empty probability P0(r) = P(N(T(r)) = 0), for any load rho = LAMBDA/MU (< 1, = 1 or > 1).

NMAX may be omitted or [], in which case it is the smallest index beyond which the mass is <= TOL at every requested time. T is a vector of times >= 0 (T = 0 returns the initial condition exactly).

Methods (‘method’, default ‘auto’):
‘uniformization’ Jensen’s uniformization at rate LAMBDA+MU with the

closed form of the n-step probabilities of the uniformized chain (Rubino 2020, eqs. (4.1)-(4.6)),

(U^n)(i,j) = p^u q^v [C(n,v) - C(n,v-i-1)] + rho^j C_{n,i+j+1}, C_{n,m} = sum_{k=0}^{floor((n-m)/2)} (n+1-2k)/(n+1) C(n+1,k) p^k q^(n-k),

p = LAMBDA/(LAMBDA+MU), q = 1-p, u = (n+j-i)/2, v = (n-j+i)/2: the walk killed below 0 (reflection principle, eq. (4.4)) plus the walk from 0 (eqs. (4.1)-(4.2)) through the generating-function identity of Leguesdron et al. (1993) and reversibility (4.3). All terms are positive; with the Poisson weight each one is a product of two Poisson pmfs, summed in the log domain with Loader’s saddle-point pmf, so there is no cancellation, overflow or log-gamma rounding. The Poisson series is cut to a window [nL, nR] whose left-out mass is bounded rigorously (trimmed mass plus a Chernoff bound), so every probability has absolute truncation error <= RES.errBound (<= TOL) and the mean <= RES.errBoundMean (Rubino 2020 Secs. 2.2 and 4.1). Cost O(x^1.5), x = (LAMBDA+MU) T.

‘bessel’ the classical modified-Bessel form (Rubino 2020 eq. (3.3), with
the exponent of I_{j+1} corrected to (j-1)/2, here for any N0):
p_j(t) = e^{-(lambda+mu)t} [ rho^{(j-i)/2} I_{j-i}(z)
  • rho^{(j-i-1)/2} I_{j+i+1}(z)

  • (1-rho) rho^j sum_{k>=j+i+2} rho^{-k/2} I_k(z) ],

z = 2t sqrt(lambda mu), with exponentially scaled Bessel functions continued by a stable ratio recurrence where they underflow. Cost O(x). RES.errBound is the Chernoff bound on P(N(t) > J) for the state truncation J plus the computed mass defect (a-posteriori).

‘auto’ ‘uniformization’ when (LAMBDA+MU) T <= 1000, else ‘bessel’,

decided per time point.

Accuracy: against a 40-digit mpmath uniformization the absolute deviation is <= 1e-15 up to (LAMBDA+MU) T = 2200 and the relative one <= 1e-13 on every probability above 1e-12; the two methods agree to <= 4e-15 up to (LAMBDA+MU) T = 20000.

RES fields: rho, nmax, tol, method (cell, one per time), errBound, errBoundMean, tailMass (computed mass beyond NMAX), window ([nL nR] per time, NaN for ‘bessel’).

References: G. Rubino, “Transient analysis of Markovian queueing systems: a survey with focus on closed-forms and uniformization”, Advanced Trends in Queueing Theory 2, ISTE/Wiley, 2020; G. Rubino, A. Krinik, “The exponential-dual matrix method: applications to Markov chain analysis”, Contemp. Math. 774, AMS, 2021.

Python twin: line_solver.api.qsys.qsys_mm1_transient.

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_mmc_prio_eta(lambda, mu, c, r, v, q, d, type, method)

QSYS_MMC_PRIO_ETA Expected tardiness at arrival in a priority M/M/c queue.

[TARD, PTARD, S] = QSYS_MMC_PRIO_ETA(LAMBDA, MU, C, R, V, Q, D, TYPE, METHOD) returns the expected tardiness at arrival (ETA) E[(T - D)^+], the tardiness probability P(T > D) and the mean response time E[T] of a class-R order, conditional on the state it observes on arrival, in a multiclass M/M/C queue with common service rate MU, FCFS order within each class and static priorities, class 1 highest.

Inputs:
LAMBDA - per-class Poisson arrival rates, in priority order; only the

higher-priority rate sum(LAMBDA(1:R-1)) enters the result

MU - common service rate (scalar) C - number of servers (positive integer) R - class of the arriving order V - TYPE=’np’: total number of orders in the system on arrival

(the paper’s v0); TYPE=’pr’: number of class <= R orders in the system on arrival (the paper’s v_bar_i)

Q - TYPE=’np’ only: number of class <= R orders waiting in queue

on arrival (the paper’s q_bar_i), used when V >= C; ignored for TYPE=’pr’

D - quoted lead time, scalar or array; the outputs have its size TYPE - ‘np’ non-preemptive (default) or ‘pr’ preemptive resume METHOD - Laplace inversion method, see LAPLACE_INVERT (default ‘euler’)

Classes with no higher-priority traffic (R = 1, or a single class) use the closed form of Theorem 1: the response time is Exp(MU) plus an Erlang(K, C*MU) wait, evaluated as positive Poisson series. Otherwise the transform of Theorem 2 (TYPE=’np’) or of Theorem 4 and eq. (17) (TYPE=’pr’) is inverted numerically.

Reference: E. Hafizoglu, E.S. Gel, P. Keskinocak, Expected tardiness computations in multiclass priority M/M/c queues, INFORMS Journal on Computing 25(2):364-376, 2013.

See also QSYS_MMC_PRIO_TARDINESS, LAPLACE_INVERT

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_mtmstm_dets(mu, theta, s0, tk, dsk, nq, tau, policy, options)

[FC, INFO] = QSYS_MTMSTM_DETS(MU, THETA, S0, TK, DSK, NQ, TAU, POLICY, OPTIONS)

Waiting-time distribution of a customer who arrives at time 0 to the FCFS Mt/M/st+M queue (exponential service of rate MU, exponential patience of rate THETA, a staffing level that changes at known times) and finds all servers busy with NQ customers waiting ahead. This is DETS, the delay estimator under time-varying staffing of Konrad and Liu (WSC 2023).

The tagged customer’s position in the queue is a transient CTMC. Between two staffing changes it moves down at rate s*MU + q*THETA, and it is absorbed when the customer enters service. At a change it jumps by a matrix L(k), so

P(W > tau) = beta0 * prod_k exp(Q(k-1)(t_k - t_(k-1))) L(k) * exp(Q(K)(tau - t_K)) * e

(Theorem 1). Customers behind the tagged one never overtake it, so the result holds for any arrival process (Gt) as well.

POLICY says what happens to a busy server whose shift ends:

‘pe’ preemptive: its customer goes back to the head of the queue ‘ec’ exhaustive completion: it finishes its customer first and serves

nobody else

‘eh’ exhaustive handoff: it keeps its customer until a staying server

frees up and takes the customer over, which needs a second state variable, the number r of servers still waiting to leave

A server joining under ‘eh’ first takes over a leaving server’s customer. The three policies agree when the staffing only increases. PE and EH agree when MU = THETA.

The change at TK(k) is applied at tau = TK(k) itself, so FC is the right- continuous P(W > tau). A server added at TK(k) can admit the tagged customer exactly at that time, so the distribution has an atom there. The paper’s Theorem 1 applies only the changes strictly before tau, which gives the left limit P(W >= tau) at the change points and the same values everywhere else.

Input:

MU - service rate (> 0) THETA - abandonment rate of a waiting customer (>= 0) S0 - number of servers at time 0 (integer >= 0) TK - staffing change times, strictly increasing and > 0, measured from

the tagged customer’s arrival ([] for constant staffing, which is the myopic predictor of the paper)

DSK - net change at each TK (signed integers), or a K-by-2 matrix

[added, removed] when servers join and leave at the same time. The two forms differ only under ‘ec’ (Remark 2): a joining server takes a customer from the queue, and a leaving one only lowers the service rate.

NQ - customers waiting ahead of the tagged customer (integer >= 0);

the S0 servers are all busy

TAU - vector of waiting-time targets (>= 0) POLICY - ‘pe’, ‘ec’ or ‘eh’ OPTIONS - struct with field

wait ‘pwt’ (default) for the potential waiting time, the time an

infinitely patient customer would wait, or ‘awt’ for the actual waiting time min(W, patience) (Remark 1)

Output:

FC - column vector, P(W > tau) at each entry of TAU INFO - struct with fields cdf (1 - FC), meanPWT = E[W], meanAWT =

E[min(W, A)], poa = THETA*meanAWT (probability of abandonment), and s, the staffing level after each change. meanPWT is Inf when the final staffing is 0 and THETA = 0.

Example (decreasing staffing, mu = 3, theta = 1, as in Section 4.1):

Fc = qsys_mtmstm_dets(3, 1, 10, 0.1:0.1:0.5, -ones(1,5), 15, 0:0.05:2, ‘eh’);

Reference: K. Konrad, Y. Liu, “Real-time estimations for the waiting-time distribution in time-varying queues”, Proc. Winter Simulation Conference 2023, 315-326.

See also QSYS_GTMTST_FLUID.

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_mmc_prio_tardiness(lambda, mu, c, d, type, method)

QSYS_MMC_PRIO_TARDINESS Exact expected tardiness in a priority M/M/c queue.

[TARD, PTARD, RES] = QSYS_MMC_PRIO_TARDINESS(LAMBDA, MU, C, D, TYPE, METHOD) returns, per class, the stationary expected tardiness E[(T_i - D_i)^+] and the tardiness probability P(T_i > D_i) of the response time T_i of a multiclass M/M/C queue with a common exponential service rate MU, FCFS order within each class and static priorities, class 1 highest.

Inputs:

LAMBDA - per-class Poisson arrival rates, in priority order MU - common service rate (scalar) C - number of servers (positive integer) D - due date (quoted lead time), scalar or one per class; Inf

means no due date and gives zero tardiness

TYPE - ‘np’ head-of-line non-preemptive (default) or ‘pr’ preemptive

resume, where an arrival preempts the lowest-priority job in service and the preempted job rejoins the head of its class

METHOD - numerical Laplace inversion: ‘euler’ (default), ‘talbot’,

‘gaver-stehfest’, ‘cme’ or ‘weeks’, see LAPLACE_INVERT

Outputs:

TARD - per-class expected tardiness (column) PTARD - per-class tardiness probability P(T_i > D_i) (column) RES - struct with meanSojournTime, tardiness, probTardy, dueDate,

type, method, analyzer

Method. Following Hafizoglu, Gel and Keskinocak (2013), the response time of a class-i order that finds all servers busy is the service time plus q+1 busy periods of an M/M/1 queue with arrival rate LAMBDA_BAR (the higher-priority rate) and service rate C*MU, with LST

g(s) = 2 C MU / (s + a + sqrt((s+a)^2 - 4 LAMBDA_BAR C MU)),

a = LAMBDA_BAR + C MU (Theorem 2); under preemption the in-service states solve the tridiagonal system of Theorem 4. Mixing these state-conditional transforms over the stationary state seen by a Poisson arrival gives:

NP: q is geometric with ratio SIGMA_i = sum_{j<=i} LAMBDA_j/(C MU) given

all servers busy, which happens with the Erlang C probability, so f_i(s) = MU/(s+MU) (1 - P_C + P_C (1-SIGMA_i) g(s)/(1 - SIGMA_i g(s)));

PR: the class <= i jobs form an M/M/C queue with rate sum_{j<=i} LAMBDA_j

and the transform is the mixture of the Theorem 4 / eq. (17) transforms over its stationary distribution.

Tardiness and its probability are the inverses at D of (s E[T] - 1 + f(s))/s^2 and (1 - f(s))/s. The top class (and any class with no higher-priority traffic) uses the closed form of the hypo- exponential response time. Mean response times equal QSYS_MMC_PRIO for TYPE=’np’.

Reference: E. Hafizoglu, E.S. Gel, P. Keskinocak, Expected tardiness computations in multiclass priority M/M/c queues, INFORMS Journal on Computing 25(2):364-376, 2013.

See also QSYS_MMC_PRIO_ETA, QSYS_MMC_PRIO, LAPLACE_INVERT

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_mmapgk1_lcfspr(MMAP, svc, varargin)

QSYS_MMAPGK1_LCFSPR Matrix product-form solution of the MMAP[K]/G[K]/1 LCFS-PR queue.

RESULT = QSYS_MMAPGK1_LCFSPR(MMAP, SVC) analyzes a single-server queue with preemptive-resume last-come-first-served service, where:

MMAP - cell {D0, D1, D^(1), …, D^(K)}: a marked Markovian arrival process

of order ma whose type-k arrivals carry the block D^(k)

SVC - cell of K service laws, one per type, in any form QSYS_MMAPGK1

accepts: a LINE Distribution object, a cell {D0s, D1s} holding a phase-type representation, or a struct with fields .lst (function handle s -> E[exp(-s S)], admitting COMPLEX s) and .moments (raw moments, at least the mean). The laws may be GENERAL.

RESULT = QSYS_MMAPGK1_LCFSPR(…, ‘nMax’, N) also returns the distribution of the total and of each per-class number in system on 0..N. RESULT = QSYS_MMAPGK1_LCFSPR(…, ‘wPoints’, T) also evaluates the per-class sojourn time CDF at the times T by numerical transform inversion. RESULT = QSYS_MMAPGK1_LCFSPR(…, ‘quadNodes’, Q) sets the quadrature order for a service law with no closed-form matrix transform (default 120).

THE METHOD, Takine (2002). With C = D0, D_k = D^(k) and F_k the service law of type k, let Q be the minimal solution of

Q = C + sum_k D_k F_k(Q), F_k(Q) = int_0^inf exp(Qx) dF_k(x),

the generator of the arrival phase with the busy periods excised (the same matrix as He’s U in QSYS_MMAPGK1), and kappa its stationary vector. With beta_k = D_k e E[S_k], Takine’s Theorem 1 gives the rate matrices

R_k = (beta_k kappa + D_k (I - F_k(Q))) (e kappa - Q)^-1, R = sum_k R_k,

and the joint distribution of the per-class numbers in system has the matrix product form y(n) = sum_k y(n - e_k) R_k, y(0) = (1 - rho) kappa. From it:

P(N = n) = (1 - rho) kappa R^n e, P(Y_k = m) = (1 - rho) kappa (A_k R_k)^m A_k e, A_k = (I - R + R_k)^-1, E[Y_k] = pi R_k (I - R)^-1 e,

with pi the stationary vector of C + D. A type-k sojourn under LCFS-PR is the sub-busy period its own service generates, so its transform is

E[exp(-s W_k)] = pi D_k F_k(Q*(s)) e / lambda_k, Q*(s) = C - sI + sum_j D_j F_j(Q*(s)),

evaluated at complex s for the CDF by Euler inversion.

Returns a struct with fields:

lambda - per-type arrival rates (1 x K) arrivalRate - total arrival rate utilization - rho = sum_k lambda_k E[S_k] Q - the matrix Q above (ma x ma) kappa - stationary vector of Q (1 x ma) Rk - cell of the K rate matrices R_k R - sum of the R_k classMeanQueueLength - E[Y_k], per-type mean number in system (1 x K) meanQueueLength - E[N], total mean number in system meanSojournTime - E[W_k], per-type mean sojourn time (1 x K) queueLengthDistr - P(N = n), n = 0..nMax (1 x nMax+1), if requested classQueueLengthDistr - P(Y_k = m), m = 0..nMax (K x nMax+1), if requested respLST - function handle s -> row vector of E[exp(-s W_k)] respCDF - (K x numel(wPoints)) per-type sojourn time CDF respPoints - the requested points analyzer - name of the analyzer used

Reference:

T. Takine, “Matrix product-form solution for an LCFS-PR single-server queue with multiple arrival streams governed by a Markov chain”, Queueing Systems 42:131-151, 2002.

See also qsys_mmapgk1()

qsys_fcfs_alis(lambda, mu, compat)

[Q, QW, X, U, P0, STABLE] = QSYS_FCFS_ALIS(LAMBDA, MU, COMPAT)

Exact steady-state means of an isolated FCFS parallel-server system with job-server compatibilities under Assign Longest Idle Server (ALIS): C job classes arrive as Poisson streams at rates LAMBDA, M servers serve at rates MU that depend on the server only (exponential, noncollaborative: one server per job), a class-c job may only be served by the servers m with COMPAT(c,m) true, a server that frees up takes the OLDEST waiting job it is compatible with, and an arriving job that finds compatible idle servers starts on the one that has been idle longest.

PRODUCT FORM. With the partially aggregated state of Adan and Weiss (Gardner, Righter 2020, Thm 5.2): the idle servers s in the order they became idle, the busy servers b in the arrival order of the jobs they serve, and n_j the number of waiting jobs between the j-th and (j+1)-th job in service,

pi(s, b, n) = G * prod_j alpha_j^{n_j} / mu(b_1..b_j) * prod_j 1/lambda(C(s_1..s_j)),

alpha_j = lambda(R(b_1..b_j)) / mu(b_1..b_j), where R(B) are the classes whose compatible servers all lie in B and C(S) the classes compatible with some server of S. Given (s, b) the n_j are independent geometric, and each job of segment j is class c in R(b_1..b_j) with probability lambda_c / lambda(R(b_1..b_j)), which gives the mean waiting counts QW.

PER-CLASS MEANS. The classes of the jobs in service are not part of that state, so the in-service means come from the matching rates X(c,m), the rate at which class-c jobs start service at server m:

  • a completion at b_j hands the server to the first waiting job it is compatible with, which lies in a segment i >= j; scanning those segments in order, segment i holds none with probability (1 - alpha_i) / (1 - alpha_i q_i), q_i the probability that one of its jobs is incompatible with b_j;

  • an arrival of class c that finds compatible idle servers starts at the first of them in s.

Then E[in service, class c] = sum_m X(c,m) / mu_m and Q = QW plus that. sum_m X(c,m) = lambda_c is flow conservation and holds to rounding.

The system is exact only IN ISOLATION: unlike the collaborative pool (an OI queue, see PFQN_OI_OPEN), the noncollaborative ALIS pool has no balance function independent of lambda, so it does not compose into a product-form network. Note also that this is the textbook ALIS of the literature, which orders individual SERVERS by idle time; it is NOT HeteroSchedPolicy.ALIS, which rotates a global order of server POOLS on assignment, so this function is not used by any solver route.

Cost: one visit per ordered busy set and per ordered idle set, about e * M! of each, so M is limited to 9 servers with traffic.

Parameters:
  • lambda - (1 x C) arrival rates (>= 0)

  • mu - (1 x M) server rates (> 0)

  • compat - (C x M)

  • A class with lambda_c = 0 and a server no class with traffic can use are

  • left out (the server stays idle)

Returns:

Q - (1 x C) mean number of class-c jobs in the system. Qw - (1 x C) mean number of class-c jobs waiting (not in service). X - (C x M) matching rates: class-c service starts per unit time at

server m.

U - (1 x M) probability that server m is busy. P0 - probability that the system is empty. stable - false when lambda(A) >= mu(S(A)) for some class subset A; then

Q, Qw are Inf and X, U, P0 are NaN.

References

Adan, Weiss (2014). A skill based parallel service system under FCFS-ALIS: steady state, overloads, and abandonments. Stochastic Systems 4(1):250-299. Gardner, Righter (2020). Product forms for FCFS queueing models with arbitrary server-job compatibilities: an overview. Queueing Systems 96:3-51, Sec. 3.2 and 5.1.

See also PFQN_OI_OPEN, SN_COMPAT_RATE.

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_oi_loss(lambda, mu, K, Kr)

[Q, USIR, B, XADM, P0] = QSYS_OI_LOSS(LAMBDA, MU, K, KR)

Exact steady state of an order-independent (OI) LOSS queue: Poisson arrivals of R classes at rates LAMBDA, a permutation-invariant total service rate MU(n) of the per-class count vector, at most K jobs in total and at most KR(r) of class r; an arrival that would breach a limit is lost.

Truncating an OI queue destroys quasi-reversibility but not the product form of the truncated chain: the stationary law is the unrestricted OI law renormalized over the admissible set A = {n : sum(n) <= K, n <= KR} (Berezner, Kriel, Krzesinski 1995, Sec. 6, total limit; Berezner and Krzesinski 1996, per-type limits). The renormalization holds on any set closed under removing the last arrival, which the partial balance mu(n) k(c) pi(c) = lambda_{c_n} pi(c_1..c_{n-1}) needs, and the box above is such a set. With g(n) = Phi(n) prod_r lambda_r^{n_r},

g(0) = 1, g(n) = (1/mu(n)) sum_{r: n_r>0} lambda_r g(n - e_r), n in A,

and by PASTA the class-r blocking probability is the mass of the states in which a class-r arrival is refused, B_r = P(sum(n) = K or n_r = KR(r)). The in-service means use the weight Xi_r of PFQN_OI_INSVC on the same set. The queue is exact only IN ISOLATION: a loss OI queue is not quasi-reversible, so it does not compose into a product-form network.

Parameters:
  • lambda - (1 x R) arrival rates (>= 0)

  • mu - function handle mu (n) on the per-class count vector (1 x R)

  • K - total limit (Inf for none)

  • Kr - (1 x R) per-class limits (Inf for none)

  • At least one limit must make A finite for every class with lambda_r > 0.

Returns:

Q - (1 x R) mean number of class-r jobs. Usir - (1 x R) mean number of class-r jobs in service. B - (1 x R) blocking (loss) probability seen by a class-r arrival. Xadm - (1 x R) admitted throughput lambda_r (1 - B_r). P0 - probability of the empty station.

References

Berezner, Kriel, Krzesinski (1995). Queueing Systems 19:345-359, Sec. 6. Berezner, Krzesinski (1996). Order independent loss queues. Queueing Systems 23:331-335.

See also PFQN_OI_OPEN, PFQN_OI_INSVC.

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_mm11_retrial(lambda, mu, nu, policy, nmax)

[P0, P1, N, NORB] = QSYS_MM11_RETRIAL(LAMBDA, MU, NU, POLICY, NMAX)

Exact stationary distribution of the M/M/1/1 retrial queue: Poisson arrivals of rate LAMBDA, one exponential server of rate MU, no waiting room, and exponential retrials from an unbounded orbit.

P0(n+1) is the probability that the server is idle with n customers in orbit, P1(n+1) that it is busy with n in orbit, for n = 0..NMAX (default: the smallest NMAX leaving a tail mass below 1e-12). N and NORB are the exact means (not truncated).

POLICY = RetrialPolicy.LINEAR (default): the orbit retries at rate n*NU. With rho = LAMBDA/MU and a = LAMBDA/NU (Falin and Templeton 1997, Sec. 1.2),

sum_n P0(n+1) z^n = (1-rho)^(a+1) (1-rho*z)^(-a), sum_n P1(n+1) z^n = rho (1-rho)^(a+1) (1-rho*z)^(-a-1),

so given the server state the orbit size is negative binomial.

POLICY = RetrialPolicy.CONSTANT: the orbit retries at rate NU when it is not empty. The cut between levels n and n+1 gives LAMBDA*P1(n+1) = NU*P0(n+2), and with the balance of (0,n) the levels decay geometrically with ratio r = LAMBDA*(LAMBDA+NU)/(MU*NU) (Fayolle 1986):

P1(n+1) = rho r^n P0(1), n >= 0, P0(n+1) = LAMBDA/(LAMBDA+NU) r^n P0(1), n >= 1,

stable iff r < 1, i.e. rho < NU/(LAMBDA+NU).

References

G. I. Falin and J. G. C. Templeton, Retrial Queues, Chapman & Hall, 1997. G. Fayolle, A simple telephone exchange with delayed feedbacks, in Teletraffic Analysis and Computer Performance Evaluation, 1986. T. Phung-Duc, Retrial queueing models: a survey on theory and applications, arXiv:1906.09560, 2019.

qsys_mg11_retrial_ht(lambda, mu, cs, nu, policy)

[SHAPE, SCALE, MEANORB, VARORB] = QSYS_MG11_RETRIAL_HT(LAMBDA, MU, CS, NU, POLICY)

Heavy-traffic approximation of the orbit size of the M/G/1/1 retrial queue (service rate MU, squared coefficient of variation CS^2, retrial rate NU): the number in orbit is approximately Gamma(SHAPE, SCALE).

POLICY = RetrialPolicy.LINEAR (default). Falin (Falin and Templeton 1997, Sec. 3.7; Phung-Duc 2019, Sec. 3.1): as rho -> 1, (1-rho)*Norb converges in distribution to a Gamma law with scale lambda^2*b2/2 and shape 1 + 2/(NU*lambda*b2), b2 the second moment of the service time. The approximation used here keeps that scale over (1-rho) and takes the shape 1 + 2*rho/(NU*lambda*b2), which has the same limit and reproduces the exact mean of qsys_mg11_retrial at every rho < 1.

POLICY = RetrialPolicy.CONSTANT. The number in system at departures is a reflected random walk whose drift rho - NU/(lambda+NU) tends to 0, so the scaled orbit size tends to an exponential law: SHAPE = 1 and SCALE equal to the exact mean orbit size.

OUTPUT:

shape, scale : Gamma parameters (mean shape*scale, variance shape*scale^2) meanOrb : shape*scale varOrb : shape*scale^2

References

G. I. Falin and J. G. C. Templeton, Retrial Queues, Chapman & Hall, 1997. T. Phung-Duc, Retrial queueing models: a survey on theory and applications, arXiv:1906.09560, 2019.

qsys_retrial_isstable(lambda, mu, c, alpha, policy, p, q, gamma, maxOrbit)

[ISSTABLE, MARGIN, REASON] = QSYS_RETRIAL_ISSTABLE(LAMBDA, MU, C, ALPHA, POLICY, P, Q, GAMMA, MAXORBIT)

Stability (positive recurrence) of the M/M/c/c retrial queue with Poisson arrivals of rate LAMBDA, C exponential servers of rate MU and exponential retrials. LAMBDA and MU may be vectors, one entry per class.

INPUT:

lambda : arrival rate(s) mu : service rate(s) per server c : number of servers (no waiting room) alpha : retrial rate(s); per orbiting customer under LINEAR, of the

whole orbit under CONSTANT

policy : RetrialPolicy.LINEAR (default) or RetrialPolicy.CONSTANT p : prob. that a blocked fresh customer joins the orbit (default 1) q : prob. that a blocked retrial customer stays in the orbit (default 1) gamma : orbit abandonment rate per orbiting customer (default 0) maxOrbit : orbit capacity, -1 or Inf for unbounded (default -1)

OUTPUT:

isStable : true when the orbit size is positive recurrent margin : slack of the condition (positive iff stable; Inf when the

orbit cannot grow without bound)

reason : the condition applied, as text

CONDITIONS:

A finite orbit, gamma > 0, or q < 1 under LINEAR always gives a stable chain: the orbit then loses customers at a rate that grows with its size. LINEAR with q = 1 and gamma = 0: the servers saturate as the orbit grows, so the queue is stable iff sum_k lambda_k*p_k/mu_k < c (Falin and Templeton 1997, Sec. 2.1 for p = 1). CONSTANT, single class, gamma = 0: with a large orbit the busy servers form an Erlang loss system of offered load (lambda+alpha)/mu, so with x = B((lambda+alpha)/mu, c) the orbit drift is negative iff

lambda*p*x < alpha*(1-x) + alpha*(1-q)*x,

which for c = 1, p = q = 1 is Fayolle’s lambda/mu < alpha/(lambda+alpha) (Artalejo, Gomez-Corral and Neuts 2001 for p = q = 1).

A multiclass queue under CONSTANT retrial, or with some classes self- limiting and others not, has no known necessary-and-sufficient condition and is refused.

References

G. I. Falin and J. G. C. Templeton, Retrial Queues, Chapman & Hall, 1997. J. R. Artalejo, A. Gomez-Corral and M. F. Neuts, Analysis of multiserver queues with constant retrial rate, EJOR 135 (2001) 569-581. T. Phung-Duc, Retrial queueing models: a survey on theory and applications, arXiv:1906.09560, 2019.

qsys_mh21(lambda, p1, mu1, mu2, varargin)

QSYS_MH21 Exact analysis of the M/H2/1 queue.

RESULT = QSYS_MH21(LAMBDA, P1, MU1, MU2) analyzes Poisson arrivals of rate LAMBDA and hyperexponential service: rate MU1 with probability P1, rate MU2 with probability P2 = 1-P1, rho = LAMBDA (P1/MU1 + P2/MU2) < 1. With a_i = LAMBDA/MU_i and z_1, z_2 the roots of

a_1 a_2 z^2 - (a_1 + a_2 + a_1 a_2) z + 1 + a_1 + a_2 - rho = 0, C_1 = (z_1-1)(1-rho z_2)/(z_1-z_2), C_2 = (z_2-1)(1-rho z_1)/(z_2-z_1),

P_n = C_1 z_1^-n + C_2 z_2^-n and P(T > t) = pi_a exp(-mu_a t) + pi_b exp(-mu_b t) with pi_a = C_1 z_1/(z_1-1), mu_a = LAMBDA (z_1-1) (and likewise for b). The waiting time has P(W > t) = w_a exp(-mu_a t) + w_b exp(-mu_b t), with weights from the residues of the Pollaczek-Khinchine transform. Moments follow from the M/G/1 formulas with E[S^n] = n! (P1/MU1^n + P2/MU2^n).

Options:

‘tPoints’, T - waiting and sojourn time CDFs at T ‘percentiles’, P - percentiles of W and T (P in percent) ‘nmax’, NMAX - length of queueLengthDist (default: tail below 1e-14)

Returns a struct with the fields of QSYS_MD1 plus roots ([z_1 z_2]), sojournRates ([mu_a mu_b]), sojournWeights ([pi_a pi_b]), waitingWeights, and the CDF and percentile fields of QSYS_MER1.

Reference: J. Sztrik, Basic Queueing Theory, Univ. of Debrecen, 2021, Table 15.

See also QSYS_MG1, QSYS_MER1, QSYS_MD1

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_mer1(lambda, mu, r, varargin)

QSYS_MER1 Exact analysis of the M/E_r/1 queue by the method of phases.

RESULT = QSYS_MER1(LAMBDA, MU, R) analyzes Poisson arrivals of rate LAMBDA and Erlang-R service with phase rate MU (E[S] = R/MU, rho = LAMBDA R/MU < 1). The number of phases of work in the system has

p_n = sum_{k=1}^{R} c_k x_k^n, c_k = (1-rho)/prod_{j~=k} (1 - x_j/x_k),

where x_1..x_R are the R roots with |x| < 1 of MU x^(R+1) - (LAMBDA+MU) x^R + LAMBDA = 0. The number of customers is q_0 = p_0, q_i = sum_{n=(i-1)R+1}^{iR} p_n. Under FCFS the waiting time is the work found, so

P(W > t) = sum_k c_k x_k/(1-x_k) exp(-MU (1-x_k) t),

and T = W + S has P(T > t) = sum_n p_n Q(n+R-1; MU t). Moments follow from the Pollaczek-Khinchine formulas with E[S^k] = R(R+1)…(R+k-1)/MU^k.

Options:

‘tPoints’, T - waiting and sojourn time CDFs at T ‘percentiles’, P - percentiles of W and T (P in percent) ‘nmax’, NMAX - number of customer levels in queueLengthDist

(default: until the remaining mass is below 1e-14)

Returns a struct with fields:

meanQueueLength, varQueueLength, meanQueueLengthQ, varQueueLengthQ, meanWaitingTime, varWaitingTime, meanSojournTime, varSojournTime, probWait, condMeanWaitingTime, throughput, utilization, queueLengthDist ([q_0 …]), phaseDist ([p_0 …]), roots, coeffs, tPoints/waitingTimeCdf/sojournTimeCdf, percentiles/ waitingTimePercentile/sojournTimePercentile, analyzer

Reference: I. Adan and J. Resing, Queueing Systems, TU Eindhoven, 2015, Ch. 6.

See also QSYS_MG1, QSYS_MD1, QSYS_MH21

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_md1(lambda, mu, varargin)

QSYS_MD1 Exact analysis of the M/D/1 queue.

RESULT = QSYS_MD1(LAMBDA, MU) analyzes Poisson arrivals of rate LAMBDA and a constant service time 1/MU, rho = LAMBDA/MU < 1. The moments follow from the Pollaczek-Khinchine formulas with E[S^k] = MU^-k:

E[W] = rho/(2 MU (1-rho)), E[W^2] = 2 E[W]^2 + rho/(3 MU^2 (1-rho)), E[Q] = rho^2/(2(1-rho)), E[N] = E[Q] + rho, Var(T) = Var(W).

The queue-length law is computed with the level-crossing recursion of the embedded chain, which avoids the alternating closed form:

P_0 = 1 - rho, P_n a_0 = P_0 Abar_{n-1} + sum_{j=1}^{n-1} P_j Abar_{n-j},

with a_i = exp(-rho) rho^i/i! and Abar_k = sum_{i>k} a_i.

Options:
‘nmax’, NMAX - length of queueLengthDist (default: until the remaining

mass is below 1e-14, at most 100000 terms)

Returns a struct with fields:

meanQueueLength, varQueueLength, meanQueueLengthQ, varQueueLengthQ, meanWaitingTime, varWaitingTime, meanSojournTime, varSojournTime, probWait (rho), condMeanWaitingTime, throughput, utilization, queueLengthDist ([P_0 …]), analyzer

References

J. Sztrik, Basic Queueing Theory, Univ. of Debrecen, 2021, Table 18. M. Zukerman, Introduction to Queueing Theory and Stochastic Teletraffic Models, arXiv:1307.2968, 2025, Sec. 16.3.

See also QSYS_MG1, QSYS_MER1, QSYS_MH21

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_mg1_busy(lambda, mu, cs, varargin)

QSYS_MG1_BUSY Busy-period analysis of the M/G/1 queue.

RES = QSYS_MG1_BUSY(LAMBDA, MU, CS) returns the moments of the busy period BP of an M/G/1 queue with Poisson arrivals (rate LAMBDA) and service rate MU, coefficient of variation CS, rho = LAMBDA/MU < 1 (Takacs):

E[BP] = E[S]/(1-rho), E[BP^2] = E[S^2]/(1-rho)^3, E[BP^3] = E[S^3]/(1-rho)^4 + 3 LAMBDA E[S^2]^2/(1-rho)^5,

the number of customers served in a busy period, with mean 1/(1-rho) and variance (rho(1-rho) + LAMBDA^2 E[S^2])/(1-rho)^3, and the idle period, exponential with mean 1/LAMBDA.

Options:

‘ES3’, ES3 - third raw service moment, for E[BP^3] ‘lst’, LST - service LST handle LST(s) = E[exp(-s S)]; with ‘sPoints’, S - points s >= 0 where the busy-period LST

BP*(s) = LST(s + LAMBDA - LAMBDA BP*(s)) is evaluated by fixed-point iteration (a contraction on [0,1])

RES fields: meanBusyPeriod, varBusyPeriod, thirdMomentBusyPeriod (with ‘ES3’), meanServed, varServed, meanIdlePeriod, busyFraction (rho), busyPeriodRate (LAMBDA (1-rho), busy periods per unit time), sPoints and busyPeriodLst (with ‘lst’ and ‘sPoints’), analyzer.

References

L. Takacs, Introduction to the Theory of Queues, Oxford Univ. Press, 1962. I. Adan and J. Resing, Queueing Systems, TU Eindhoven, 2015, Sec. 7.9.

See also QSYS_MG1, QSYS_MM1

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_mg1_sjf(lambda, mu, cs)

QSYS_MG1_SJF Mean response times of the M/G/1 queue with non-preemptive shortest job first.

[W, RHO] = QSYS_MG1_SJF(LAMBDA, MU, CS) computes the per-class mean response time of an M/G/1 queue with non-preemptive shortest processing time first (SPT/SJF): when the server frees up it starts the waiting job with the smallest service requirement, which is known on arrival. For a job of size x (Phipps 1956; Adan-Resing Sec. 9.3),

E[W(x)] = (LAMBDA E[S^2]/2) / (1 - rho(x))^2, rho(x) = LAMBDA int_0^x t f(t) dt,

with f the overall (mixture) job-size density. The per-class mean is E[T_r] = int_0^inf E[W(x)] f_r(x) dx + 1/MU_r, which is exact because the waiting time depends only on the job size. The integrals use cumulative trapezoidal quadrature on a common grid.

Each class has a job-size distribution matched to (mean 1/MU_r, scv CS_r^2): exponential when CS_r = 1, a balanced two-phase hyperexponential when CS_r > 1 and a Tijms mixture of Erlang-(k-1)/Erlang-k when CS_r < 1, as in QSYS_MG1_SRPT. E[S^2] uses the exact class moments.

Outputs:

W - per-class mean response times (column, original class order) RHO - Q/(1+Q) with Q = sum(LAMBDA.*W) (qsys convention) RES - struct with meanSojournTime, meanWaitingTime, meanQueueLength

(per class), utilization, conservationResidual (the size-weighted work LAMBDA int x f(x) E[W(x)] dx minus the Kleinrock invariant rho LAMBDA E[S^2]/(2(1-rho)); zero up to quadrature error), analyzer

References

T. E. Phipps, Machine repair as a priority waiting-line problem, Operations Research 4(1):76-85, 1956. I. Adan and J. Resing, Queueing Systems, TU Eindhoven, 2015, Sec. 9.3.

See also QSYS_MG1_SRPT, QSYS_MG1_PRIO, QSYS_MG1_CONSERVATION

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_mmc_prio(lambda, mu, c)

QSYS_MMC_PRIO Exact analysis of the M/M/c queue with non-preemptive priorities.

[W, RHO] = QSYS_MMC_PRIO(LAMBDA, MU, C) returns the per-class mean response times of an M/M/C queue with head-of-line (non-preemptive) priorities, class 1 highest, and a common exponential service rate MU for all classes. With A = sum(LAMBDA)/MU < C and Erlang C probability C(C,A),

E[W_i] = (C(C,A)/(C MU)) / ((1 - sum_{j<i} LAMBDA_j/(C MU)) (1 - sum_{j<=i} LAMBDA_j/(C MU))), E[T_i] = E[W_i] + 1/MU.

Outputs:

W - per-class mean response times (column) RHO - Q/(1+Q) with Q = sum(LAMBDA.*W), as in QSYS_MG1_PRIO RES - struct with meanSojournTime, meanWaitingTime, meanQueueLength

(per class), probWait (C(C,A)), utilization (A/C), analyzer

Reference: J. Sztrik, Basic Queueing Theory, Univ. of Debrecen, 2021, Table 27.

See also QSYS_MG1_PRIO, QSYS_MMK

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_ddckk(EO, ES, c, K)

QSYS_DDCKK Exact analysis of the deterministic finite-source D/D/c/K/K queue.

RESULT = QSYS_DDCKK(EO, ES, C, K) analyzes K sources, each operating for a constant time EO before requesting service, and C servers with constant service time ES, C <= K. With z = EO/ES, after the transient the system settles in a periodic regime with per-server utilization

a = min(1, K/(C (1 + z))),

throughput X = C a / ES, cycle time E[T] = K/X - EO, waiting time E[W] = E[T] - ES, mean number at the facility E[N] = X E[T] and mean number waiting E[Q] = X E[W] (Little’s law).

Returns a struct with fields:

meanQueueLength, meanQueueLengthQ, meanWaitingTime, meanSojournTime, throughput, utilization, meanOperating, analyzer

Example

r = qsys_ddckk(4, 1, 2, 12);

Reference:
  1. Sztrik, Basic Queueing Theory, Univ. of Debrecen, 2021, Sec. 3.8.

See also QSYS_MMCKK, QSYS_MG1KK

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_engset(alpha, mu, c, K)

QSYS_ENGSET Exact analysis of the Engset loss system M/G/c/c/K.

RESULT = QSYS_ENGSET(ALPHA, MU, C, K) analyzes K sources, each idle for an exponential time of rate ALPHA before offering a request, and C servers with no waiting room, mean service time 1/MU, C <= K. A request finding all C servers busy is lost and its source starts a new idle period. With BETA = ALPHA/MU the offered load per idle source,

P_n[K] = binom(K,n) BETA^n / sum_{k=0}^{C} binom(K,k) BETA^k, n = 0..C.

The time congestion is P_C[K]; by the arrival theorem a request sees the system with K-1 sources, so the call (Engset) congestion is P_C[K-1]. The result is insensitive to the service-time distribution beyond its mean.

Returns a struct with fields:

timeCongestion - P_C[K], fraction of time all servers are busy callCongestion - P_C[K-1], probability a request is lost offeredRate - ALPHA*(K - E[N]), request rate throughput - carried rate, MU*E[N] = offeredRate*(1 - callCongestion) meanBusyServers - E[N] varBusyServers - Var(N) utilization - E[N]/C meanSojournTime - 1/MU (carried requests are served at once) queueLengthDist - [P_0 … P_C] analyzer - identifier string

Example

r = qsys_engset(0.2, 1, 3, 10);

References

T. O. Engset, Die Wahrscheinlichkeitsrechnung zur Bestimmung der Waehlerzahl in automatischen Fernsprechaemtern, Elektrotechnische Zeitschrift 39(31), 1918. J. Sztrik, Basic Queueing Theory, Univ. of Debrecen, 2021, Sec. 3.1.

See also QSYS_MMCC, QSYS_MMCKK, LOSSN_ERLANGFP

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_mgc_ps(lambda, mu, c)

QSYS_MGC_PS Exact analysis of the M/G/c processor-sharing queue.

RESULT = QSYS_MGC_PS(LAMBDA, MU, C) analyzes Poisson arrivals of rate LAMBDA, mean service requirement 1/MU and C servers shared by the N jobs present: each job is served at rate MU when N <= C and at rate C*MU/N otherwise. The number of jobs is insensitive to the service distribution beyond its mean and has the M/M/C law

P_n = P_0 A^n/n! (n <= C), P_n = P_0 A^n/(C! C^(n-C)) (n > C),

with A = LAMBDA/MU and stability A < C. The mean response time follows by Little’s law, E[T] = E[N]/LAMBDA.

Returns a struct with fields:

meanQueueLength, varQueueLength, meanSojournTime, throughput, utilization (A/C), queueLengthDist (P_0..P_nmax with tail mass below 1e-14), tailRatio (P_{n+1}/P_n = A/C for n >= C), analyzer

Reference: J. Sztrik, Basic Queueing Theory, Univ. of Debrecen, 2021, Table 26.

See also QSYS_MMK, QSYS_MG1

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_mg1_setup(lambda, mu, cs, EU, varargin)

QSYS_MG1_SETUP Exact mean analysis of the M/G/1 queue with setup times.

[W, WQ, U, Q] = QSYS_MG1_SETUP(LAMBDA, MU, CS, EU, EU2) [W, WQ, U, Q] = QSYS_MG1_SETUP(LAMBDA, MU, CS, UDIST) [W, WQ, U, Q, RES] = QSYS_MG1_SETUP(…)

FCFS single server with Poisson arrivals (rate LAMBDA) and general service (rate MU, coefficient of variation CS). The server switches off when the system empties; the customer arriving to an empty system starts a setup time U, after which service resumes. With rho = LAMBDA/MU < 1 and E[R] = E[S^2]/(2E[S]),

Wq = rho E[R]/(1-rho) + (2 E[U] + LAMBDA E[U^2]) / (2 (1 + LAMBDA E[U])).

Inputs:

EU, EU2 - first two raw moments of the setup time (EU >= 0) UDIST - setup Distribution, in place of EU and EU2

Outputs:

W - mean response time, Wq + 1/MU Wq - mean waiting time, setup included U - fraction of time the server is serving, rho Q - mean number in system, LAMBDA*W RES - struct with probIdle (server off and idle), probSetup (in setup),

meanQueueLengthQ, meanSojournTime, meanWaitingTime, analyzer

Reference: I. Adan and J. Resing, Queueing Systems, TU Eindhoven, 2015, Sec. 10.1.

See also QSYS_MG1, QSYS_MG1_EXCEPTIONAL, QSYS_MG1_VACATION

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_mmckk(alpha, mu, c, K, varargin)

QSYS_MMCKK Exact analysis of the finite-source M/M/c/K/K (machine repair) queue.

RESULT = QSYS_MMCKK(ALPHA, MU, C, K) analyzes K sources (machines), each operating for an exponential time of rate ALPHA before requesting service, served FCFS by C exponential servers of rate MU each, 1 <= C <= K. C = 1 is the M/M/1/K/K queue. The number of requests at the service facility is the birth-death process with birth rate (K-n)*ALPHA and death rate min(n,C)*MU:

P_n = binom(K,n) z^-n P_0 0 <= n <= C P_n = n!/(C! C^(n-C)) binom(K,n) z^-n P_0 C < n <= K, z = MU/ALPHA

A request finds n others at the facility with the arrival-epoch probability Pi_n = (K-n) P_n / (K - E[N]), n = 0..K-1 (the time-stationary law of the system with K-1 sources). Under FCFS a request that finds n >= C waits for n-C+1 completions at rate C*MU, so W is a mixture of Erlang laws and

P(W > t) = sum_{n>=C} Pi_n Q(n-C; C MU t), Q(k;x) = sum_{i<=k} x^i e^-x / i!

and T = W + S with S ~ Exp(MU) independent of W.

RESULT = QSYS_MMCKK(…, ‘tPoints’, T) also returns the waiting and sojourn time CDFs at the points T; ‘percentiles’, R (in percent, 0 < R < 100) returns the matching percentiles of W and T.

Returns a struct with fields:

meanQueueLength - E[N], mean number at the facility (waiting + in service) varQueueLength - Var(N) meanQueueLengthQ - E[Q], mean number waiting meanWaitingTime - E[W] varWaitingTime - Var(W) meanSojournTime - E[T] = E[W] + 1/MU varSojournTime - Var(T) = Var(W) + 1/MU^2 probWait - P(W > 0) = sum_{n>=C} Pi_n condMeanWaitingTime - E[W | W > 0] throughput - ALPHA*(K - E[N]), request rate = completion rate utilization - per-server utilization, throughput/(C*MU) meanOperating - mean number of sources in operation, K - E[N] queueLengthDist - [P_0 … P_K] arrivalDist - [Pi_0 … Pi_{K-1}] tPoints, waitingTimeCdf, sojournTimeCdf (with ‘tPoints’) percentiles, waitingTimePercentile, sojournTimePercentile (with ‘percentiles’) analyzer - identifier string

Example

r = qsys_mmckk(0.1, 1, 2, 10); % 10 machines, 2 repairmen

Reference:

J. Sztrik, Basic Queueing Theory, Univ. of Debrecen, 2021, Secs. 3.2 and 3.4 (Tables 10 and 12).

See also QSYS_MG1KK, QSYS_ENGSET, QSYS_DDCKK, QSYS_MMCK

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_mg1_vacation(lambda, mu, cs, EV, varargin)

QSYS_MG1_VACATION - M/G/1 (and M^X/G/1) exhaustive service with server vacations

[W, Wq, U, Q] = QSYS_MG1_VACATION(LAMBDA, MU, CS, EV, EV2) [W, Wq, U, Q] = QSYS_MG1_VACATION(LAMBDA, MU, CS, VDIST) [W, Wq, U, Q] = QSYS_MG1_VACATION(…, ‘policy’, ‘single’, ‘lst’, VLST) [W, Wq, U, Q] = QSYS_MG1_VACATION(…, ‘E_X’, E_X, ‘E_X2’, E_X2)

FCFS single-server queue with Poisson arrivals, general service (rate MU, coefficient of variation CS, as in QSYS_MG1) and exhaustive service: the server works until the system is empty and then leaves for a vacation V.

Vacation policy (‘policy’):
‘multiple’ (default) - a server returning to an empty system takes another

vacation (Haverkort 1998, eq. 5.38 and 5.41):

Wq = E[V^2]/(2E[V]) + Wq(M^X/G/1)

‘single’ - a server returning to an empty system idles until

the next arrival (Haverkort 1998, eq. 5.39):

Wq = lambda E[V^2] / (2 (V*(lambda) + lambda E[V])) + Wq(M^X/G/1)

where V*(lambda) = E[exp(-lambda V)] is the vacation LST at the BATCH arrival rate. Give it with ‘lst’, or pass the vacation as a Distribution VDIST, whose evalLST supplies it.

Batch arrivals (‘E_X’, ‘E_X2’): LAMBDA is then the BATCH rate and each batch brings X jobs with mean E_X and second raw moment E_X2 (default 1, 1: single arrivals). Wq(M^X/G/1) is the arbitrary-job wait of QSYS_MXG1, which includes the delay behind earlier members of the job’s own batch. The single-vacation batch result follows by treating each batch as one customer whose service is the batch work, since the server’s vacation and idle decisions only see batch epochs, and adding the within-batch delay.

Inputs:

LAMBDA - (batch) arrival rate MU - service rate of a job, E[S] = 1/MU CS - coefficient of variation of the service time, E[S^2] = (1+CS^2)/MU^2 EV,EV2 - first two raw moments of the vacation time (EV > 0) VDIST - vacation Distribution, in place of EV and EV2

Outputs:

W - mean response time of an arbitrary job (Wq + 1/MU) Wq - mean waiting time of an arbitrary job, residual vacation included U - fraction of time the server is serving, rho = LAMBDA*E_X/MU Q - mean number of jobs in the system (Little’s law)

Reference: B. R. Haverkort, Performance of Computer Communication Systems: A Model-Based Approach, Wiley, 1998, Section 5.5.

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_mg1_breakdown(lambda, mu, cs, alpha, ER, varargin)

QSYS_MG1_BREAKDOWN - M/G/1 FCFS queue whose server breaks down and is repaired

[W, Wq, U, Q] = QSYS_MG1_BREAKDOWN(LAMBDA, MU, CS, ALPHA, ER, ER2, RLST) [W, Wq, U, Q] = QSYS_MG1_BREAKDOWN(LAMBDA, MU, CS, ALPHA, RDIST) [W, Wq, U, Q] = QSYS_MG1_BREAKDOWN(LAMBDA, MU, CS, FDIST, …)

Exact mean-value solution of the M/G/1 FCFS queue with the server semantics of Queue.setBreakdown with no down service:

  • the server alternates between UP and DOWN; an up server fails after an exponential time of rate ALPHA WHETHER BUSY OR IDLE, and a down server is restored after a general repair time R;

  • arrivals keep joining the queue while the server is down;

  • a job interrupted by a failure resumes its remaining service when the server is repaired (preemptive resume), and no job is served while down.

Because the failure clock runs while idle, a job arriving to an empty system may find the server down. The busy period then opens with the residual repair time D, whose first two moments need the repair LST at LAMBDA:

p = ALPHA/(LAMBDA+ALPHA), r = R*(LAMBDA) = E[exp(-LAMBDA R)] E[D] = p (E[R] - (1-r)/LAMBDA) / (1 - p r) E[D^2] = p (E[R^2] - 2E[R]/LAMBDA + 2(1-r)/LAMBDA^2) / (1 - p r)

Every job, once at the head of the queue with the server up, occupies the server for its completion time C = S + (repairs during S) (Gaver 1962):

E[C] = E[S] (1 + ALPHA E[R]) E[C^2] = E[S^2] (1 + ALPHA E[R])^2 + ALPHA E[S] E[R^2]

and the queue is an M/G/1 with exceptional first service C0 = D + C (Welch 1964; Avi-Itzhak and Naor 1963), whose departure-epoch generating function gives, with a = LAMBDA E[C], a0 = LAMBDA E[C0], a2 = LAMBDA^2 E[C^2], a02 = LAMBDA^2 E[C0^2],

E[N] = ((2 a0 + a02)(1 - a) + a0 a2) / (2 (1 - a) (1 - a + a0)).

The queue is stable iff LAMBDA E[S] (1 + ALPHA E[R]) < 1.

Inputs:

LAMBDA - Poisson arrival rate MU - service rate, E[S] = 1/MU CS - coefficient of variation of the service time, E[S^2] = (1+CS^2)/MU^2 ALPHA - failure rate of an up server (ALPHA = 0: no failures, the M/G/1);

or FDIST, an Exp failure-time Distribution

ER,ER2 - first two raw moments of the repair time RLST - repair LST at the arrival rate, R*(LAMBDA), a number in (0,1) or

a function handle of s

RDIST - repair Distribution, in place of ER, ER2 and RLST

Outputs:

W - mean response time (sojourn) of a job Wq - W - 1/MU: the mean time a job spends in the system not being served,

queueing and service interruptions included

U - utilization LAMBDA/MU, the fraction of time the server is doing work

(the work-weighted utilization SolverCTMC reports at a breakdown station)

Q - mean number of jobs in the system, LAMBDA*W

References

D. P. Gaver, A waiting line with interrupted service, including priorities, J. Royal Statistical Society B 24(1), 1962. B. Avi-Itzhak and P. Naor, Some queuing problems with the service station subject to breakdown, Operations Research 11(3), 1963. P. D. Welch, On a generalized M/G/1 queuing process in which the first customer of each busy period receives exceptional service, Operations Research 12(5), 1964.

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_tandem_ub_ciucu(x, lst, p, mu, dlst)

QSYS_TANDEM_UB_CIUCU Tail bounds for a GI/Hn/1 -> ./Hn/1 tandem.

RESULT = QSYS_TANDEM_UB_CIUCU(X, LST, P, MU) returns polynomial-exponential upper bounds on the tails of the end-to-end waiting time W and sojourn time S of a tandem of two single-server FCFS stations, fed by a renewal arrival process and serving the same hyperexponential law at both stations. X is the vector of thresholds at which the tails are bounded, LST is a function handle evaluating the interarrival Laplace-Stieltjes transform E[e^{-s X}] for s >= 0, and P, MU are the phase probabilities and rates of the service law Y, Z ~ sum_i P(i) Exp(MU(i)); a scalar P = 1 gives exponential service.

RESULT = QSYS_TANDEM_UB_CIUCU(X, LST, P, MU, DLST) also takes a handle evaluating E[X e^{-s X}], i.e. minus the derivative of LST. Without it that derivative is obtained by a Richardson-extrapolated central difference, which costs about four extra LST evaluations and loses roughly four digits.

The bounds are those of Ciucu and Mehri: with theta the positive root of E[e^{theta (Y-X)}] = 1 (Lundberg/Kingman exponent of the first station, which by identical service is also the exponent of the tandem) and alpha = E[X e^{-theta X}], the test function

gamma(u,v) = 1{0<=u<=v} [1 - A e^{-theta u} - (B + C u + D v) e^{-theta v}]

is made to satisfy the integral inequality of their Theorem 1(b) by the five sufficient conditions of their Lemma 4, which fix

A = 1, C = theta sum_i p_i/(mu_i-theta) / sum_i p_i mu_i/(mu_i-theta)^2, D = (-C E[U e^{theta V}]/E[V e^{theta V}]) v 0, U = Y-X, V = Z-X, B = C (1/mu_1 - alpha E[e^{theta Z}]) if D = 0,

= (C+D)/(mu_1-theta) - theta/mu_1 if D > 0,

with mu_1 the smallest service rate. Their Corollary 2 then gives
P(S > x) <= sum_i p_i { e^{-mu_i x}
  • mu_i/(mu_i-theta) (A+B) (e^{-theta x} - e^{-mu_i x})

  • mu_i/(mu_i-theta)^2 (C+D) (((mu_i-theta)x-1) e^{-theta x}
    • e^{-mu_i x}) }

and the corresponding closed form for W when the service is exponential. E[V e^{theta V}] is positive at any stable load, so D is always well defined: h(s) = E[e^{s(Z-X)}] is convex with h(0) = h(theta) = 1, hence h’(theta) > 0.

The two exponentials mix a polynomial of degree one in x, which is what lets the bound follow the concave bend of the tail on a linear-log scale where a purely exponential bound cannot. In the M/M/1 -> ./M/1 case the five inequalities hold as equalities, so gamma is the exact joint distribution and both bounds are exact:

P(W > x) = (1 - 2 theta^2/(mu(mu+theta)) + x(mu-theta)theta/(mu+theta)) e^{-theta x} P(S > x) = (1 + theta x) e^{-theta x} .

Away from it the bound stays sharp: against an exact CTMC reference for the Erlang(2)/M/1 -> ./M/1 tandem it is within 2% at P(S>x) = 1e-2 and within 0.6% at 5e-10, with the correct asymptotic slope theta^2/(mu(1-alpha mu)). Accuracy degrades with service variability, to about a factor of two at CV(Y) = 2.

Returns a struct with fields:

S - upper bound on P(S > x), one entry per threshold, capped at 1 W - upper bound on P(W > x), NaN unless the service is exponential theta - the tail decay rate, positive root of E[e^{theta (Y-X)}] = 1 alpha - E[X e^{-theta X}] A,B,C,D- the coefficients of gamma fixed by Lemma 4 analyzer - ‘qsys_tandem_ub_ciucu’

Example, a D/M/1 -> ./M/1 tandem at utilization 3/4 with unit service rate:

r = qsys_tandem_ub_ciucu([5 10], @(s) exp(-s*4/3), 1, 1, @(s) (4/3)*exp(-s*4/3));

Reference: F. Ciucu, S. Mehri, “On the Distribution of Sojourn Times in Tandem Queues”, Proc. ACM Meas. Anal. Comput. Syst. 9(2), Article 27, 2025 (ACM SIGMETRICS 2025). Registered in .citations() as ‘tandemub’.

qsys_phph1(alpha, T, beta, S, varargin)

QSYS_PHPH1 Analyzes a PH/PH/1 queue using BUTools MMAPPH1FCFS.

RESULT = QSYS_PHPH1(ALPHA, T, BETA, S) analyzes a PH/PH/1 queue with:

ALPHA - Arrival PH initial probability vector (1 x n) T - Arrival PH generator matrix (n x n) BETA - Service PH initial probability vector (1 x m) S - Service PH generator matrix (m x m)

The arrival PH is converted to an equivalent MAP representation.

RESULT = QSYS_PHPH1(…, ‘numQLMoms’, K) computes K queue length moments RESULT = QSYS_PHPH1(…, ‘numQLProbs’, N) computes N queue length probs RESULT = QSYS_PHPH1(…, ‘numSTMoms’, K) computes K sojourn time moments

Returns a struct with fields:

meanQueueLength - Mean number of customers in system meanWaitingTime - Mean waiting time in queue meanSojournTime - Mean sojourn time (waiting + service) utilization - Server utilization queueLengthDist - Queue length distribution P(Q=n) queueLengthMoments- Raw moments of queue length sojournTimeMoments- Raw moments of sojourn time analyzer - Name of analyzer used

See also MMAPPH1FCFS, qsys_mapph1(), qsys_mapmap1()

qsys_phmc(alpha, T, mu, c, varargin)

QSYS_PHMC Exact PH/M/c (Neuts’ matrix-geometric).

Solves the GI/M/c QBD via R^2*A2 + R*A1 + A0 = 0, where

A0 = (-T*1)*alpha, A1 = T - c*mu*I, A2 = c*mu*I.

pi_n = pi_c * R^(n-c) for n >= c. Boundary states pi_0..pi_c are obtained from balance equations + normalization sum_{n<c} pi_n*1 + pi_c*(I-R)1 = 1.

Inputs:

ALPHA - PH entry probability row vector (1 x k) T - PH sub-generator (k x k) MU - Exponential service rate per server (positive scalar) C - Number of servers (positive integer)

Optional name-value:

‘maxIter’ - max iterations for R fixed-point (default 50000) ‘tol’ - convergence tolerance (default 1e-14)

RESULT struct fields:

meanQueueLength, meanWaitingQueue, meanWaitingTime, meanSojournTime, utilization, analyzer

qsys_mtginf(lambdaFun, serviceCcdf, ES, tvals, varargin)

QSYS_MTGINF Exact time-varying analysis of the Mt/G/Inf queue.

RESULT = QSYS_MTGINF(LAMBDAFUN, SERVICECCDF, ES, TVALS) evaluates the infinite-server queue with a non-homogeneous Poisson arrival rate LAMBDAFUN and iid service times with complementary cdf SERVICECCDF and mean ES, at the times TVALS.

THE RESULT IS EXACT, not an approximation. With infinitely many servers customers never interact, so the model is a Poisson random measure and the number in system at time t is POISSON with mean

m(t) = E[ int_{t-S}^{t} lambda(u) du ] = ES * E[lambda(t - Se)]

= int_0^Inf lambda(t-x) P(S > x) dx

where Se is the STATIONARY-EXCESS (equilibrium) law of the service time, with density P(S>x)/ES. Because the law is Poisson, the variance equals the mean and every quantile follows from it.

THE PHYSICS. Reading m(t) as ES*E[lambda(t-Se)] says the time-varying load is the stationary load ES*lambda(t) subjected to a TIME LAG and a SPACE SHIFT: to first order m(t) ~ ES*lambda(t - E[Se]) with E[Se] = E[S^2]/(2*ES), so peak congestion LAGS peak arrival rate, and by more than the mean service time when the service law is variable. The pointwise stationary approximation ES*lambda(t) is the zeroth-order term of the same expansion, which is exactly why it misses the lag.

Options:
‘startTime’, T0 - the system started empty at T0; the default -Inf assumes

the arrival rate has been running forever

‘ES2’, M2 - the second moment of the service time, which adds the lag

E[Se] and the first-order lag approximation to the output

‘servicePdf’, G - the service density, used for the exact departure rate;

without it the departure rate comes from the flow balance m’(t) = lambda(t) - delta(t) by a central difference

‘tol’, TOL - service-tail cut for the age integral, default 1e-12 ‘panels’, N - Simpson panels for that integral, default 4000 ‘maxAge’, A - cap on the age integrated over, default 1e12

Returns a struct with fields:

times - the requested times meanNumber - m(t), the Poisson mean varNumber - equal to meanNumber, the law being Poisson arrivalRate - lambda(t) departureRate - delta(t) = E[lambda(t-S)] offeredLoadPSA - ES*lambda(t), the pointwise stationary approximation meanLag - E[Se], when ES2 is given lagApproximation - ES*lambda(t-E[Se]), when ES2 is given

Example

% sinusoidal arrivals, exponential service of rate 2 res = qsys_mtginf(@(t) 10+5*sin(t), @(x) exp(-2*x), 1/2, linspace(0,2*pi,50));

Reference: S. G. Eick, W. A. Massey, W. Whitt (1993). The physics of the Mt/G/infinity queue. Operations Research 41(4), 731-742.

See also QSYS_MGINF, QSYS_ERLANGA, QSYS_GGISGI_FLUID.

qsys_svclaw_coeffs(svc, theta, tol, nmaxCap)

[CN, SMEAN] = QSYS_SVCLAW_COEFFS(SVC, THETA, TOL, NMAXCAP)

Uniformization coefficients of a service-time descriptor, shared by the qsys functions that take the law exactly rather than as a PH fit (QSYS_MAPG1K, QSYS_MGCK_SYNC). SVC is the descriptor documented in QSYS_MAPG1K (‘gamma’, ‘det’, ‘ph’, ‘density’). For any matrix M with I + M/THETA nonnegative, E[exp(M*S)] = sum_n CN(n+1)*(I+M/THETA)^n.

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_mmk_qed_staffing(lambda, mu, target, varargin)

QSYS_MMK_QED_STAFFING Square-root staffing of the M/M/s queue.

RESULT = QSYS_MMK_QED_STAFFING(LAMBDA, MU, TARGET) returns the smallest number of servers whose Halfin-Whitt delay probability is at most TARGET, together with the quality-of-service parameter behind it.

THE RULE. Invert alpha(beta) = TARGET for the server slack beta, then staff

s = ceil( a + beta sqrt(a) ), a = lambda/mu,

the SQUARE-ROOT STAFFING rule: the base a erlangs of work plus a safety cushion that grows only as the square root of the load. Doubling the load needs only sqrt(2) times the cushion, which is why large service systems can be both highly utilized and responsive, and why the QED regime is the one large systems are actually run in.

RESULT = QSYS_MMK_QED_STAFFING(…, ‘criterion’, C) chooses what TARGET means:

‘delay’ - P(W > 0) <= TARGET (the default) ‘meanwait’ - E[W] <= TARGET, in time units ‘servicelevel’ - P(W <= TARGET.deadline) >= TARGET.level, TARGET being a

struct with those two fields. In the QED regime the wait is exponential with rate s*mu - lambda given that it is positive, so P(W > t) = alpha(beta) exp(-(s*mu-lambda) t).

RESULT = QSYS_MMK_QED_STAFFING(…, ‘exact’, true) then walks s up or down until the EXACT Erlang C measure meets the target, starting from the square-root answer. That costs an O(s) Erlang C evaluation per step and is what to use when the answer must be defensible rather than asymptotic.

Returns a struct with fields:

numServers - the recommended s beta - the server slack achieved, (s-a)/sqrt(s) betaTarget - the slack the target asks for, before rounding s up offeredLoad - a = lambda/mu probDelay - the QED delay probability at the recommended s meanWait - the QED mean wait at the recommended s serviceLevel - P(W <= deadline) at the recommended s, for the

‘servicelevel’ criterion

exactUsed - whether the exact Erlang C refinement was applied

Example

res = qsys_mmk_qed_staffing(1000, 1, 0.2); % 20% delayed at most res = qsys_mmk_qed_staffing(1000, 1, struct(‘deadline’,0.02,’level’,0.8), …

‘criterion’,’servicelevel’);

Reference: S. Halfin, W. Whitt (1981). Heavy-traffic limits for queues with many exponential servers. Operations Research 29(3), 567-588. The staffing see also W. Whitt (2007), What you should know about queueing models to set staffing requirements in service systems, Naval Research Logistics 54(5), 476-484.

See also QSYS_MMK_QED, QSYS_MMK_QED_ALPHA, QSYS_MMK.

qsys_mmk_qed(lambda, mu, s)

QSYS_MMK_QED Halfin-Whitt QED approximation for the M/M/s queue.

RESULT = QSYS_MMK_QED(LAMBDA, MU, S) returns the quality-and-efficiency-driven (QED) approximation for the M/M/S queue with arrival rate LAMBDA and service rate MU per server.

THE REGIME. Let S grow with the offered load a = LAMBDA/MU so that the SERVER SLACK stays of order sqrt(S), i.e.

beta = (1 - rho) sqrt(S) = (S - a)/sqrt(S)

is held fixed. Halfin and Whitt proved that the delay probability then has the non-degenerate limit

alpha(beta) = [ 1 + beta Phi(beta)/phi(beta) ]^(-1)

with phi and Phi the standard normal density and cdf. That is the whole point of the regime: servers are busy a fraction 1 - beta/sqrt(S) of the time, so efficiency tends to 1, and yet the delay probability tends to a constant strictly between 0 and 1, so quality does not collapse. Neither the underloaded regime (alpha -> 0) nor the overloaded one (alpha -> 1) has that property.

WHY USE IT WHEN M/M/s IS EXACT. Erlang C needs a sum of S terms of the form a^j/j!, which overflows in double precision well before the thousands of servers a large contact centre or a datacentre thread pool has; alpha(beta) is three transcendental calls at any S. The approximation is also the object that the staffing rule inverts, see QSYS_MMK_QED_STAFFING.

Returns a struct with fields:

offeredLoad - a = lambda/mu, in erlangs trafficIntensity - rho = a/s beta - the QED server-slack parameter (s-a)/sqrt(s) probDelay - alpha(beta), the probability an arrival waits meanWaitDelayed - E[W | W > 0] = 1/(s*mu - lambda), exact for M/M/s meanWait - E[W] = alpha(beta)/(s*mu - lambda) meanQueueLength - E[Q] = lambda E[W], customers waiting meanNumber - E[N] = a + E[Q] utilization - rho

ACCURACY. The error is O(1/sqrt(s)) at fixed beta: at s = 100 and beta = 0.5 the exact Erlang C is 0.5065 against 0.5045 here, and at s = 100000 it is 0.50461 against 0.50454.

An overloaded model, beta <= 0, has no QED limit; probDelay is then reported as 1 and the waiting-time fields as Inf, which is what the M/M/s queue does.

Example

res = qsys_mmk_qed(990, 1, 1000); % 1000 servers, 99% loaded res.probDelay

Reference: S. Halfin, W. Whitt (1981). Heavy-traffic limits for queues with many exponential servers. Operations Research 29(3), 567-588.

See also QSYS_MMK, QSYS_MMK_QED_STAFFING, QSYS_ERLANGA.

qsys_mmk_qed_alpha(beta)

ALPHA = QSYS_MMK_QED_ALPHA(BETA)

The Halfin-Whitt delay-probability function

alpha(beta) = [ 1 + beta Phi(beta)/phi(beta) ]^(-1), beta > 0,

with phi and Phi the standard normal density and cdf. It is the limit of the Erlang C delay probability of the M/M/s queue as s -> Inf with beta = (1-rho)sqrt(s) held fixed, and it decreases strictly from 1 at beta = 0 to 0 as beta -> Inf, which is what makes it invertible for staffing.

BETA may be an array. Non-positive entries return 1: with no server slack every arrival is delayed.

Evaluated as phi/(phi + beta*Phi) rather than as the reciprocal of 1 + beta*Phi/phi. The two are the same function, but the quotient Phi/phi overflows once phi underflows (beta beyond about 38), whereas this form degrades to 0/(0+beta) = 0, which is the correct limit.

Reference: S. Halfin, W. Whitt (1981). Heavy-traffic limits for queues with many exponential servers. Operations Research 29(3), 567-588.

See also QSYS_MMK_QED, QSYS_MMK_QED_STAFFING.

qsys_mmk(lambda, mu, k, varargin)

W=QSYS_MMK(LAMBDA,MU,K)

[W, RHO] = QSYS_MMK(LAMBDA, MU, K) returns the mean response time W and the per-server utilization RHO = LAMBDA/(K MU) of the M/M/K queue.

[W, RHO, RES] = QSYS_MMK(…, ‘tPoints’, T, ‘percentiles’, P, ‘nmax’, N) also returns a struct with

meanQueueLength, varQueueLength, meanQueueLengthQ, varQueueLengthQ, meanWaitingTime, varWaitingTime, meanSojournTime, varSojournTime, probWait (Erlang C), condMeanWaitingTime, throughput, utilization, queueLengthDist ([P_0..P_N], default N until the tail is below 1e-14), tPoints, waitingTimeCdf, sojournTimeCdf, percentiles, waitingTimePercentile, sojournTimePercentile, analyzer

References: J. Sztrik, Basic Queueing Theory, 2021, Table 5; I. Adan and J. Resing, Queueing Systems, 2015, Secs. 5.2-5.3 and Remark 11.3.2.

qsys_mmapmap1(D, svc, varargin)

QSYS_MMAPMAP1 Analyzes a MMAP[K]/MAP[K]/1 FCFS queue with carried service phases.

RESULT = QSYS_MMAPMAP1(D, SVC) analyzes a single-server FCFS queue with:

D - marked arrival process {D0, D1_1, …, D1_K} (BUTools layout) SVC - 1 x K cell, SVC{k} = {S0, S1} the service MAP of class k

RESULT = QSYS_MMAPMAP1(…, ‘carry’, TF) gives per class whether its service phase is carried (default: every class whose MAP is not renewal).

THE SERVICE LAW. Each class owns ONE service process whose successive draws are chained in the start order of THAT class: a class-k job starts in the phase the previous class-k draw ended in, however long ago and whatever was served in between. That is how JMT and both LDES engines sample a MAP service (one stateful sampler per station and class), and the law SolverCTMC follows through the per-class carried-phase local variable. A renewal class keeps its marginal phase-type law, which is exact for it.

THE REDUCTION. Under FCFS at one server the service-start order IS the arrival order, so the next draw of class k can be decided at the ARRIVAL of the job it belongs to. With V_k = (-S0)S1, a draw started in h ends in j with probability V_k(h,j), and conditioned on (h,j) its duration is phase type: S0 restricted to the phases i with V_k(i,j) > 0, moved by the Doob transform S0(i,i’)V_k(i’,j)/V_k(i,j) and started in h. So the queue is a MMAP[K’]/PH[K’]/1 FCFS queue whose arrival environment is (arrival phase, carried phase of every carried class) and whose marks are (k, h, j): a class-k arrival in carried phase h moves that class’s coordinate to j with weight V_k(h,j) and brings a job whose service is the conditioned law above. MMAPPH1FCFS (He, 2012) solves that queue exactly, and the class measures are the sums over the class’s marks. The reduction adds no approximation: it only relabels when the landing phase of each draw is sampled.

Returns a struct with fields:

meanQueueLength - 1 x K, E[N_k], number of class-k jobs in system meanSojournTime - 1 x K, E[W_k], by Little’s law from the arrival rates arrivalRate - 1 x K class arrival rates carry - 1 x K, the classes whose service phase is carried markCount - number of marks of the lifted MMAP analyzer - name of the analyzer used

References

Q. He, “Analysis of a continuous time SM[K]/PH[K]/1/FCFS queue: Age process, sojourn times, and queue lengths”, Journal of Systems Science and Complexity, 25(1):133-155, 2012.

See also qsys_mapmapc(), MMAPPH1FCFS, solver_ctmc_mapc()

qsys_mm1k_loss(lambda, mu, K)

Niu-Cooper, Transform-Free Analysis of M/G/1/K and Related Queues, Mathematics of Operations Research Vol. 18, No. 2 (May, 1993), pp. 486-510 (25 pages) TEST: mu=3; lambda=2; K=5; [sigma,rho,lossprob]=qsys_mg1k_loss(lambda,@(t)mu.*exp(-mu.*t),K)

qsys_mmcc_retrial_fp(lambda, mu, c, tol, maxiter, p, q)

[blocProb, r, niter] = QSYS_MMCC_RETRIAL_FP(LAMBDA, MU, C, TOL, MAXITER) [blocProb, r, niter, lossProb] = QSYS_MMCC_RETRIAL_FP(LAMBDA, MU, C, TOL, MAXITER, P, Q)

Fixed-point approximation for M/M/c/c retrial queues.

Customers arrive at rate LAMBDA to a system with C servers, each with service rate MU. Blocked customers join an orbit and retry. Under the assumption that the retrial rate is small relative to the service rate, the total arrival flow (fresh + retrial) is approximated by a Poisson process with rate LAMBDA + r, where r satisfies the fixed-point equation:

r = (lambda + r) * B(lambda/mu + r/mu, c)

and B(a, c) is the Erlang-B blocking probability for offered load a and c servers.

With non-persistent customers (Phung-Duc 2019, Sec. 3.2), a blocked fresh customer joins the orbit with probability P and a blocked retrial customer returns to it with probability Q. The orbit then sends retrials at the rate

r = lambda * P * B / (1 - Q * B), B = B((lambda + r)/mu, c),

which is the equation above when P = Q = 1. A fresh customer is lost with probability LOSSPROB = B*(1-P) + B*P*(1-Q)*B/(1-Q*B), zero when P = Q = 1.

INPUT:

lambda : arrival rate mu : service rate per server c : number of servers (= capacity, no waiting room) tol : convergence tolerance (default: 1e-10) maxiter : maximum iterations (default: 10000) p : probability that a blocked fresh customer joins the orbit (default: 1) q : probability that a blocked retrial customer stays in the orbit (default: 1)

OUTPUT:

blocProb : blocking probability (fraction of arrivals lost or retried) r : additional arrival rate due to retrials niter : number of iterations to converge lossProb : probability that a fresh customer is eventually lost

REFERENCE:

Cohen (1957), fixed-point approximation for M/M/c/c retrial queues. Phung-Duc, “Retrial Queueing Models: A Survey on Theory and Applications”, 2019, Eq. (1).

qsys_mm1_lindley(lambda, mu, Wn, mmax)

QSYS_MM1_LINDLEY Conditional waiting-time moments of the M/M/1 Lindley recursion.

RESULT = QSYS_MM1_LINDLEY(LAMBDA, MU, WN) returns the exact conditional mean and variance of the waiting time of customer n+1 in an FCFS M/M/1 queue with arrival rate LAMBDA and service rate MU, given that customer n waited WN. WN may be a vector, in which case every output is evaluated elementwise.

RESULT = QSYS_MM1_LINDLEY(LAMBDA, MU, WN, MMAX) also returns the conditional raw moments of orders 1 to MMAX.

This is one step of Lindley’s recursion W_{n+1} = max(W_n + S_n - A_n, 0) with A_n ~ Exp(LAMBDA) and S_n ~ Exp(MU). Unlike every other qsys_* function, the quantities here are conditional on the current state rather than stationary, so they are defined and finite for any load, including LAMBDA >= MU.

The m-th conditional moment is

E[W_{n+1}^m | W_n] = lambda mu/(lambda+mu) [ S + T ], S = sum_{k=0}^{m} C(m,k) W_n^k (m-k)! / mu^(m-k+1), T = (-1)^m e^{-lambda W_n} (Gamma(m+1,-lambda W_n) - m!) / lambda^(m+1),

where the density of S_n - A_n is the asymmetric Laplace density lambda mu/(lambda+mu) times e^{-mu x} for x > 0 and e^{lambda x} for x < 0. Because m+1 is a positive integer, the upper incomplete gamma function admits the finite form Gamma(m+1,x) = m! e^{-x} sum_{k=0}^{m} x^k/k!, valid at the negative argument -lambda W_n needed here. Substituting it cancels the growing exponential and leaves the numerically stable

T = (-1)^m m! ( sum_{k=0}^{m} (-lambda W_n)^k/k! - e^{-lambda W_n} ) / lambda^(m+1),

which is what this function evaluates. No incomplete gamma routine is needed.

The mean is returned from the equivalent explicit form
E[W_{n+1} | W_n] = W_n + (lambda-mu)/(lambda mu)
  • mu e^{-lambda W_n} / (lambda (lambda+mu)),

and the variance as the second moment less the squared mean.

Returns a struct with fields:

mean - Conditional mean E[W_{n+1} | W_n], same size as WN var - Conditional variance Var[W_{n+1} | W_n], same size as WN moments - numel(WN) x MMAX conditional raw moments, orders 1 to MMAX mmax - Highest moment order computed analyzer - Identifier string

Examples

r = qsys_mm1_lindley(0.8, 1.0, 2.0); r.mean % 1.8902 r.var % 1.7016 qsys_mm1_lindley(0.8, 1, 0).mean % 0.4444, an empty-queue step

Reference: S. Palomo, J. Pender, “Learning the Tandem Network Lindley Recursion”, Proc. Winter Simulation Conference, 2021, theorem 1 and corollary 2. Verified against 4e6 Monte Carlo replications to 5e-4 relative error for m = 1, 2, 3.

See also QSYS_HH1_LINDLEY, QSYS_TANDEM_LINDLEY, QSYS_MM1_TANDEM_LINDLEY, QSYS_MM1

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_mgck_sync(lambda, c, K, svc, variant, varargin)

RESULT = QSYS_MGCK_SYNC(LAMBDA, C, K, SVC, VARIANT)

Synchronous approximation of the M/G/c/K queue with dual bounds (German, EPEW 2025). The concurrent service clocks of the c servers are replaced by clocks that are synchronized, so that at most one non-Markovian activity is enabled at any time and the process is solved exactly by Markov renewal theory through its embedded Markov chain. Synchronizing is done so that every customer receives either its true service time or a shorter one (VARIANT = ‘faster’) or a longer one (‘slower’), which brackets the M/G/c/K measures: the faster model gives a lower bound on the mean number in system, on the response time and on P(full), and an upper bound on P(idle) and the throughput; the slower model gives the opposite bounds. The argument is customer-wise and holds without losses; with blocking the bounds are observed, not proven.

LAMBDA - Poisson arrival rate (> 0) C - number of identical FCFS servers (>= 1) K - system capacity, jobs in service included (K >= C) SVC - service time descriptor, as in QSYS_MAPG1K: struct with field

‘type’ among ‘det’ (field d), ‘gamma’ (alpha, theta), ‘ph’ (alpha, T) and ‘density’ (pdf, optional tmax)

VARIANT - ‘faster’ or ‘slower’

RESULT = QSYS_MGCK_SYNC(…, ‘nphases’, N) with N >= 1 uses the synchronous phase expansion (deterministic service only): one server, the owner, keeps its exact service time, and the others count phases of length d/N on the owner’s lattice, so that the faster/slower rounding applies to one phase only and the two bounds close in as N grows. N = 0 (default) is the approximation without state expansion. Optional ‘tol’ (default 1e-12) and ‘nmax’ (default 200000) control the uniformization series of the service law, see QSYS_SVCLAW_COEFFS.

Model without expansion, state i = jobs in system. All jobs in service share one clock. ‘faster’: an arrival that finds a free server joins the running batch and completes with it. ‘slower’: such an arrival preempts the clock, so the whole batch restarts with it. On expiry min(i,c) jobs depart and the next min(i-c,c) start together. For C = 1 both variants are the exact M/G/1/K queue.

Model with expansion, state (a, B, q): a = 1 when the owner is busy, B the multiset of phases completed by the other busy servers, q the waiting jobs. While the owner is busy, a tick of length d/N advances every phase and the owner completes after N ticks; a newcomer to another server starts at phase 0 (‘faster’, its first phase is partial) or -1 (‘slower’, it waits for the next tick). With the owner idle the ticks continue; an arrival takes the owner role and preempts the tick, the other phases being rounded up (‘faster’) or kept (‘slower’). A job taking a server at a tick boundary starts exactly. An arrival to the empty system takes the owner role with probability 1/C, as server A in the reference for C = 2.

Embedded chain (German 2000, cascaded embedding for the expansion):

P = I_E - diag^{-1}(Q_E) Q_E + Omega*Delta + Psi*Qbar C = -diag^{-1}(Q_E) + Psi, pi = u*C/(u*C*e), u = u*P

with Omega = I_G E[exp(Q_G S)], Psi = I_G E[int_0^S exp(Q_G t) dt], both evaluated by uniformization of Q_G at rate LAMBDA.

Returns a struct with fields:

queueLengthDist - 1 x (K+1), P(n jobs in system), n = 0..K p0, pK - P(idle), P(full) meanQueueLength - mean number in system meanQueueLengthQ - mean number waiting throughput - LAMBDA*(1-pK) lossProbability - pK (PASTA) meanSojournTime - meanQueueLength/throughput (Little) meanWaitingTime - meanQueueLengthQ/throughput utilization - mean busy servers / C in the synchronized model variant, nphases, stateSpaceSize, analyzer

TEST (Table 1 of [1], lambda=0.5, d=1, K=10, faster w/o: P(idle)=0.643736, R=0.90418):

r=qsys_mgck_sync(0.5,2,10,struct(‘type’,’det’,’d’,1),’faster’); [r.p0 r.meanSojournTime]

The ‘slower’ expansion counts the jobs in phase -1 as in system. The reference notebooks leave those states out of the aggregation, which is why Table 1 of [1] reports R = 1.04482 at N = 10 for lambda = 0.5, where this function returns 1.05607 (both are upper bounds of the exact 1.0375).

References: [1] R. German, On Synchronous Approximations of Non-Markovian Processes with

Dual Bounds, EPEW 2025. Code: github.com/cs7org/MD2K-SynchronousApproximation

[2] R. German, Performance Analysis of Communication Systems with

Non-Markovian Stochastic Petri Nets, Wiley, 2000.

See also QSYS_MAPG1K, QSYS_MMCK, QSYS_MAPDC, QSYS_SVCLAW_COEFFS.

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_mginf(lambda, mu, varargin)

[L,Lq,W,Wq,p0]=QSYS_MGINF(LAMBDA,MU) [L,Lq,W,Wq,p0,pk]=QSYS_MGINF(LAMBDA,MU,K)

Exact solution for M/G/∞ queue (infinite servers). Performance is independent of the service time distribution shape (G). The number of customers in the system follows a Poisson distribution.

Input:

lambda - arrival rate mu - service rate (mean service time = 1/mu) K (optional) - state for probability computation

Output:

L - average number of customers in system Lq - average number of customers in queue (always 0) W - average time in system (= 1/mu) Wq - average waiting time in queue (always 0) p0 - probability of empty system pk (optional) - probability of exactly k customers in system

qsys_mg1k_loss_mgs(lambda, mu, mu_scv, K)
  1. MacGregor Smith - Optimal Design and Performance Modelling of M/G/1/K Queueing Systems

qsys_mg1_psjf(lambda, mu, cs)

QSYS_MG1_PSJF Compute mean response time for M/G/1/PSJF queue

[W, RHO] = QSYS_MG1_PSJF(LAMBDA, MU, CS) computes the mean response time for each job class in an M/G/1 queue with Preemptive Shortest Job First (PSJF) scheduling.

Under PSJF, priority is based on a job’s original size (not remaining size). Jobs with smaller original sizes always preempt jobs with larger sizes.

For PSJF, the mean response time for a job of size x is given by (Section 3.2 of Wierman-Harchol-Balter 2003):

E[T(x)]^PSJF = (lambda * integral_0^x t^2*f(t)dt) / (2*(1-rho(x))^2)
  • x / (1 - rho(x))

where:
  • rho(x) = lambda * integral_0^x t*f(t)dt (truncated load)

  • f(t) is the service time density (mixture of exponentials)

For exponential service, the expected response time for class k is computed by integrating E[T(x)] over the exponential distribution of class k sizes. Otherwise each class size law is fitted to its mean and cs (exponential, balanced H2, Tijms Erlang mixture, or a point mass at cs = 0, as in qsys_mg1_srpt) and E[T(x)] is integrated exactly against that law (private/qsys_mg1_sizequad).

CLASSIFICATION (Wierman-Harchol-Balter 2003):

PSJF is “Always Unfair” - some job size is treated unfairly under all loads and all service distributions.

Parameters:
  • lambda – Vector of arrival rates per class

  • mu – Vector of service rates per class

  • cs – Vector of coefficients of variation per class (cs=1 for exponential)

Returns:

W – Vector of mean response times per class rho : Overall system utilization (modified for Little’s law)

References

  • A. Wierman and M. Harchol-Balter, “Classifying scheduling policies with respect to unfairness in an M/GI/1”, SIGMETRICS 2003, Section 3.2.

  • L. Kleinrock, “Queueing Systems, Volume II: Computer Applications”, Wiley, 1976.

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_mg1_ps(lambda, svc, svcparam, varargin)

RESULT = QSYS_MG1_PS(LAMBDA, ALPHA, T, …) RESULT = QSYS_MG1_PS(LAMBDA, BLST, M1, …)

Sojourn time distribution of the M/G/1 processor-sharing queue.

Jobs arrive in a Poisson stream of rate LAMBDA at a single egalitarian processor-sharing server whose service requirement has Laplace-Stieltjes transform bhat(tau) and mean M1. Writing V(x) for the sojourn time of a tagged job of service requirement x and RHO = LAMBDA*M1 < 1, Ott (1984) and Yashkov (1983) express the conditional transform as

E[exp(-s V(x))] = (1-RHO) / D(s,x),

where D(s,x) is the inverse Laplace transform, evaluated at x, of

f(tau;s) = [ (1-RHO)*tau^2 - (1-RHO)*LAMBDA*(1-bhat(tau))*tau
  • s*RHO*tau - s*LAMBDA*(1-bhat(tau)) ]

/ [ tau^2 * (tau - s - LAMBDA*(1-bhat(tau))) ].

The transform is exact but implicit, since f must be inverted in tau. For phase-type service f(tau;s) is a proper rational function of tau, the double pole at tau = 0 cancels, and D(s,x) is obtained in closed form as a finite sum of residues (or, for repeated poles, from the matrix exponential of the companion realization). This makes the M/PH/1-PS queue, hence every service law LINE can fit with a phase-type distribution, exactly solvable. For a service transform supplied as a function handle, f is inverted in tau numerically on a Bromwich contour placed to the right of the dominant singularity tau*(s), the unique root of tau = s + LAMBDA*(1-bhat(tau)) in the right half plane, which the fixed-point iteration of that equation reaches at geometric rate RHO.

The conditional sojourn time is atomic on the lattice t = (k+1)*x, for k = 0,1,2,…: processor sharing gives every job in the system the same amount of work, so if the k jobs present on arrival all outlive the tagged job and no arrival intervenes, the sojourn is exactly (k+1)*x. For exponential service the masses are A_k = (1-RHO)*RHO^k*exp(-k*MU*x)*exp(-LAMBDA*(k+1)*x), the k = 0 term being the probability of finding the system empty and sharing it with nobody, which is the only one that stays exact for general service. The k = 0 atom is removed before inverting in s; the remaining atoms make cdfCond jump and leave no density, so pdfCond is NaN on the lattice.

Input:

lambda - Poisson arrival rate, positive scalar svc - phase-type initial probability vector alpha (1,n), or a

function handle bhat(tau) returning the service LST, which must accept complex arguments

svcparam - phase-type subgenerator T (n,n) when svc is a vector, or the

mean service time m1 when svc is a function handle

Optional name-value pairs:

‘x’ - service requirements to condition on (default []) ‘s’ - transform arguments at which to tabulate the LST (default []) ‘t’ - times at which to evaluate the sojourn time distribution

(default [])

‘nterms’ - function evaluations per numerical Laplace inversion, odd

(default 41)

‘pdf’ - service density handle, needed to remove the conditioning

when svc is a function handle (default [], filled in automatically on the phase-type path)

‘tagalpha’ - initial vector of the TAGGED job’s requirement, PH(tagalpha,T)

on the phase-type path only (default [], meaning alpha). The arrival stream still mixes requirements as PH(alpha,T), which fixes RHO and V(x); the unconditional outputs then remove the conditioning against the tagged law instead. A multiclass Poisson stream at one PS server is exactly this queue with alpha the rate-weighted mix of the class blocks, and passing one class’s block as tagalpha gives that class’s exact law.

Output (struct):

rho - utilization LAMBDA*M1, M1 the mean of the arrival mix m1, m2 - first two moments of the tagged job’s service requirement

(the arrival mix’s unless tagalpha is given; m2 is NaN when only a transform handle is supplied)

lstCond - handle (s,x) -> E[exp(-s V(x))] lstExcess - handle (s,x) -> E[exp(-s (V(x)-x))], bounded at large s lstUncond - handle s -> E[exp(-s V)], by quadrature over the density dominantRoot - handle s -> tau*(s) x, s - the requested grids lstCondVal - (numel(x),numel(s)) values of lstCond lstUncondVal - (1,numel(s)) values of lstUncond atomCond - (1,numel(x)) atom (1-RHO)*exp(-LAMBDA*x) at t = x atomUncond - (1-RHO)*bhat(LAMBDA), mass of the unshared jobs meanCond - (1,numel(x)) exact conditional mean x/(1-RHO) m2Cond - (1,numel(x)) conditional second moment, from the

transform derivatives

varCond - (1,numel(x)) conditional variance meanUncond - exact unconditional mean M1/(1-RHO) m2Uncond - unconditional second moment varUncond - unconditional variance t - the requested time grid pdfCond - (numel(x),numel(t)) density of V(x), NaN on the lattice cdfCond - (numel(x),numel(t)) P(V(x) <= t), atom included pdfUncond - (1,numel(t)) density of V cdfUncond - (1,numel(t)) P(V <= t)

References

T. J. Ott, “The sojourn-time distribution in the M/G/1 queue with processor sharing”, J. Appl. Prob. 21(2), 1984, pp. 360-378. S. F. Yashkov, “A derivation of response time distribution for an M/G/1 processor-sharing queue”, Probl. Contr. Inform. Theory 12, 1983, pp. 133-148. Q. Zhen, C. Knessl, “Asymptotic expansions for the sojourn time distribution in the M/G/1-PS queue”, Math. Meth. Oper. Res. 74, 2011, equations (2.2)-(2.5).

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_mg1_prio(lambda, mu, cs, varargin)

W=QSYS_MG1_PRIO(LAMBDA,MU,CS)

Analyzes an M/G/1 queueing system with non-preemptive (Head-of-Line) priorities.

Computes per-class mean response times for multiple priority classes using the Pollaczek-Khinchine formula extended for priorities (Cobham).

For K priority classes (class 1 = highest priority), the mean waiting time in queue for class k is

Wq_k = B_0 / ((1 - sum_{i=1}^{k-1} rho_i) * (1 - sum_{i=1}^{k} rho_i))

and the mean response time is W_k = Wq_k + 1/mu_k.

Where:
  • rho_i = lambda_i / mu_i (utilization of class i)

  • B_0 = sum_{i=1}^{K} lambda_i * (1/mu_i^2) * (1 + cs_i^2) / 2 (mean residual work)

  • cs_i = coefficient of variation for class i service time

Parameters:
  • lambda – Vector of arrival rates per priority class (class 1 = highest)

  • mu – Vector of service rates per priority class

  • cs – Vector of coefficients of variation per priority class

Returns:

W – Vector of mean response times (waiting + service) per priority class rho : Q/(1+Q) with Q = sum(lambda.*W) (qsys convention, not the utilization) res : struct with meanSojournTime, meanWaitingTime, meanQueueLength

(per class), utilization, and varSojournTime when the third raw service moments are given with ‘ES3’ (Sztrik 2021, Table 23)

Example

% Two priority classes lambda = [0.2; 0.3]; % Arrival rates mu = [1.0; 1.0]; % Service rates cs = [0.5; 1.0]; % Coefficients of variation [W, rho] = qsys_mg1_prio(lambda, mu, cs);

REFERENCE:

Kleinrock, L., “Queueing Systems, Volume I: Theory”, Wiley, 1975, Section 3.5

qsys_mg1_lrpt(lambda, mu, cs)

QSYS_MG1_LRPT Compute mean response time for M/G/1/LRPT queue

[W, RHO] = QSYS_MG1_LRPT(LAMBDA, MU, CS) computes the mean response time for each job class in an M/G/1 queue with Longest Remaining Processing Time (LRPT) scheduling.

Under LRPT, the job with the longest remaining processing time receives exclusive service. This is a remaining-size based policy that favors large jobs.

For LRPT, the slowdown for a job of size x is given by (Section 3.2 of Wierman-Harchol-Balter 2003):

E[S(x)]^LRPT = 1/(1-rho) + lambda*E[X^2]/(2*x*(1-rho)^2) E[T(x)]^LRPT = x * E[S(x)]^LRPT

E[T(x)] depends on the size law only through E[X^2], so integrating it over class k sizes gives the exact closed form for ANY service distribution:

E[T_k]^LRPT = E[S_k]/(1-rho) + lambda*E[X^2]/(2*(1-rho)^2)

with E[X^2] = sum_i (lambda_i/lambda) (1+cs_i^2)/mu_i^2. Since 1/(1-rho)^2 > 1/(1-rho), LRPT is never below FCFS.

CLASSIFICATION (Wierman-Harchol-Balter 2003):

LRPT is “Always Unfair” - it favors large jobs at the expense of small jobs.

Parameters:
  • lambda – Vector of arrival rates per class

  • mu – Vector of service rates per class

  • cs – Vector of coefficients of variation per class (cs=1 for exponential)

Returns:

W – Vector of mean response times per class rho : Overall system utilization (modified for Little’s law)

References

  • A. Wierman and M. Harchol-Balter, “Classifying scheduling policies with respect to unfairness in an M/GI/1”, SIGMETRICS 2003, Section 3.2.

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_mg1_fb(lambda, mu, cs)

QSYS_MG1_FB Compute mean response time for M/G/1/FB (Feedback/LAS) queue

[W, RHO] = QSYS_MG1_FB(LAMBDA, MU, CS) computes the mean response time for each job class in an M/G/1 queue with Feedback (FB) scheduling, also known as Least Attained Service (LAS) or Shortest Elapsed Time (SET).

Under FB/LAS, the job with the least attained service (smallest age) receives priority. This is an age-based policy where priority depends on how much service a job has received, not its original or remaining size.

For FB, the mean response time for a job of size x is given by (Section 3.3 of Wierman-Harchol-Balter 2003):

E[T(x)]^FB = (lambda * integral_0^x t*F_bar(t)dt) / (1-rho_x)^2
  • x / (1 - rho_x)

where:
  • rho_x = lambda * integral_0^x F_bar(t)dt (load from jobs completing

    service before reaching age x)

  • F_bar(t) = 1 - F(t) (complementary CDF / survival function)

For exponential service, the expected response time for class k is computed by integrating E[T(x)] over the exponential distribution of class k sizes. Otherwise each class size law is fitted to its mean and cs (exponential, balanced H2, Tijms Erlang mixture, or a point mass at cs = 0, as in qsys_mg1_srpt) and E[T(x)] is integrated exactly against that law (private/qsys_mg1_sizequad).

CLASSIFICATION (Wierman-Harchol-Balter 2003):

FB is “Always Unfair” - some job size is treated unfairly under all loads and all service distributions. However, FB approximates SRPT for heavy-tailed distributions and is practical since job sizes need not be known in advance.

Parameters:
  • lambda – Vector of arrival rates per class

  • mu – Vector of service rates per class

  • cs – Vector of coefficients of variation per class (cs=1 for exponential)

Returns:

W – Vector of mean response times per class rho : Overall system utilization (modified for Little’s law)

References

  • A. Wierman and M. Harchol-Balter, “Classifying scheduling policies with respect to unfairness in an M/GI/1”, SIGMETRICS 2003, Section 3.3.

  • L. Kleinrock, “Queueing Systems, Volume II: Computer Applications”, Wiley, 1976.

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_maxima_twomoment(n, mean_, cs2, varargin)

QSYS_MAXIMA_TWOMOMENT Two-moment approximation for the maximum of n variables.

RESULT = QSYS_MAXIMA_TWOMOMENT(N, MEAN, CS2) approximates the mean of the maximum of N iid non-negative variables with the given mean and squared coefficient of variation.

THE SHAPE OF THE ANSWER. For a law with an exponential-like tail the maximum of N samples grows like c~^2 (log N + …): doubling N adds a constant, it does not scale the answer. What the two moments buy is the SLOPE c~^2 of that logarithm and an offset eta:

x_n(q) = c~^2 [log(n eta) - log log(1/q)], E[M_n] = c~^2 [log(n eta) + gamma]

with, for CS2 >= 1, c~^2 = CS2 and eta = (CS2+1)/(2 CS2^2) from the H2 representative, and for CS2 < 1 the shifted-exponential representative c~^2 = sqrt(CS2), eta = exp((1-sqrt(CS2))/sqrt(CS2)).

WHEN NOT TO USE IT. The extreme-value form needs N past a threshold n* ~ CS2/q, because with a highly variable law most of the N samples come from the short component and only about N p of them can contend for the maximum. Measured against exact maxima, the closed form is within a few percent for N >= 100 at CS2 = 4 and 16, and useless at N = 10 for CS2 = 16 – which is exactly what n* predicts. RESULT.reliable reports the test.

AND WHEN TWO MOMENTS ARE NOT ENOUGH. Below CS2 = 1 the maximum is genuinely family-dependent: an Erlang and a shifted exponential with the same two moments have maxima that differ by tens of percent and diverge as N grows, because their tails decay at different rates. Measured on Erlang-4, both the closed form and the fitted shifted exponential are 15-23% high, and they agree with each other, so the gap is the model’s, not the arithmetic’s.

Options: ‘q’ (a quantile level in (0,1); the mean is returned without it), ‘exactFitted’ (also compute the maximum exactly from the fitted representative by integrating 1-F^n, which is the paper’s other recommendation; default true).

Returns a struct with fields value, slope, eta, threshold, reliable, family and exactFittedValue.

Reference: C. Crow, D. Goldberg, W. Whitt (2007). Two-moment approximations for maxima. Operations Research 55(3), 532-548.

See also FJ_RMAX, FJ_XMAX_ERLANG.

qsys_mapphc(D0, D1, alpha, S, c, varargin)

QSYS_MAPPHC Analyzes a MAP/PH/c FCFS queue exactly.

RESULT = QSYS_MAPPHC(D0, D1, ALPHA, S, C) analyzes a c-server FCFS queue with:

D0, D1 - arrival MAP of order ma ALPHA - PH service initial vector (1 x ms) S - PH service sub-generator (ms x ms) C - number of servers (identical, so the service law is shared)

RESULT = QSYS_MAPPHC(…, ‘maxNumComp’, N) caps the number of queue length probabilities returned (default 500). RESULT = QSYS_MAPPHC(…, ‘numWMoms’, K) returns K waiting-time moments (default 3). RESULT = QSYS_MAPPHC(…, ‘wPoints’, T) evaluates the waiting-time CCDF at the times T.

THE STATE SPACE. With c identical servers the server identities carry no information, so the service phases are held as a MULTISET: a configuration is n = (n_1..n_ms) with sum(n) = k servers busy in phase i. There are nchoosek(ms+k-1,k) of them, the count of Asmussen and Moller (2001), against ms^k for the ordered space. Levels 0..c-1 are the boundary (level = servers busy), levels >= c repeat and carry the queue.

THE WAITING TIME. An arrival that finds j customers waiting ahead of it waits for j+1 service completions, so Wq is the (j+1)-st event time of the configuration MAP (Lc, Cdep) started at the arrival-epoch configuration. Folding the matrix-geometric level distribution over j gives

G’(t) = G(t) Lj + R G(t) Cj, G(0) = (I-R)^-1 kron(D1,I) / lambda, P(Wq > t) = pi_c G(t) e,

a LINEAR matrix ODE, so Wq is matrix-exponential. Its transform obeys the generalized Sylvester equation g(sI-Lj) - R g Cj = G(0), and every moment reuses that one operator with a different right-hand side.

Returns a struct with fields:

meanQueueLength - E[N], number in system meanWaitingTime - E[Wq], time in queue meanSojournTime - E[W] = E[Wq] + E[service] utilization - rho = lambda E[service] / c, per server queueLengthDist - P(N = n), n = 0, 1, … waitingTimeMoments - E[Wq^k], k = 1..numWMoms waitingTimeCCDF - P(Wq > t) at the requested wPoints probWait - P(Wq > 0), an arrival finds every server busy phaseCount - nchoosek(ms+c-1,c), the repeating configuration count analyzer - name of the analyzer used

References

S. Asmussen and J.R. Moller, “Calculation of the steady state waiting time distribution in GI/PH/c and MAP/PH/c queues”, Queueing Systems 37(1):9-29, 2001. D.P. Gaver, P.A. Jacobs, G. Latouche, “Finite birth-and-death models in randomly changing environments”, Adv. Appl. Probab. 16:715-731, 1984.

See also qsys_mapmc(), qsys_mapph1(), qsys_phmc(), ph_multisets()

qsys_mapph1(D0, D1, sigma, S, varargin)

QSYS_MAPPH1 Analyzes a MAP/PH/1 queue using BUTools MMAPPH1FCFS.

RESULT = QSYS_MAPPH1(D0, D1, SIGMA, S) analyzes a MAP/PH/1 queue with:

D0 - MAP hidden transition matrix (n x n) D1 - MAP arrival transition matrix (n x n) SIGMA - PH service initial probability vector (1 x m) S - PH service generator matrix (m x m)

RESULT = QSYS_MAPPH1(…, ‘numQLMoms’, K) computes K queue length moments RESULT = QSYS_MAPPH1(…, ‘numQLProbs’, N) computes N queue length probs RESULT = QSYS_MAPPH1(…, ‘numSTMoms’, K) computes K sojourn time moments

Returns a struct with fields:

meanQueueLength - Mean number of customers in system meanWaitingTime - Mean waiting time in queue meanSojournTime - Mean sojourn time (waiting + service) utilization - Server utilization queueLengthDist - Queue length distribution P(Q=n) queueLengthMoments- Raw moments of queue length sojournTimeMoments- Raw moments of sojourn time analyzer - Name of analyzer used

See also MMAPPH1FCFS, qsys_mapmap1(), qsys_phph1()

qsys_mapmc(D0, D1, mu, c, varargin)

QSYS_MAPMC Analyzes a MAP/M/c queue using Q-MAM.

RESULT = QSYS_MAPMC(D0, D1, MU, C) analyzes a MAP/M/c queue with:

D0 - MAP hidden transition matrix (n x n) D1 - MAP arrival transition matrix (n x n) MU - Exponential service rate C - Number of servers

RESULT = QSYS_MAPMC(…, ‘maxNumComp’, N) sets max queue length probs (default 500)

Returns a struct with fields:

meanQueueLength - Mean number of customers in system meanWaitingTime - Mean waiting time in queue meanSojournTime - Mean sojourn time (waiting + service) utilization - Server utilization (per server) queueLengthDist - Queue length distribution P(Q=n) waitingTimePH - Struct with alpha and T for waiting time PH analyzer - Name of analyzer used

See also Q_CT_MAP_M_C, qsys_mapph1(), qsys_mapm1()

qsys_mapm1(D0, D1, mu, varargin)

QSYS_MAPM1 Analyzes a MAP/M/1 queue using Q-MAM.

RESULT = QSYS_MAPM1(D0, D1, MU) analyzes a MAP/M/1 queue with:

D0 - MAP hidden transition matrix (n x n) D1 - MAP arrival transition matrix (n x n) MU - Exponential service rate

This is a convenience wrapper for QSYS_MAPMC with c=1.

RESULT = QSYS_MAPM1(…, ‘maxNumComp’, N) sets max queue length probs (default 500)

Returns a struct with fields:

meanQueueLength - Mean number of customers in system meanWaitingTime - Mean waiting time in queue meanSojournTime - Mean sojourn time (waiting + service) utilization - Server utilization queueLengthDist - Queue length distribution P(Q=n) waitingTimePH - Struct with alpha and T for waiting time PH analyzer - Name of analyzer used

See also QSYS_MAPMC, qsys_mapph1()

qsys_mapg1k_perflow(MAPS, svc, K, varargin)

RESULT = QSYS_MAPG1K_PERFLOW(MAPS, SVC, K)

Per-flow throughput and loss ratio of a FIFO buffer with tail drop that is fed by N flows of arbitrary, mutually different statistical character.

Flow n is described by its own MAP, so two flows may share an arrival rate and still differ in the shape and autocorrelation of their interarrival times. The buffer holds K packets including the one in transmission, and the transmission time follows an arbitrary distribution F.

MAPS - 1 x N cell array, MAPS{n} = {D0n, D1n}, the MAP of flow n. The

modulating orders M_n may differ from flow to flow.

SVC - service time descriptor, see QSYS_MAPG1K K - buffer size in packets, K >= 1

Options are forwarded to QSYS_MAPG1K (‘tol’, ‘nmax’).

Returns a struct with fields:

throughput(n) - throughput of flow n [pkts/s] lossRatio(n) - loss ratio of flow n, in [0,1] lambda(n) - arrival rate of flow n [pkts/s] lambdaAggregate - sum_n lambda(n) throughputAggregate- sum_n throughput(n) lossAggregate - aggregate loss ratio, sum_n L(n)*lambda(n)/lambda p0(n), pK(n) - empty/full buffer probabilities of the n-th model rho - offered load lambdaAggregate * E[S]

Method. The exact model of N flows would need a Markov chain tracking the modulating state of every flow jointly with the buffer occupancy, hence prod_n M_n * (K+1) states; [1] notes this is already out of reach at N=10, M_n=3, K=10 (over 4e11 transition matrix entries). Instead, one model per flow is solved: flow n is kept exactly as MAP_n, while the other N-1 flows are replaced by a single Poisson stream of rate lambda - lambda_n. That substitution is justified by the Palm-Khinchin limiting theorem on the superposition of many point processes, so it is an approximation that improves as N grows, and it is applied N times, once per flow, so no flow is ever the one being Poissonized when its own throughput is computed. Superposing MAP_n with the Poisson background yields the MAP

D0 = D0n - lambdaBar_n*I, D1 = D1n + lambdaBar_n*I, ([1], eq. 5)

which is passed to QSYS_MAPG1K. Each solve costs O((K*M)^3) for the embedded chain, so the whole sweep is O(N*(K*M)^3) against the O(M^(3N)*K^3) of the exact joint model: linear rather than exponential in the flow count.

Accuracy. [1] reports errors against simulation of the exact model below about 8% for N >= 9 with K >= 20, falling to 2.1% at K=50 and 0.5% at K=100, and to 1.2% at N=900. Errors are largest when flows are few, highly variable, and the buffer is small.

TEST (Table 2 of [1], K=20, rho=1, gamma service with CV=2; the nine flows are defined in eq. (55)-(63)). Tables 2-9 of [1] all reproduce to within 0.07 pkts/s, the precision to which they are published:

throughput ~ [89.8 179.6 269.4 85.2 169.3 253.4 56.9 110.8 166.6] pkts/s

References: [1] Chydzinski, A. Per-Flow Throughput of a FIFO Buffer. Applied System

Innovation 2026, 9, 112. Theorem 1.

See also QSYS_MAPG1K, QSYS_MG1K_LOSS, QSYS_MAPG1.

qsys_mapdc(D0, D1, s, c, varargin)

QSYS_MAPDC Analyzes a MAP/D/c queue using Q-MAM.

RESULT = QSYS_MAPDC(D0, D1, S, C) analyzes a MAP/D/c queue with:

D0 - MAP hidden transition matrix (n x n) D1 - MAP arrival transition matrix (n x n) S - Deterministic service time (positive scalar) C - Number of servers (positive integer)

RESULT = QSYS_MAPDC(…, ‘maxNumComp’, N) sets max queue length components (default 1000) RESULT = QSYS_MAPDC(…, ‘numSteps’, K) sets waiting time distribution granularity (default 1)

Returns a struct with fields:

meanQueueLength - Mean number of customers in system meanWaitingTime - Mean waiting time in queue meanSojournTime - Mean sojourn time (waiting + service) utilization - Server utilization (per server) queueLengthDist - Queue length distribution P(Q=n) waitingTimeDist - Waiting time CDF at discrete points analyzer - Name of analyzer used

The waiting time distribution is evaluated at points {0, s/numSteps, 2*s/numSteps, …} where s is the deterministic service time and numSteps controls the granularity.

See also Q_CT_MAP_D_C, qsys_mapmc(), qsys_mapd1()

qsys_mapd1(D0, D1, s, varargin)

QSYS_MAPD1 Analyzes a MAP/D/1 queue using Q-MAM.

RESULT = QSYS_MAPD1(D0, D1, S) analyzes a MAP/D/1 queue with:

D0 - MAP hidden transition matrix (n x n) D1 - MAP arrival transition matrix (n x n) S - Deterministic service time (positive scalar)

RESULT = QSYS_MAPD1(…, ‘maxNumComp’, N) sets max queue length components (default 1000) RESULT = QSYS_MAPD1(…, ‘numSteps’, K) sets waiting time distribution granularity (default 1)

This is a convenience wrapper for qsys_mapdc with c=1.

See also qsys_mapdc(), Q_CT_MAP_D_C, qsys_mapm1()

qsys_is_retrial(sn)

Checks if network is a valid BMAP/PH/N/N bufferless retrial queue

Validates that the network structure matches the requirements for the BMAP/PH/N/N retrial queue solver: - Single bufferless queue (capacity == number of servers) - Retrial drop strategy configured - BMAP/MAP arrival process at source - PH/Exp service at queue - Open class model

Based on: Dudin et al., “Analysis of BMAP/PH/N-Type Queueing System with Flexible Retrials Admission Control”, Mathematics 2025, 13(9), 1434.

Parameters:

sn – Network structure

Returns:

isRetrial – True if network is valid BMAP/PH/N/N retrial topology retInfo: Struct with parameters for the retrial solver

Examples

[isRetrial, retInfo] = qsys_is_retrial(sn)
qsys_hh1_lindley(lambda, pa, mu, ps, Wn, mmax)

QSYS_HH1_LINDLEY Conditional waiting-time moments of the Hl/Hn/1 Lindley recursion.

RESULT = QSYS_HH1_LINDLEY(LAMBDA, PA, MU, PS, WN) returns the exact conditional mean and variance of the waiting time of customer n+1 in an FCFS queue with hyperexponential interarrival and service times, given that customer n waited WN. LAMBDA and PA are the arrival phase rates and their probabilities, MU and PS the service phase rates and their probabilities. WN may be a vector.

RESULT = QSYS_HH1_LINDLEY(LAMBDA, PA, MU, PS, WN, MMAX) also returns the conditional raw moments of orders 1 to MMAX.

Hyperexponential primitives are mixtures of exponentials, so conditioning on the arrival phase i and the service phase j reduces one Lindley step to the M/M/1 step of QSYS_MM1_LINDLEY at rates LAMBDA(i) and MU(j), and the conditional moment is the corresponding mixture

E[W_{n+1}^m | W_n] = sum_i sum_j PA(i) PS(j) E_{ij}[W_{n+1}^m | W_n].

Phases are drawn independently for each customer, which is what makes the mixture exact rather than an approximation; a Markov-modulated arrival stream would not decompose this way.

Note that the variance is not the corresponding mixture of the per-phase variances, because the phase is itself random: it is recovered here from the first two mixed raw moments, which adds the between-phase spread of the means.

Returns a struct with fields:

mean - Conditional mean E[W_{n+1} | W_n], same size as WN var - Conditional variance Var[W_{n+1} | W_n], same size as WN moments - numel(WN) x MMAX conditional raw moments, orders 1 to MMAX mmax - Highest moment order computed analyzer - Identifier string

Examples

r = qsys_hh1_lindley([0.5 2], [0.4 0.6], [1 4], [0.7 0.3], 1.0); r.mean % 1.0484

% a degenerate mixture reproduces the M/M/1 result qsys_hh1_lindley(0.8, 1, 1.0, 1, 2.0).mean % 1.8902

Reference: S. Palomo, J. Pender, “Learning the Tandem Network Lindley Recursion”, Proc. Winter Simulation Conference, 2021, theorem 3. Verified against 4e6 Monte Carlo replications to 2e-3 relative error for m = 1, 2.

See also QSYS_MM1_LINDLEY, QSYS_TANDEM_LINDLEY, QSYS_MM1_TANDEM_LINDLEY

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_lindley_moment(lambda, mu, Wn, m)

QSYS_LINDLEY_MOMENT One conditional Lindley moment for exponential primitives.

VALUE = QSYS_LINDLEY_MOMENT(LAMBDA, MU, WN, M) returns E[max(WN + S - A, 0)^M] with A ~ Exp(LAMBDA) and S ~ Exp(MU), for the vector of current waiting times WN and the integer order M >= 1.

This is the kernel shared by QSYS_MM1_LINDLEY, which calls it once per moment order, and QSYS_HH1_LINDLEY, which mixes it over the arrival and service phases. See QSYS_MM1_LINDLEY for the derivation and for why the upper incomplete gamma function reduces to a finite sum here.

See also QSYS_MM1_LINDLEY, QSYS_HH1_LINDLEY

Copyright (c) 2012-2026, Imperial College London All rights reserved.

qsys_gigk_approx_kingman(lambda, mu, ca, cs, k)

W=QSYS_GIG1_UBND_KINGMAN(LAMBDA,MU,CA,CS,K)

qsys_gigk_rqt(lambda, mu, Gamma_a, Gamma_s, k, alpha_a, alpha_s)

[W,RHOHAT,SWORST]=QSYS_GIGK_RQT(LAMBDA,MU,GAMMA_A,GAMMA_S,K,ALPHA_A,ALPHA_S)

Robust Queueing Theory (RQT) worst-case system time of a G/G/k FCFS queue. The arrival and service processes are not described by distributions but by the polyhedral uncertainty sets

U^a = { T : (sum_{i=k+1}^n T_i - (n-k)/lambda)/(n-k)^(1/alpha_a) >= -Gamma_a } U^s = { X : (sum_{i=k}^n X_i - (n-k+1)/mu)/(n-k+1)^(1/alpha_s) <= Gamma_s }

whose shape follows the (generalized) central limit theorem: alpha=2 is the finite-variance regime, alpha in (1,2) the heavy-tailed one. The performance analysis is then a worst-case optimization rather than an expectation.

The returned W is the closed-form bound of Theorem 3 (Theorem 8 when the two tail coefficients differ, with alphabar = min(alpha_a,alpha_s)),

W <= (alphabar-1)/alphabar^(alphabar/(alphabar-1))
  • lambda^(1/(alphabar-1)) (Gamma_a + Gamma_s/k^(1/alphabar))^(alphabar/(alphabar-1)) / (1-rho)^(1/(alphabar-1)) + k/lambda,

which for k=1 reduces to Theorem 2 and, at alphabar=2, to the Kingman-like form (lambda/4)(Gamma_a+Gamma_s)^2/(1-rho) + 1/lambda. SWORST returns instead the exact worst case over the uncertainty sets, eq. (45), i.e. the supremum over the integer x = nu-j+1 >= 1 of

x/mu + Gamma_s x^(1/alpha_s) - k(x-1)/lambda + Gamma_a (k(x-1))^(1/alpha_a),

a one-dimensional problem. W >= SWORST by construction, and the two agree closely in heavy traffic. The arrival deviation ADDS to the worst case, since the adversary shortens the interarrival times: the sign printed in eq. (12) is easily misread as a subtraction of the whole arrival bracket, and reading it that way puts SWORST an order of magnitude below W.

Note that W is a SYSTEM time (waiting plus service), not a waiting time, and that its additive term is k/lambda rather than the mean service time 1/mu.

Inputs:

LAMBDA - Arrival rate MU - Service rate of each server GAMMA_A - Variability parameter of the arrival uncertainty set GAMMA_S - Variability parameter of the service uncertainty set K - Number of servers (default 1) ALPHA_A - Arrival tail coefficient in (1,2] (default 2) ALPHA_S - Service tail coefficient in (1,2] (default 2)

Returns:

W - Closed-form bound on the system time (Theorem 3 / Theorem 8) RHOHAT - Modified utilization (so that M/M/1 formulas still hold) SWORST - Exact worst-case system time over the uncertainty sets, eq. (45)

Reference: C. Bandi, D. Bertsimas, N. Youssef (2015). Robust Queueing Theory. Operations Research 63(3), 676-700.

qsys_gig1_bnds_extremal(lambda, mu, ca, cs, varargin)

QSYS_GIG1_BNDS_EXTREMAL Extremal two-moment bounds for the GI/GI/1 queue.

RESULT = QSYS_GIG1_BNDS_EXTREMAL(LAMBDA, MU, CA, CS) returns the tightest known interval for the mean steady-state waiting time of a GI/GI/1 queue known ONLY through the first two moments of its interarrival and service times, together with the classical bounds it improves on.

WHAT THE INTERVAL MEANS. Two moments do not determine E[W]; they determine a SET of possible values, and the width of that set is the honest uncertainty in any two-moment approximation. The extremal distributions are the ones that attain its ends:

  • the lower end is attained by deterministic interarrival times and a three-point service law concentrated on multiples of that interval, and has the closed form rho((1+cs^2)rho - 1)^+ / (2(1-rho)) (eq. 2.12);

  • the upper end is attained (asymptotically) by TWO-POINT laws: an interarrival law with an atom at 0, and a service law whose upper atom runs off to infinity while its probability vanishes. Making an interarrival time larger only empties the queue once, but making a service time larger delays every customer behind it, which is why the two ends look so different.

HOW THE UPPER END IS COMPUTED. Chen and Whitt reduce that limit to a D(1/p)/RS(D(rho),p)/1 model with p = 1/(1+ca^2) and RS a geometric random sum, then evaluate its mean waiting time by Spitzer’s identity with the negative binomial pmf (their Algorithm 1). The sum is truncated in both indices, so this bound is a numerical limit, not a formula. The closed-form companion (eq. 3.4) uses the D/M/1 root delta = exp(-(1-delta)/rho) and is within about 1% of it.

Options:

‘K’, K - truncation of the negative binomial value, default 4000 ‘N’, N - truncation of the random-walk length, default 2000 ‘skipTight’, TF - skip the O(K*N) tight bound and return the closed forms

only, default false

Returns a struct whose waiting-time fields are TIMES IN QUEUE (add 1/MU for a response time), all for the given LAMBDA:

trafficIntensity - rho = lambda/mu lowerBound - the tight lower bound, eq. (2.12) upperBound - the conjectured tight upper bound, eq. (3.2) by Algorithm 1 upperBoundClosed - the closed-form upper bound, eq. (3.4) upperBoundDaley - Daley’s bound, eq. (2.7) upperBoundKingman- Kingman’s bound, eq. (2.6) heavyTraffic - the heavy-traffic approximation, eq. (2.9) delta - the D/M/1 root behind upperBoundClosed relativeWidth - (upperBound-lowerBound)/upperBound, the fraction of the

answer that two moments genuinely leave undetermined

Example

res = qsys_gig1_bnds_extremal(0.5, 1, 2, 2); % rho = 0.5, ca^2 = cs^2 = 4 [res.lowerBound res.upperBound res.upperBoundKingman] % 0.750 3.470 5.000

Reference: Y. Chen, W. Whitt (2020). Algorithms for the upper bound mean waiting time in the GI/GI/1 queue. Queueing Systems 94, 327-356. The lower bound is classical, restated there as eq. (2.12); Kingman (1962) and Daley (1977) are the two established upper bounds.

See also QSYS_GIG1_LBND, QSYS_GIG1_UBND_KINGMAN, QSYS_GIG1_RQ.

qsys_gig1_approx_myskja2(lambda, mu, ca, cs, q0, qa)

[W,RHOHAT]=QSYS_GIG1_APPROX_MYSKJA2(LAMBDA,MU,CA,CS,Q0,QA)

Myskja’s enhanced third-moment approximation of the mean response time (time in system). For ca=1 the interpolation parameter theta is a 0/0 form, so the exact M/G/1 result is returned instead.

qa = third relative moment E[X^3]/6/E[X]^3, X=inter-arrival time r.v. q0 = lowest value of the relative third moment for a given mean and SCV

Wq = rho/(1-rho)/mu*(rs+(sqrt(D)-(rs-theta))/rho) and W = Wq+1/mu. With the 1/mu scale the formula is exact for every H2/M/1 queue (cs=1) and tends to the M/G/1 anchor as ca->1.

qsys_gig1_approx_myskja(lambda, mu, ca, cs, q0, qa)

[W,RHOHAT]=QSYS_GIG1_APPROX_MYSKJA(LAMBDA,MU,CA,CS,Q0,QA)

Myskja’s third-moment approximation of the mean waiting time

Wq = rho/(2*mu*(1-rho))*((1+cs^2)+(q0/qa)^(1/rho-rho)*(1/rho)*(ca^2-1))

exact for M/G/1 (ca=1). The returned W adds the mean service time (response time, time in system).

qa = third relative moment E[X^3]/6/E[X]^3, X=inter-arrival time r.v. q0 = lowest value of the relative third moment for a given mean and SCV

qsys_gig1_approx_marchal(lambda, mu, ca, cs)

W=QSYS_GIG1_APPROX_MARCHAL(LAMBDA,MU,CA,CS)

qsys_gig1_approx_kobayashi(lambda, mu, ca, cs)

W=QSYS_GIG1_APPROX_KOBAYASHI(LAMBDA,MU,CA,CS)

qsys_gig1_approx_kimura(lambda, mu, ca, cs)

[W,RHOHAT]=QSYS_GIG1_APPROX_KIMURA(LAMBDA,MU,CA,CS)

Kimura’s diffusion-interpolation approximation of the mean waiting time

Wq = rho*(ca^2+cs^2)/(mu*(1-rho)*(1+ca^2))

exact for M/M/1 and M/G/1. The returned W adds the mean service time (response time, time in system).

Reference: Kimura, T. (1986). A two-moment approximation for the mean waiting time in the GI/G/s queue. Management Science 32(6), 751-763.

qsys_gig1_lbnd(lambda, mu, ca, cs)

[W,RHOHAT]=QSYS_GIG1_LBND(LAMBDA,MU,CA,CS)

Computes fundamental theoretical lower bounds for G/G/1 queues. These are the minimum possible values that performance measures cannot fall below for any realization of the arrival and service processes.

Inputs:

LAMBDA - Arrival rate MU - Service rate CA - Coefficient of variation of inter-arrival time CS - Coefficient of variation of service time

Returns:

W - Lower bound on average time in system (= 1/mu) RHOHAT - Modified utilization (so that M/M/1 formulas still hold)

qsys_gig1_ubnd_kingman(lambda, mu, ca, cs)

[W,RHOHAT]=QSYS_GIG1_UBND_KINGMAN(LAMBDA,MU,CA,CS)

Kingman’s upper bound on the mean waiting time of a G/G/1 queue:

Wq <= lambda*(sa^2+ss^2)/(2*(1-rho)), sa^2=ca^2/lambda^2, ss^2=cs^2/mu^2

The returned W adds the mean service time, so it upper-bounds the mean response time (time in system).

Reference: Kingman, J.F.C. (1962). Some inequalities for the queue GI/G/1. Biometrika 49(3/4), 315-324.

qsys_gig1_approx_allencunneen(lambda, mu, ca, cs)

W=QSYS_GIG1_APPROX_ALLENCUNNEEN(LAMBDA,MU,CA,CS)

qsys_ggingi_tga(lambda, mu, n, ca, cs, patienceCcdf, varargin)

QSYS_GGINGI_TGA Truncated Gaussian approximation for the G/GI/n+GI queue.

RESULT = QSYS_GGINGI_TGA(LAMBDA, MU, N, CA, CS, PATIENCECCDF) approximates the steady state of a heavily-loaded multiserver queue with abandonment: a general stationary arrival process of rate LAMBDA and variability CA, iid general service of mean 1/MU and variability CS, N servers, unlimited waiting room and iid general patience with complementary cdf PATIENCECCDF.

THE APPROXIMATION IS A FLUID CENTRE PLUS A GAUSSIAN FLUCTUATION, TRUNCATED. In the efficiency-driven regime (rho > 1 held fixed as N grows) the fluid limit gives the centre – all servers busy, waiting time w = F^-1(1-1/rho), queue Q = lambda int_0^w F^c – and the many-server central limit theorem gives a NORMAL fluctuation of order sqrt(N) around it. Adding the two directly can produce negative queues and negative waits, so both are TRUNCATED at zero, which is what makes the formulas usable down to moderate overload; the paper reports good accuracy for rho > 1.02 and abandonment rates below 2.

Three independent sources of variability enter separately, which is what lets the exponential-service formula be generalized: the service law appears only as the factor (cs+1)rho in sigma_W^2 (eq. 24), which is 2rho at cs = 1.

An UNDERLOADED model (rho <= 1) has no queue in the limit; the number in system is then normal with the infinite-server variance, whose variance-to-mean ratio is the asymptotic peakedness of QSYS_GGNM_DIFFUSION.

Options:

‘patiencePdf’, F - the patience density; differenced from the ccdf when absent ‘serviceCcdf’, G - G^c(x) = P(S > x), used only in the underloaded branch

Returns a struct with fields regime, trafficIntensity, fluidWait, fluidQueueLength, meanWait, varWait, meanQueueLength, varQueueLength, meanNumberInService, meanNumber, probDelay, probAbandon, sigmaW and sigmaX.

Example

fc = @(x) exp(-0.5*x); fp = @(x) 0.5*exp(-0.5*x); res = qsys_ggingi_tga(120, 1, 100, 1, 1, fc, ‘patiencePdf’, fp);

Reference: Y. Liu, W. Whitt, Y. Yu (2016). Approximations for heavily-loaded G/GI/n+GI queues. Naval Research Logistics 63(3), 187-217.

See also QSYS_GGISGI_FLUID, QSYS_ERLANGA, QSYS_GGNM_DIFFUSION.

qsys_gg1(lambda, mu, ca2, cs2)

[W,RHOHAT]=QSYS_GG1(LAMBDA,MU,CA2,CS2) analyzes a G/G/1 queue.

Uses exact methods for special cases (M/M/1, M/G/1, G/M/1) and Allen-Cunneen approximation for the general case. In the G/M/1 case, the interarrival-time distribution is fitted from (LAMBDA,CA2) by a two-moment renewal process (H2 with balanced means for CA2>1, mixed Erlang for CA2<1) and sigma is the root of sigma = A*(mu*(1-sigma)), with A* the interarrival-time LST.

Inputs:

LAMBDA - Arrival rate MU - Service rate CA2 - Squared coefficient of variation of inter-arrival time CS2 - Squared coefficient of variation of service time

Returns:

W - Average time in system (response time) RHOHAT - Modified utilization (so that M/M/1 formulas still hold)

qsys_dmc(lambda_arr, mu, c, varargin)

QSYS_DMC Analyzes a D/M/c queue (deterministic interarrivals, exp service).

RESULT = QSYS_DMC(LAMBDA, MU, C) returns time-average performance metrics by embedding the system at arrival epochs and integrating over the inter-arrival cycle. The death-only sub-generator A[m,m-1] = min(m,c)*MU encodes service completions; X_{n+1} = expm(A*s)[X_n+1, :].

Optional name-value parameters:

‘truncation’ - state-space truncation (default auto) ‘quadSteps’ - trapezoidal-rule steps over a cycle (default 200)

RESULT struct fields:

meanQueueLength - time-average E[N] meanWaitingQueue - time-average Lq = E[(N-c)+] meanWaitingTime - Wq = Lq / lambda meanSojournTime - Wq + 1/MU utilization - rho = lambda / (c*mu) analyzer - identifier

See also qsys_mapdc(), qsys_mdc_crommelin

qsys_erlanga(lambda, mu, theta, s, r, varargin)

QSYS_ERLANGA Exact analysis of the Erlang A model M/M/s/r+M.

RESULT = QSYS_ERLANGA(LAMBDA, MU, THETA, S) analyzes the Erlang A queue: Poisson arrivals at rate LAMBDA, exponential service of rate MU at each of S servers, and exponential patience of rate THETA, so a waiting customer abandons after an exponential time of mean 1/THETA. The waiting room is infinite; THETA > 0 makes the model ergodic at every load, including LAMBDA above S*MU.

RESULT = QSYS_ERLANGA(LAMBDA, MU, THETA, S, R) allows only R extra waiting spaces, so an arrival finding S+R customers is blocked and lost. R = Inf is the default.

The number in system is the birth-and-death process with birth rate LAMBDA and death rate min(k,S)*MU + (k-S)^+ *THETA, so every measure below is EXACT: this is the special case in which the state-dependent Markovian approximation of QSYS_MGISRGI_WHITT reproduces the model rather than approximating it (eq. 7.12 of the reference). THETA = 0 recovers M/M/s/r without abandonment, and then a finite R is required whenever LAMBDA >= S*MU.

Accepts and returns exactly what QSYS_MGISRGI_WHITT does, including the ‘wPoints’ option for the waiting-time cdfs.

Example

res = qsys_erlanga(102, 1/10, 1/10, 100); res.probAbandon % fraction of arrivals that abandon

Reference: W. Whitt (2005). Engineering solution of a basic call-center model. Management Science 51(2), 221-235, Section 7 and eq. (7.12). The model itself is due to C. Palm (1937, 1957).

See also QSYS_MGISRGI_WHITT, QSYS_MMK, QSYS_MMCK.

qsys_bmapm1(D, mu, varargin)

QSYS_BMAPM1 Analyzes a BMAP/M/1 queue by the matrix-analytic (M/G/1-type) method.

RESULT = QSYS_BMAPM1(D, MU) analyzes a single-server queue fed by a batch Markovian arrival process and with exponential service of rate MU.

Inputs:
D - cell array {D0, D1, …, DK} of BMAP matrices. D0 carries the hidden

transitions, Dk (k >= 1) the transitions that release a batch of k customers.

MU - exponential service rate.

Optional parameters:
‘Uniformization’ - uniformization constant q used to randomize the

generator into a discrete-time M/G/1-type chain. It must dominate every total outflow rate; by default it is chosen as max_i(-D0(i,i)) + mu, rounded up.

‘MaxIter’ - maximum functional iterations for G (default 10000) ‘Tolerance’ - convergence tolerance for G (default 1e-12) ‘MaxLevel’ - level truncation used for the queue-length distribution

(default: adaptive, see qsys_bmapphnn_retrial)

‘TailTolerance’ - relative truncation target for the level distribution

(default 1e-10)

Beyond the usual performance measures the result exposes the intermediate matrix-analytic quantities themselves, so that the algorithm can be inspected and taught rather than only its output:

theta - stationary vector of the BMAP phase process, sum_k D_k lambda - mean arrival rate, theta * sum_k k*D_k * e rho - offered load lambda/mu q - uniformization constant actually used A0, A1, Bk - randomized blocks: A0 = (mu/q)I is a service completion

(level down by one), A1 = (1/q)(D0 - mu*I) + I keeps the level, Bk{k} = (1/q)D_k raises it by k

B0 - boundary local block (1/q)D0 + I, used at level 0 where no

service can complete

A - A0 + A1 + sum_k Bk{k}, the phase process of the chain alpha - stationary vector of A G - minimal non-negative solution of

G = A0 + A1*G + sum_k Bk{k}*G^(k+1)

drift - alpha*(sum_k k*Bk{k})*e - alpha*A0*e. The queue is stable

iff this is strictly negative

decayRate - geometric decay rate of the level probabilities, measured as

the limiting ratio pi_(n+1)/pi_n. Reported rather than derived from a spectral convention so that it is unambiguous

levelProb - level probabilities pi_n as rows (level 0 first) pi0 - probability the system is empty (equals 1-rho exactly)

Example

% Example 6.4 of Bolch et al. D0 = [-2, 1/2; 1/3, -3]; D1 = [1/4, 1/2; 1/3, 1]; D2 = [1/4, 1/2; 1, 1/3]; result = qsys_bmapm1({D0, D1, D2}, 11);

See also qsys_mapm1(), qsys_mapph1(), qsys_bmapphnn_retrial()

Copyright (c) 2012-2026, Imperial College London All rights reserved.