LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
qsys_gigk_approx_whitt.m
1function [W,rhohat]=qsys_gigk_approx_whitt(lambda,mu,ca,cs,k)
2% [W,RHOHAT]=QSYS_GIGK_APPROX_WHITT(LAMBDA,MU,CA,CS,K)
3%
4% GI/G/k approximation of Whitt (1993), eqs. (2.16)-(2.25):
5% Wq = phi(rho,ca^2,cs^2,k) * ((ca^2+cs^2)/2) * Wq(M/M/k)
6% where phi interpolates the Cosmetatos M/D/k (phi1) and D/M/k (phi3)
7% correction factors. Exact for M/M/k; reduces to the Cosmetatos M/D/k
8% approximation for cs=0. Implements eq. (2.25) as printed, which was
9% validated here against the paper's Tables 5-7 (New column).
10%
11% Inputs:
12% LAMBDA - Arrival rate
13% MU - Service rate per server
14% CA - Coefficient of variation of inter-arrival time
15% CS - Coefficient of variation of service time
16% K - Number of servers
17%
18% Returns:
19% W - Average time in system (response time)
20% RHOHAT - Modified utilization (so that M/M/1 formulas still hold)
21%
22% Reference: Whitt, W. (1993). Approximations for the GI/G/m queue.
23% Production and Operations Management 2(2), 114-161.
24
25% Copyright (c) 2012-2026, Imperial College London
26% All rights reserved.
27
28ca2 = ca^2;
29cs2 = cs^2;
30rho = lambda / (k * mu);
31
32% Exact M/M/k baseline (Erlang-C based)
33W_mmk = qsys_mmk(lambda, mu, k);
34Wq_mmk = W_mmk - 1/mu;
35
36% Cosmetatos correction, as modified by Whitt (1993), eq. (2.17)
37gamma = min(0.24, (1-rho)*(k-1)*(sqrt(4+5*k)-2)/(16*k*rho));
38phi1 = 1 + gamma; % M/D/k factor, eq. (2.16)
39phi2 = 1 - 4*gamma; % eq. (2.18)
40phi3 = phi2 * exp(-2*(1-rho)/(3*rho)); % D/M/k factor, eq. (2.20)
41phi4 = min(1, (phi1+phi3)/2); % eq. (2.21)
42
43c2 = (ca2+cs2)/2;
44if c2 >= 1
45 psi = 1; % eq. (2.22)
46else
47 psi = phi4^(2*(1-c2));
48end
49
50if abs(ca2-cs2) < 1e-12
51 phi = psi; % eq. (2.25) reduces to psi
52elseif ca2 > cs2
53 phi = (4*(ca2-cs2)/(4*ca2-3*cs2))*phi1 + (cs2/(4*ca2-3*cs2))*psi;
54else
55 phi = ((cs2-ca2)/(2*(ca2+cs2)))*phi3 + ((cs2+3*ca2)/(2*(ca2+cs2)))*psi;
56end
57
58Wq = phi * c2 * Wq_mmk; % eq. (2.24)
59W = Wq + 1/mu;
60rhohat = W*lambda/(1+W*lambda); % so that M/M/1 formulas still hold
61
62end
Definition Station.m:245