LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
sum_closing.m
1function [XN,QN,UN,RN,TN,it] = sum_closing(lambda0,scva,L,mi,scv,N,Z,Kclosed,tol,maxiter)
2% [XN,QN,UN,RN,TN,IT] = SUM_CLOSING(LAMBDA0,SCVA,L,MI,SCV,N,Z,KCLOSED,TOL,MAXITER)
3%
4% Closing method for open and mixed non-product-form queueing networks
5% (Bolch et al., Sec. 10.1.5), solved with the summation method.
6%
7% The external world of each open class is replaced by an additional
8% -/G/1 station with service rate mu_inf,r = Ropen*lambda0(r), where Ropen
9% is the number of open classes, service SCV equal to the interarrival
10% time SCV of the open class, and unit visit ratio. The resulting closed
11% network is then solved by SUM_CLOSED with a large population KCLOSED
12% for the open classes (default: 5000, as recommended for the summation
13% method). Closed classes are passed through unchanged, which makes the
14% method applicable to mixed networks.
15%
16% Input:
17% lambda0 - 1xR external arrival rates (0 for closed classes)
18% scva - 1xR interarrival time SCVs of the open classes (1 if Poisson)
19% L - MxR service demand matrix of the original network, with visit
20% ratios of open classes normalized per external arrival
21% mi - Mx1 number of servers (Inf for infinite-server stations)
22% scv - MxR service time SCVs (pass 1 for insensitive stations)
23% N - 1xR populations: Inf (or NaN) for open classes, finite
24% integers for closed classes
25% Z - 1xR think times
26% Kclosed - closing population for the open classes (default: 5000)
27% tol - convergence tolerance (default: 1e-6)
28% maxiter - maximum number of iterations (default: 10000)
29%
30% Output:
31% XN - 1xR class throughputs (for open classes, XN approaches lambda0
32% from below as KCLOSED grows)
33% QN - MxR mean queue lengths at the original stations
34% UN - MxR utilizations at the original stations
35% RN - MxR residence times at the original stations
36% TN - 1xR mean response time in the original network, TN=sum(QN)./XN
37% it - number of iterations
38%
39% Reference: G. Bolch, S. Greiner, H. de Meer, K.S. Trivedi, Queueing
40% Networks and Markov Chains, 2nd ed., Wiley, 2006, Sec. 10.1.5.
41
42% Copyright (c) 2012-2026, Imperial College London
43% All rights reserved.
44
45[M,R] = size(L);
46lambda0 = lambda0(:)';
47if nargin<2 || isempty(scva), scva = ones(1,R); end
48if nargin<4 || isempty(mi), mi = ones(M,1); end
49if nargin<5 || isempty(scv), scv = ones(M,R); end
50if nargin<6 || isempty(N), N = Inf*ones(1,R); end
51if nargin<7 || isempty(Z), Z = zeros(1,R); end
52if nargin<8 || isempty(Kclosed), Kclosed = 5000; end
53if nargin<9 || isempty(tol), tol = 1e-6; end
54if nargin<10 || isempty(maxiter), maxiter = 10000; end
55scva = scva(:)';
56N = N(:)';
57Z = Z(:)';
58
59openClasses = find(lambda0>0);
60Ropen = length(openClasses);
61if Ropen==0
62 line_error(mfilename,'No open class: use sum_closed for closed networks.');
63end
64
65% augment with the closing -/G/1 station, visited by open classes only
66Laug = [L; zeros(1,R)];
67scvaug = [scv; ones(1,R)];
68Naug = N;
69for r=openClasses
70 Laug(M+1,r) = 1/(Ropen*lambda0(r));
71 scvaug(M+1,r) = scva(r);
72 Naug(r) = Kclosed;
73end
74miaug = [mi(:); 1];
75
76[XN,QNa,UNa,RNa,it] = sum_closed(Laug,Naug,Z,miaug,scvaug,tol,maxiter);
77
78QN = QNa(1:M,:);
79UN = UNa(1:M,:);
80RN = RNa(1:M,:);
81TN = zeros(1,R);
82for r=1:R
83 if XN(r)>0
84 TN(r) = sum(QN(:,r))/XN(r);
85 end
86end
87end
Definition Station.m:245