1%{ @file fj_xmax_hyperexp.m
2 % @brief Expected maximum of K i.i.d. Hyperexponential-2 random variables
4 % @author LINE Development Team
8 % @brief Expected maximum of K i.i.d. Hyperexponential-2 random variables
11 % Computes the expected value of the maximum of K independent and
12 % identically distributed Hyperexponential random variables with
15 % The pdf of H2
is: f(t) = p1*mu1*exp(-mu1*t) + p2*mu2*exp(-mu2*t)
16 % where p1 + p2 = 1 and p1, p2 > 0.
18 % The expected maximum
is:
19 % X_K^max = sum_{n=1}^{K} (-1)^{n+1} * sum_{m=0}^{n} C(n,m) * p1^m * p2^{n-m} / (m*mu1 + (n-m)*mu2)
21 % The H2 distribution has CV > 1, making it useful
for modeling
22 % high-variability service times.
26 % Xmax = fj_xmax_hyperexp(K, p1, mu1, mu2)
31 % <tr><th>Name<th>Description
32 % <tr><td>K<td>Number of parallel servers (positive integer)
33 % <tr><td>p1<td>Probability of branch 1 (0 < p1 < 1)
34 % <tr><td>mu1<td>Rate of branch 1
35 % <tr><td>mu2<td>Rate of branch 2
40 % <tr><th>Name<th>Description
41 % <tr><td>Xmax<td>Expected maximum service time X_K^max
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:13, Eq. (15).
49function Xmax = fj_xmax_hyperexp(K, p1, mu1, mu2)
52 line_error(mfilename,
'K must be a positive integer. Got K=%d.', K);
56 line_error(mfilename,
'p1 must be in (0,1). Got p1=%.4f.', p1);
59if mu1 <= 0 || mu2 <= 0
60 line_error(mfilename,
'Rates mu1 and mu2 must be positive.');
65% X_K^max = sum_{n=1}^{K} (-1)^{n+1} * sum_{m=0}^{n} C(n,m) * p1^m * p2^{n-m} / (m*mu1 + (n-m)*mu2)
70 denominator = m * mu1 + (n - m) * mu2;
72 inner_sum = inner_sum + nchoosek(n, m) * (p1^m) * (p2^(n - m)) / denominator;
75 Xmax = Xmax + ((-1)^(n + 1)) * inner_sum;