3 % @file pfqn_comomrm_orig.m
4 % @brief Original CoMoM implementation
for finite repairman model.
10 % @brief Original CoMoM implementation
for finite repairman model.
11 % @fn pfqn_comomrm_orig(L, N, Z, atol)
12 % @param L Service demand matrix.
13 % @param N Population vector.
14 % @param Z Think time vector.
15 % @param atol Absolute tolerance
for numerical computations.
16 % @
return lG Logarithm of normalizing constant.
19function lG=pfqn_comomrm_orig(L,N,Z,atol)
20% comom
for a finite repairment model
22 line_error(mfilename,
'The solver accepts at most a single queueing station.')
28[~,L,N,Z,lG0] = pfqn_nc_sanitize(lambda,L,N,Z,atol);
32Lmax(Lmax<atol)=Z(Lmax<atol); % unless zero
33L = L./repmat(Lmax,M,1);
34Z = Z./repmat(Lmax,M,1);
35% sort from smallest to largest
36[~,rsort] = sort(Z,'ascend');
42lh=log(h) + factln(sum(nvec)+M-1) - sum(factln(nvec));
51 P = zeros(2*(r-1),2*r);
53 P(1:r1,1:r1) = eye(r1);
54 P((r1+1):2*r1,(r+1):(2*r-1)) = eye(r1);
57 h1(r)=h_1(1)*nvec(r1)/(sum(nvec)-1)/scale(nt);
58 h1(end)=h_1(r1+1)*nvec(r1)/(sum(nvec)-1)/scale(nt);
66 A(1,2:r) = -L(1,1:r-1);
69 % Class-1..(R-1) PCs for G
73 A(1+s,1+s) = -m*L(1,s);
75 % Class-R PCs for G and Gr (r=1...R-1)
76 A(r+1:2*r,r+1:2*r) = Nr*eye(r);
77 DA(r+1:2*r,r+1:2*r) = eye(r);
78 B(r+1:2*r,1:r) = m*L(1,r)*eye(r);
79 B(r+1:2*r,r+1:2*r) = Z(r)*eye(r);
84 F1r = [inv(C)*B1r; 0*B2r];
85 F2r = [-C\A12*B2r; B2r];
88 h = (nvec(r)*F1r+F2r)*h_1/(sum(nvec)+M-1);
90 scale(nt)=abs(sum(sort(h)));
91 h = abs(h)/scale(nt); % rescale so that |h|=1
94% unscale and return the log of the normalizing constant
95lG=lG0+log(h(end-(R-1))) + factln(sum(N)+M-1) - sum(factln(N)) + N*log(Lmax)' + sum(log(scale));