3 % @file pfqn_egflinearizer.m
4 % @brief Extended generalized fixed-point Linearizer approximation.
10 % @brief Extended generalized fixed-point Linearizer approximation.
11 % @fn pfqn_egflinearizer(L, N, Z, type, tol, maxiter, alpha)
12 % @param L Service demand matrix.
13 % @param N Population vector.
14 % @param Z Think time vector.
15 % @param type Scheduling strategy type per station.
16 % @param tol Convergence tolerance (
default: 1e-8).
17 % @param maxiter Maximum number of iterations (default: 1000).
18 % @param alpha Per-class scaling exponent vector.
19 % @return Q Mean queue lengths.
20 % @return U Utilization.
21 % @return W Waiting times.
22 % @return C Cycle times.
23 % @return X System throughput.
24 % @return totiter Total iterations performed.
27function [Q,U,W,C,X,totiter] = pfqn_egflinearizer(L,N,Z,type,tol,maxiter,alpha)
28% Single-server version of linearizer
42if isempty(L) || all(max(L)==0)
62 [~,q] = pfqn_bs(L,N_1,Z);
72 N_1 = oner(N,s); % for k=0 it just returns N
74 [Q(:,:,1+s),~,~,iter] = Core(L,M,R,N_1,Z,Q(:,:,1+s),Delta,type,tol,maxiter-totiter,alpha);
75 totiter = totiter + iter;
86 Delta(i,r,s) = Q(i,r,1+s)/Ns(r)^alpha(r) - Q(i,r,1+0)/N(r)^alpha(r);
95[Q,W,X,iter] = Core(L,M,R,N,Z,Q(:,:,1+0),Delta,type,tol,maxiter-totiter,alpha);
96totiter = totiter + iter;
97% Compute performance metrics
108function [Q,W,T,iter] = Core(L,M,R,N_1,Z,Q,Delta,type,tol,maxiter,alpha)
114 % Estimate population at
115 Q_1 = Estimate(L,M,R,N_1,Z,Q,Delta,W,alpha);
117 [Q,W,T] = ForwardMVA(L,M,R,type,N_1,Z,Q_1);
118 if enorm(Q-Qlast)<tol || iter > maxiter
125function [Q_1,T_1] = Estimate(~,M,R,N_1,~,Q,Delta,~,alpha)
132 Q_1(i,r,1+s) = Ns(r)^alpha(r)*(Q(i,r,1+0)/N_1(r)^alpha(r) + Delta(i,r,s));
137% This part
is not used in Core so commented out
141% % initial guess based on balanced job bound
142% % helpful in case no stations with positive demand exists
143% T_1(s,1+r) = Nr(s) / (Z(s) + max(L(:,s))*(sum(Nr)-1));
146% T_1(s,1+r) = Nr(s)*(Q(i,s)/N_1(s) + Delta(i,r,s))/W(i,s,1+0);
154function [Q,W,T] = ForwardMVA(L,M,R,type,N_1,Z,Q_1)
159% Compute residence time
162 if type(ist) == SchedStrategy.FCFS
166 W(ist,r) = W(ist,r) + L(ist,s)*Q_1(ist,s,1+r);
170 W(ist,r) = L(ist,r)*(1+sum(Q_1(ist,:,1+r)));
176% Compute throughputs and qlens
178 T(r) = N_1(r) / (Z(r)+sum(W(:,r)));
180 Q(ist,r) = T(r) * W(ist,r);