LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
pfqn_linearizermx.m
1%{
2%{
3 % @file pfqn_linearizermx.m
4 % @brief Linearizer for mixed open/closed queueing networks.
5%}
6%}
7
8%{
9%{
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.
27%}
28%}
29function [QN,UN,WN,CN,XN,totiter] = pfqn_linearizermx(lambda,L,N,Z,nservers,type,tol,maxiter,method)
30% function [Q,U,W,C,X,totiter] = PFQN_LINEARIZERMX(lambda,L,N,Z,nservers,type,tol,maxiter,method)
31
32if nargin<4
33 maxiter = 1000;
34end
35if nargin<5
36 tol = 1e-8;
37end
38if nargin<9
39 method = 'egflin';
40end
41
42if any(N(lambda>0)>0 & isfinite(N(lambda>0)))
43 line_error(mfilename,'Arrival rate cannot be specified on closed classes.');
44end
45
46[M,R] = size(L);
47if nargin<6 || isempty(type)
48 type = ones(M,1)*SchedStrategy.PS;
49end
50
51lambda(isnan(lambda))= 0;
52L(isnan(L))=0;
53Z(isnan(Z))=0;
54openClasses = find(isinf(N));
55closedClasses = setdiff(1:length(N), openClasses);
56
57XN = zeros(1,R);
58UN = zeros(M,R);
59WN = zeros(M,R);
60QN = zeros(M,R);
61CN = zeros(1,R);
62for r=openClasses
63 for ist=1:M
64 UN(ist,r) = lambda(r)*L(ist,r);
65 end
66 XN(r) = lambda(r);
67end
68
69UNt = sum(UN,2);
70
71if isempty(Z)
72 Z = zeros(1,R);
73else
74 Z = sum(Z,1);
75end
76Dc = L(:,closedClasses) ./ (1-repmat(UNt,1,length((closedClasses))));
77
78if max(nservers)==1
79 switch method
80 case {'default','lin'}
81 [QNc,UNc,WNc,CNc,XNc,totiter] = pfqn_linearizer(Dc,N(closedClasses),Z(closedClasses),type,tol,maxiter);
82 case 'gflin'
83 linAlpha = 2.0;
84 [QNc,UNc,WNc,CNc,XNc,totiter] = pfqn_gflinearizer(Dc,N(closedClasses),Z(closedClasses),type,tol,maxiter,linAlpha);
85 case 'egflin'
86 alphaM = zeros(1,R);
87 for r=closedClasses
88 alphaM(r) = 0.6 + 1.4 * exp(-8 * exp(-0.8 * N(r)));
89 end
90 [QNc,UNc,WNc,CNc,XNc,totiter] = pfqn_egflinearizer(Dc,N(closedClasses),Z(closedClasses),type,tol,maxiter,alphaM);
91 otherwise
92 [QNc,UNc,WNc,CNc,XNc,totiter] = pfqn_linearizer(Dc,N(closedClasses),Z(closedClasses),type,tol,maxiter);
93 end
94else
95 [QNc,UNc,WNc,CNc,XNc,totiter] = pfqn_linearizerms(Dc,N(closedClasses),Z(closedClasses),nservers,type,tol,maxiter);
96end
97
98XN(closedClasses) = XNc;
99QN(:,closedClasses) = QNc;
100WN(:,closedClasses) = WNc;
101UN(:,closedClasses) = UNc;
102CN(closedClasses) = CNc;
103
104for ist = 1:M
105 for r=closedClasses
106 UN(ist,r) = XN(r)*L(ist,r);
107 end
108end
109for ist = 1:M
110 for r=openClasses
111 if isempty(QNc)
112 WN(ist,r) = L(ist,r) / (1-UNt(ist));
113 else
114 WN(ist,r) = L(ist,r) * (1+sum(QNc(ist,:))) / (1-UNt(ist));
115 end
116 QN(ist,r) = WN(ist,r) * XN(r);
117 end
118end
119CN(openClasses) = sum(WN(:,openClasses),1);
120end
121