LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
fj_quantile.m
1%{ @file fj_quantile.m
2 % @brief Quantile approximation for maximum of K random variables
3 %
4 % @author LINE Development Team
5%}
6
7%{
8 % @brief Quantile approximation for maximum of K random variables
9 %
10 % @details
11 % Approximates the q-th quantile of the maximum of K i.i.d. random
12 % variables from the standard Gumbel (Type I extreme value) distribution.
13 %
14 % x(K,q) ≈ ln(K) - ln(ln(1/q))
15 %
16 % where P(M_K <= x(K,q)) = q is the q-th quantile.
17 %
18 % Note: This approximation is inaccurate for small values of K.
19 %
20 % For general distributions, the quantile of the maximum can be computed
21 % using the inverse CDF:
22 % x(K,q) = F^{-1}(q^{1/K})
23 %
24 % @par Syntax:
25 % @code
26 % x_Kq = fj_quantile(K, q) % Standard Gumbel approx
27 % x_Kq = fj_quantile(K, q, F_inv) % General distribution
28 % @endcode
29 %
30 % @par Parameters:
31 % <table>
32 % <tr><th>Name<th>Description
33 % <tr><td>K<td>Number of random variables (positive integer)
34 % <tr><td>q<td>Quantile probability (0 < q < 1)
35 % <tr><td>F_inv<td>Optional: inverse CDF function handle for general distributions
36 % </table>
37 %
38 % @par Returns:
39 % <table>
40 % <tr><th>Name<th>Description
41 % <tr><td>x_Kq<td>q-th quantile of the maximum of K random variables
42 % </table>
43 %
44 % @par Reference:
45 % A. Thomasian, "Analysis of Fork/Join and Related Queueing Systems",
46 % ACM Computing Surveys, Vol. 47, No. 2, Article 17, July 2014.
47 % Page 17:22.
48%}
49function x_Kq = fj_quantile(K, q, F_inv)
50
51if K < 1
52 line_error(mfilename, 'K must be a positive integer. Got K=%d.', K);
53end
54
55if any(q <= 0) || any(q >= 1)
56 line_error(mfilename, 'Quantile q must satisfy 0 < q < 1.');
57end
58
59if nargin < 3 || isempty(F_inv)
60 % Standard Gumbel approximation
61 % x(K,q) ≈ ln(K) - ln(ln(1/q))
62 x_Kq = log(K) - log(log(1 ./ q));
63else
64 % General distribution using inverse CDF
65 % The CDF of the maximum is F_max(x) = [F(x)]^K
66 % So the q-th quantile satisfies: [F(x)]^K = q
67 % Therefore: F(x) = q^(1/K) and x = F^{-1}(q^{1/K})
68 x_Kq = F_inv(q.^(1 / K));
69end
70
71end