LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
fj_xmax_approx.m
1%{ @file fj_xmax_approx.m
2 % @brief General approximation for expected maximum of K random variables
3 %
4 % @author LINE Development Team
5%}
6
7%{
8 % @brief General approximation for expected maximum of K random variables
9 %
10 % @details
11 % Approximates the expected value of the maximum of K i.i.d. random
12 % variables using the mean-variance approximation from David [1970].
13 %
14 % X_K^max ≈ mu_X + sigma_X * G(K)
15 %
16 % where G(K) depends on the distribution type:
17 % - Exponential: G(K) = H_K - 1 (where H_K is the K-th harmonic number)
18 % - Uniform: G(K) = sqrt(3) * (K-1) / (K+1)
19 % - EVD: G(K) = sqrt(6) * ln(K) / pi
20 % - General: G(K) <= (K-1) / sqrt(2K-1) (upper bound)
21 %
22 % @par Syntax:
23 % @code
24 % Xmax = fj_xmax_approx(K, mu_X, sigma_X, dist_type)
25 % @endcode
26 %
27 % @par Parameters:
28 % <table>
29 % <tr><th>Name<th>Description
30 % <tr><td>K<td>Number of random variables (positive integer)
31 % <tr><td>mu_X<td>Mean of the distribution
32 % <tr><td>sigma_X<td>Standard deviation of the distribution
33 % <tr><td>dist_type<td>Distribution type: 'exp', 'uniform', 'evd', 'bound' (default: 'exp')
34 % </table>
35 %
36 % @par Returns:
37 % <table>
38 % <tr><th>Name<th>Description
39 % <tr><td>Xmax<td>Approximate expected maximum X_K^max
40 % <tr><td>GK<td>The G(K) factor used
41 % </table>
42 %
43 % @par Reference:
44 % A. Thomasian, "Analysis of Fork/Join and Related Queueing Systems",
45 % ACM Computing Surveys, Vol. 47, No. 2, Article 17, July 2014.
46 % Eq. (22) and (23) on page 17:16.
47 %
48 % Original: H.A. David, "Order Statistics", Wiley, 1970.
49%}
50function [Xmax, GK] = fj_xmax_approx(K, mu_X, sigma_X, dist_type)
51
52if nargin < 4
53 dist_type = 'exp';
54end
55
56if K < 1
57 line_error(mfilename, 'K must be a positive integer. Got K=%d.', K);
58end
59
60if sigma_X < 0
61 line_error(mfilename, 'Standard deviation sigma_X must be non-negative.');
62end
63
64% Compute G(K) based on distribution type
65switch lower(dist_type)
66 case 'exp'
67 % Exponential distribution: G(K) = H_K - 1
68 GK = fj_harmonic(K) - 1;
69
70 case 'uniform'
71 % Uniform distribution: G(K) = sqrt(3) * (K-1) / (K+1)
72 GK = sqrt(3) * (K - 1) / (K + 1);
73
74 case 'evd'
75 % Extreme Value Distribution: G(K) = sqrt(6) * ln(K) / pi
76 GK = sqrt(6) * log(K) / pi;
77
78 case 'bound'
79 % Upper bound for any distribution: G(K) <= (K-1) / sqrt(2K-1)
80 GK = (K - 1) / sqrt(2 * K - 1);
81
82 otherwise
83 line_error(mfilename, 'Unknown distribution type: %s. Valid: exp, uniform, evd, bound.', dist_type);
84end
85
86% X_K^max ≈ mu_X + sigma_X * G(K)
87Xmax = mu_X + sigma_X * GK;
88
89end