1function [p, L, U, PB, Lq] = me_gegecn(lambda, Ca, mu, Cs, c, K, N)
2%ME_GEGECN Censored GE/GE/c/K;N queue by entropy maximisation
4% Maximum Entropy solution of the single-
class censored FCFS GE/GE/c/K;N
5% queue of Kouvatsos (1994), Section 4.1. The queue holds at most N jobs
6% and never fewer than K; arrivals finding N jobs present are turned away
7% and departures are not allowed from state K. For a queue embedded in an
8% OPEN network K
is always 0; positive K arises in closed networks, where
9% it records the minimum occupancy forced by the remaining stations being
12% The ME state probabilities subject to normalisation, the marginal
13% utilisations u(l), the mean queue length excluding J jobs and the
14% full-buffer probability coincide with the global balance solution
16% p(n) = p(K) * G_n * x^h(n) * y^f(n), n = K+1,...,N (4.2)
18% with G_n = prod_{l=K+1}^{m(n)} g(l), J = max(c,K+1),
19% h(n) = max(0,n-J), f(n) = max(0,n-N+1), m(n) = max{K+1,min(c,n)}, and
20% the Lagrangian coefficients g(l), x, y given in closed
form by raw
21% system data. The coefficients are invariant to N and K, so letting
22% K -> 0 and N -> Inf recovers the stable GE/GE/c solution used by
26% lambda - Arrival rate offered to the queue (attempts, including the
27% arrivals that are turned away)
28% Ca - Squared coefficient of variation of the interarrival times
29% (Ca >= 1: the GE distribution
is defined
for scv >= 1)
30% mu - Service rate of one server
31% Cs - Squared coefficient of variation of the service times
33% c - Number of servers (c >= 1, finite)
34% K - Minimum number of jobs in the queue (K >= 0)
35% N - Buffer capacity in jobs, in service included (N > K, finite)
38% p - Queue length distribution, p(idx) = Pr{n = K+idx-1}, idx = 1..N-K+1
39% L - Mean number of jobs in the queue, sum_n n*p(n)
40% U - Utilization, E[min(n,c)]/c (mean fraction of busy servers)
41% PB - Probability that an arrival of the queue
's own aggregate stream
42% finds the queue full, eq. (4.3)
43% Lq - Mean number of jobs waiting, L - E[min(n,c)]
46% D.D. Kouvatsos, "Entropy Maximisation and Queueing Network Models",
47% Annals of Operations Research, 48:63-126, 1994, Section 4.1,
48% equations (4.1)-(4.3).
50% Copyright (c) 2012-2026, Imperial College London
54 line_error(mfilename, 'me_gegecn
requires a finite buffer capacity N; use me_oqn
for infinite capacity.
');
56if ~isfinite(c) || c < 1
57 line_error(mfilename, 'me_gegecn
requires a finite number of servers c >= 1.
');
60 line_error(mfilename, 'me_gegecn
requires N > K.
');
62if Ca < 1 - 1e-12 || Cs < 1 - 1e-12
63 line_error(mfilename, 'me_gegecn
requires Ca >= 1 and Cs >= 1: the GE distribution
is not defined
for scv < 1.
');
66 line_error(mfilename, 'me_gegecn
requires a positive service rate.
');
75rho = lambda / (c * mu);
78den1 = sigma * (1 - tau) + tau; % sigma(1-tau)+tau
79den2 = tau * rho * (1 - sigma) + sigma; % tau*rho(1-sigma)+sigma
81% Lagrangian coefficients g(l), l = K+1,...,J
84 g(K+1) = tau * c * rho / ((K + 1) * den1);
86 g(K+1) = tau * sigma * rho / den2;
88 g(K+1) = (den1 / den2) * tau * rho;
92 g(l) = (tau * c * rho + (l - 1) * sigma * (1 - tau)) / (l * den1);
94 g(l) = sigma * (tau * c * rho + (J - 1) * sigma * (1 - tau)) / (J * den2);
98x = (tau * rho + sigma * (1 - tau)) / den2;
99y = 1 / (1 - (1 - sigma) * x);
101% Unnormalized log-probabilities. Working in log space keeps x^(N-J) from
102% overflowing on a saturated queue with a large buffer, and makes the
103% rho=1 case (x=1) fall out of the same expression instead of needing the
104% separate p(K) branch of (4.2).
106cumlogg = cumsum(log(g(K+1:J)));
107logp = zeros(1, numel(n));
111 m = max(K + 1, min(c, nn));
112 logp(idx) = cumlogg(m - K);
115logp = logp + max(0, n - J) * log(x) + max(0, n - N + 1) * log(y);
116logp = logp - max(logp);
122Ebusy = sum(busy .* p);
125PB = me_gegecn_pb(p, K, N, c, Cs, Ca);