3 % @file pfqn_linearizermx.m
4 % @brief Linearizer
for mixed open/closed queueing networks.
10 % @brief Linearizer
for mixed open/closed queueing networks.
11 % @fn pfqn_linearizermx(lambda, L, N, Z, nservers, type, tol, maxiter, method)
12 % @param lambda Arrival rate vector (inf
for closed classes).
13 % @param L Service demand matrix.
14 % @param N Population vector (inf
for open classes).
15 % @param Z Think time vector.
16 % @param nservers Number of servers per station.
17 % @param type Scheduling strategy per station.
18 % @param tol Convergence tolerance (
default: 1e-8).
19 % @param maxiter Maximum iterations (default: 1000).
20 % @param method Linearizer variant (
'lin',
'gflin',
'egflin', default:
'egflin').
21 % @return QN Mean queue lengths.
22 % @return UN Utilization.
23 % @return WN Waiting times.
24 % @return CN Cycle times.
25 % @return XN System throughput.
26 % @return totiter Total iterations.
29function [QN,UN,WN,CN,XN,totiter] = pfqn_linearizermx(lambda,L,N,Z,nservers,type,tol,maxiter,method,QN0)
30% function [Q,U,W,C,X,totiter] = PFQN_LINEARIZERMX(lambda,L,N,Z,nservers,type,tol,maxiter,method)
42if any(N(lambda>0)>0 & isfinite(N(lambda>0)))
43 line_error(mfilename,'Arrival rate cannot be specified on closed classes.');
47if nargin<6 || isempty(type)
48 type = ones(M,1)*SchedStrategy.PS;
51lambda(isnan(lambda))= 0;
54openClasses = find(isinf(N));
55closedClasses = setdiff(1:length(N), openClasses);
62for ridx=1:length(openClasses)
63 r = openClasses(ridx);
65 UN(ist,r) = lambda(r)*L(ist,r);
77Dc = L(:,closedClasses) ./ (1-repmat(UNt,1,length((closedClasses))));
79% initial closed-class queue lengths (warm start) aligned to
the algorithm layout
80if nargin<10 || isempty(QN0)
82elseif size(QN0,1)==M && size(QN0,2)==length(N)
83 QN0c = QN0(:,closedClasses);
84elseif size(QN0,1)==M && size(QN0,2)==length(closedClasses)
91 case {
'default',
'lin'}
92 [QNc,UNc,WNc,CNc,XNc,totiter] = pfqn_linearizer(Dc,N(closedClasses),Z(closedClasses),type,tol,maxiter,QN0c);
95 [QNc,UNc,WNc,CNc,XNc,totiter] = pfqn_gflinearizer(Dc,N(closedClasses),Z(closedClasses),type,tol,maxiter,linAlpha,QN0c);
98 for ridx=1:length(closedClasses)
99 r = closedClasses(ridx);
100 alphaM(r) = 0.6 + 1.4 * exp(-8 * exp(-0.8 * N(r)));
102 [QNc,UNc,WNc,CNc,XNc,totiter] = pfqn_egflinearizer(Dc,N(closedClasses),Z(closedClasses),type,tol,maxiter,alphaM,QN0c);
104 [QNc,UNc,WNc,CNc,XNc,totiter] = pfqn_linearizer(Dc,N(closedClasses),Z(closedClasses),type,tol,maxiter,QN0c);
107 [QNc,UNc,WNc,CNc,XNc,totiter] = pfqn_linearizerms(Dc,N(closedClasses),Z(closedClasses),nservers,type,tol,maxiter,QN0c);
110XN(closedClasses) = XNc;
111QN(:,closedClasses) = QNc;
112WN(:,closedClasses) = WNc;
113UN(:,closedClasses) = UNc;
114CN(closedClasses) = CNc;
117 for ridx=1:length(closedClasses)
118 r = closedClasses(ridx);
119 UN(ist,r) = XN(r)*L(ist,r);
123 for ridx=1:length(openClasses)
124 r = openClasses(ridx);
126 WN(ist,r) = L(ist,r) / (1-UNt(ist));
128 WN(ist,r) = L(ist,r) * (1+sum(QNc(ist,:))) / (1-UNt(ist));
130 QN(ist,r) = WN(ist,r) * XN(r);
133CN(openClasses) = sum(WN(:,openClasses),1);