4 % @brief Generate load-dependent rates
for functional server model f(n)=n+c.
10 % @brief Generate load-dependent rates
for functional server model f(n)=n+c.
11 % @fn pfqn_fnc(alpha, c)
12 % @param alpha Rate parameters (Mx N matrix).
13 % @param c Constant offset parameter (
default: auto-determined).
14 % @return mu Load-dependent service rates.
15 % @return c Determined offset constant.
18function [mu,c] = pfqn_fnc(alpha,c)
19% generate rates for functional server f(n)=n+c
22 % No rate columns: the caller shifted a single-
column mu with
23 % pfqn_mushift, which returns M x (N-1) and so yields zero columns when the
24 % total population
is 1. There
is no functional-server rate to build, and
25 % the population-N-1 subproblems the caller then forms are empty (G = 1).
26 % Without this guard alpha(ist,1) below indexes an empty array and
27 % SolverNC(model,'method','exact') fails on EVERY closed model whose total
35 mu = pfqn_fnc(alpha,c);
36 % all(isfinite(mu)) reduces per COLUMN for M>1, so the ladder fired only
37 % when EVERY population
column held a non-finite rate; the intent
is any.
38 if any(~isfinite(mu(:))) % first retry with -1/2
40 mu = pfqn_fnc(alpha,c);
44 while any(~isfinite(mu(:))) % randomize c if need be but unlikely
47 % c must stay a 1xM vector: the recursive call indexes c(ist) per
48 % station, so assigning a scalar here made this retry path fail with
49 % "Index exceeds array bounds" for any M > 1.
50 c = (-1/2+dt)*ones(1,M);
51 mu = pfqn_fnc(alpha,c);
58N = length(alpha(1,:));
61 mu(ist,1) = alpha(ist,1)/(1+c(ist));
62 alphanum = sparse(zeros(N,N));
63 alphaden = sparse(zeros(N,N));
65 alphanum(n,1) = alpha(ist,n);
66 alphaden(n,1) = alpha(ist,n-1);
68 alphanum(n,k) = alphanum(n,k-1) * alpha(ist,n-k+1);
69 alphaden(n,k) = alphaden(n,k-1) * alpha(ist,n-k);
76 muden = muden * mu(ist,k);
77 rho = rho+(alphanum(n,k)-alphaden(n,k)) / muden;
79 mu(ist,n) = alphanum(n,n-1)*alpha(ist,1)/muden;
80 mu(ist,n) = mu(ist,n)/(1-rho);
84mu(abs(mu)>1e15) = Inf;
86 if any(isinf(mu(ist,:)))
87 s = min(find(isinf(mu(ist,:))));