LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
pfqn_cbh.m
1%{
2%{
3 % @file pfqn_cbh.m
4 % @brief Convolutional Bound Hierarchy (Dowdy, Eager, Gordon, Saxton 1984)
5 % for single-class closed product-form networks.
6%}
7%}
8
9function [Xlo,Xhi] = pfqn_cbh(L,N,Z,level)
10%{
11%{
12 % @brief Level-`level` convolutional bound hierarchy on throughput. Fills
13 % column c = M-level of Buzen's g-array with BJB-derived estimates
14 % (e_0=1, e_i=e_{i-1}/BOUND(i)), then convolves the remaining `level`
15 % servers exactly (g(n,m)=g(n,m-1)+L_m g(n-1,m)). Bounds tighten
16 % monotonically with level and equal the exact solution at level M
17 % (Dowdy et al. 1984). BJB upper fill yields the upper bound; BJB
18 % lower fill the lower bound.
19 % @fn pfqn_cbh(L, N, Z, level)
20 % @param L Service demand vector (M x 1).
21 % @param N Population (scalar).
22 % @param Z Think time (scalar, default 0); folded as an extra IS column.
23 % @param level Number of exactly-convolved servers, 1..M (default 2).
24 % @return Xlo Lower throughput bound.
25 % @return Xhi Upper throughput bound.
26%}
27%}
28L = L(:);
29if nargin < 3 || isempty(Z), Z = 0; end
30if nargin < 4 || isempty(level), level = 2; end
31M = numel(L);
32level = max(1, min(level, M));
33c = max(1, M - level); % c=1 (single-server column) is already exact
34Xlo = cbh_hier(L,N,Z,c,'lower');
35Xhi = cbh_hier(L,N,Z,c,'upper');
36end
37
38function X = cbh_hier(L,N,Z,c,side)
39% BJB-filled column c, then exact convolution of the remaining queueing
40% servers and (separately, always exactly) the IS think-time station.
41M = numel(L);
42Rc = sum(L(1:c)); Lbc = max(L(1:c)); Lac = mean(L(1:c));
43% Column-c fill from a BJB estimate of the first c queueing servers. The
44% think time is NOT folded here: the delay is an infinite-server station and
45% is convolved exactly below, so folding Z into the BJB fill would corrupt
46% both the bound and the exact-at-level-M property.
47e = zeros(1, N+1); e(1) = 1;
48for i = 1:N
49 switch side
50 case 'upper', B = i/(Rc + (i-1)*Lac); % BJB upper fill -> upper bound
51 case 'lower', B = i/(Rc + (i-1)*Lbc); % BJB lower fill -> lower bound
52 end
53 e(i+1) = e(i)/B;
54end
55if c == 1
56 e = L(1).^(0:N); % single-server column is exact
57end
58g = e;
59for m = c+1:M % exact convolution of servers c+1..M
60 for n = 1:N
61 g(n+1) = g(n+1) + L(m)*g(n);
62 end
63end
64if Z > 0 % convolve the IS delay exactly: g_Z(j)=Z^j/j!
65 gd = Z.^(0:N) ./ factorial(0:N);
66 gfull = zeros(1, N+1);
67 for n = 0:N
68 acc = 0;
69 for j = 0:n
70 acc = acc + g(j+1)*gd(n-j+1);
71 end
72 gfull(n+1) = acc;
73 end
74 g = gfull;
75end
76X = g(N)/g(N+1);
77end