2 % @brief Compute G(K) factors
for expected maximum approximation
4 % @author LINE Development Team
8 % @brief Compute G(K) factors
for expected maximum approximation
11 % Computes the G(K) factor used in the approximation:
12 % X_K^max ≈ mu_X + sigma_X * G(K)
14 % For standardized distributions (mean=0, variance=1), G(K) = X_K^max.
16 % Available G(K) formulas:
17 % - Exponential: G(K) = H_K - 1
18 % - Uniform: G(K) = sqrt(3) * (K-1) / (K+1)
19 % - EVD: G(K) = sqrt(6) * ln(K) / pi
20 % - Upper bound: G(K) <= (K-1) / sqrt(2K-1) (tight bound from David [1970])
24 % GK = fj_gk_bound(K) % Returns struct with all
25 % GK = fj_gk_bound(K,
'exp') % Exponential G(K)
26 % GK = fj_gk_bound(K,
'uniform') % Uniform G(K)
27 % GK = fj_gk_bound(K,
'evd') % EVD G(K)
28 % GK = fj_gk_bound(K,
'bound') % Upper bound
33 % <tr><th>Name<th>Description
34 % <tr><td>K<td>Number of random variables (positive integer)
35 % <tr><td>type<td>Optional:
'exp',
'uniform',
'evd',
'bound', or
'all' (default)
40 % <tr><th>Name<th>Description
41 % <tr><td>GK<td>G(K) value(s) - scalar or struct depending on type
45 % A. Thomasian,
"Analysis of Fork/Join and Related Queueing Systems",
46 % ACM Computing Surveys, Vol. 47, No. 2, Article 17, July 2014.
47 % Eq. (22) and (23) on page 17:16.
49 % Original: H.A. David,
"Order Statistics", Wiley, 1970.
51function GK = fj_gk_bound(K, type)
58 line_error(mfilename,
'K must be a positive integer. Got K=%d.', K);
63 % Exponential distribution: G(K) = H_K - 1
64 GK = fj_harmonic(K) - 1;
67 % Uniform distribution: G(K) = sqrt(3) * (K-1) / (K+1)
68 GK = sqrt(3) * (K - 1) / (K + 1);
71 % Extreme Value Distribution: G(K) = sqrt(6) * ln(K) / pi
72 GK = sqrt(6) * log(K) / pi;
75 % Upper bound
for any distribution: G(K) <= (K-1) / sqrt(2K-1)
76 GK = (K - 1) / sqrt(2 * K - 1);
79 % Return
struct with all G(K) values
82 GK.exponential = fj_harmonic(K) - 1;
83 GK.uniform = sqrt(3) * (K - 1) / (K + 1);
84 GK.evd = sqrt(6) * log(K) / pi;
85 GK.upper_bound = (K - 1) / sqrt(2 * K - 1);
88 line_error(mfilename,
'Unknown type: %s. Valid: exp, uniform, evd, bound, all.', type);