1% Ret = MAPMAP1(D0, D1, S0, S1, ...)
3% Returns various performane measures of a continuous time
6% In a MAP/MAP/1 queue both the arrival and the service
7% processes are characterized by Markovian arrival
12% D0 : matrix, shape(N,N)
13% The transitions of the arrival MAP not accompanied by
15% D1 : matrix, shape(N,N)
16% The transitions of the arrival MAP accompanied by
18% S0 : matrix, shape(N,N)
19% The transitions of the service MAP not accompanied by
21% S1 : matrix, shape(N,N)
22% The transitions of the service MAP accompanied by
25% The rest of the function parameters specify the options
26% and the performance measures to be computed.
28% The supported performance measures and options in
this
31% +----------------+--------------------+----------------------------------------+
32% | Parameter name | Input parameters | Output |
33% +================+====================+========================================+
34% |
"ncMoms" | Number of moments | The moments of the number of customers |
35% +----------------+--------------------+----------------------------------------+
36% |
"ncDistr" | Upper limit K | The distribution of the number of |
37% | | | customers from level 0 to level K-1 |
38% +----------------+--------------------+----------------------------------------+
39% |
"ncDistrMG" | None | The vector-matrix parameters of the |
40% | | | matrix-geometric distribution of the |
41% | | | number of customers in the system |
42% +----------------+--------------------+----------------------------------------+
43% |
"ncDistrDPH" | None | The vector-matrix parameters of the |
44% | | | matrix-geometric distribution of the |
45% | | | number of customers in the system, |
46% | | | converted to a discrete PH |
47% | | | representation |
48% +----------------+--------------------+----------------------------------------+
49% |
"stMoms" | Number of moments | The sojourn time moments |
50% +----------------+--------------------+----------------------------------------+
51% |
"stDistr" | A vector of points | The sojourn time distribution at the |
52% | | | requested points (cummulative, cdf) |
53% +----------------+--------------------+----------------------------------------+
54% |
"stDistrME" | None | The vector-matrix parameters of the |
55% | | | matrix-exponentially distributed |
56% | | | sojourn time distribution |
57% +----------------+--------------------+----------------------------------------+
58% |
"stDistrPH" | None | The vector-matrix parameters of the |
59% | | | matrix-exponentially distributed |
60% | | | sojourn time distribution, converted |
61% | | | to a continuous PH representation |
62% +----------------+--------------------+----------------------------------------+
63% |
"prec" | The precision | Numerical precision used as a stopping |
64% | | | condition when solving the |
65% | | | matrix-quadratic equation |
66% +----------------+--------------------+----------------------------------------+
68% (The quantities related to the number of customers in
69% the system include the customer in the server, and the
70% sojourn time related quantities include the service
75% Ret : list of the performance measures
76% Each entry of the list corresponds to a performance
77% measure requested. If there
is just a single item,
78% then it
is not put into a list.
81%
"ncDistrMG" and
"stDistrME" behave much better numerically than
82%
"ncDistrDPH" and
"stDistrPH".
84function varargout = MAPMAP1(D0, D1, S0, S1, varargin)
90 for i=1:length(varargin)
91 if strcmp(varargin{i},
'prec')
93 eaten = [eaten, i, i+1];
94 elseif length(varargin{i})>2 && strcmp(varargin{i}(1:2),
'st')
99 global BuToolsCheckInput;
101 if isempty(BuToolsCheckInput)
102 BuToolsCheckInput = true;
105 if BuToolsCheckInput && ~CheckMAPRepresentation(D0,D1)
106 error('MAPMAP1: The arrival process (D0,D1)
is not a valid MAP representation!');
109 if BuToolsCheckInput && ~CheckMAPRepresentation(S0,S1)
110 error('MAPMAP1: The service process (S0,S1)
is not a valid MAP representation!');
113 IA = eye(size(D0,1));
114 IS = eye(size(S0,1));
117 L = kron(D0,IS)+kron(IA,S0);
121 [pi0, R] = QBDSolve (B, L, F, L0, prec);
126 % calculate the distribution of the age at departures
129 T = kron(IA,S0) + Rh * B;
130 eta = pi0*F*inv(I-Rh);
136 while argIx<=length(varargin)
137 if any(ismember(eaten, argIx))
140 elseif strcmp(varargin{argIx},
'ncDistrDPH')
141 % transform it to DPH
142 alpha = pi0*R*inv(eye(N)-R);
143 A = inv(diag(alpha))*R
'*diag(alpha);
146 elseif strcmp(varargin{argIx},'ncDistrMG
')
148 B = SimilarityMatrixForVectors(sum(inv(I-R)*R,2), ones(N,1));
154 elseif strcmp(varargin{argIx},'ncMoms
')
155 numOfMoms = varargin{argIx+1};
157 moms = zeros(1,numOfMoms);
160 moms(m) = factorial(m)*sum(pi0*iR^(m+1)*R^m);
162 Ret{end+1} = MomsFromFactorialMoms(moms);
163 elseif strcmp(varargin{argIx},'ncDistr
')
164 numOfQLProbs = varargin{argIx+1};
166 values = zeros(1,numOfQLProbs);
167 values(1) = sum(pi0);
169 for p=1:numOfQLProbs-1
171 values(p+1) = sum(pi0*RPow);
174 elseif strcmp(varargin{argIx},'stDistrPH
')
175 % transform it to PH representation
176 beta = CTMCSolve(S0+S1);
177 theta = DTMCSolve(inv(-D0)*D1);
178 vv = kron(theta,beta);
181 delta = diag(vv(nz));
182 alpha = ones(1,N)*B(nz,:)'*delta / sum(beta*S1);
183 A = inv(delta)*T(nz,nz)
'*delta;
186 elseif strcmp(varargin{argIx},'stDistrME
')
189 elseif strcmp(varargin{argIx},'stMoms
')
190 numOfMoms = varargin{argIx+1};
192 moms = zeros(1,numOfMoms);
195 moms(m) = factorial(m)*sum(eta*iT^m);
198 elseif strcmp(varargin{argIx},'stDistr
')
199 points = varargin{argIx+1};
201 values = zeros(size(points));
202 for p=1:length(points)
203 values(p) = 1-sum(eta*expm(T*points(p)));
207 error (['MAPMAP1: Unknown parameter
' varargin{argIx}])