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 if ~all(isfinite(mu)) % first retry with -1/2
38 mu = pfqn_fnc(alpha,c);
42 while ~all(isfinite(mu)) % randomize c if need be but unlikely
45 % c must stay a 1xM vector:
the recursive call indexes c(ist) per
46 % station, so assigning a scalar here made this retry path fail with
47 % "Index exceeds array bounds" for any M > 1.
48 c = (-1/2+dt)*ones(1,M);
49 mu = pfqn_fnc(alpha,c);
56N = length(alpha(1,:));
59 mu(ist,1) = alpha(ist,1)/(1+c(ist));
60 alphanum = sparse(zeros(N,N));
61 alphaden = sparse(zeros(N,N));
63 alphanum(n,1) = alpha(ist,n);
64 alphaden(n,1) = alpha(ist,n-1);
66 alphanum(n,k) = alphanum(n,k-1) * alpha(ist,n-k+1);
67 alphaden(n,k) = alphaden(n,k-1) * alpha(ist,n-k);
74 muden = muden * mu(ist,k);
75 rho = rho+(alphanum(n,k)-alphaden(n,k)) / muden;
77 mu(ist,n) = alphanum(n,n-1)*alpha(ist,1)/muden;
78 mu(ist,n) = mu(ist,n)/(1-rho);
82mu(abs(mu)>1e15) = Inf;
84 if any(isinf(mu(ist,:)))
85 s = min(find(isinf(mu(ist,:))));