3 % @file pfqn_procomom2.m
4 % @brief Product-form CoMoM
for 2-station repairman model (queue + delay).
10 % @brief Product-form CoMoM
for 2-station repairman model (queue + delay).
11 % @fn pfqn_procomom2(L, N, Z, mu, m)
12 % @param L Service demand vector.
13 % @param N Population vector.
14 % @param Z Think time vector.
15 % @param mu Load-dependent rates (optional).
16 % @param m Replication factor (
default: 1).
17 % @return pk Marginal state probabilities.
18 % @return lG Logarithm of normalizing constant.
19 % @return G Normalizing constant.
20 % @return T Transfer matrices.
21 % @return F Product transfer matrix.
22 % @return B Combined transfer matrix.
25function [pk,lG,G,T,F,B]=pfqn_procomom2(L,N,Z,mu,m)
26% Marginal state probabilities for the queue in a model consisting of a
27% queueing station and a delay station only.
29if nargin<4 || isempty(mu)
30 mu = ones(m,sum(N)+1);
38% compute solution for [1,0,0,...,0]
39p0 = zeros(sum(N)+1,1); p0(end)=1;
44 T{r} = sparse(1+sum(N),1+sum(N));
48 T{r}(row,row+1) = (n+m-1)*L(r)/mu(1+n);
50 T{r}(sum(N)+1,sum(N)+1) = Z(r);
55 F = F*T{r}^N(r)/factorial(N(r));
60if any(~isfinite(pk(1,1))) || ~isfinite(G)
62 lG = logsumexp(log(pk(1,:)));
64 lG = logsumexp(log(pk(1,:)));
74 psingle(n+1)= pk(n+1);
76psingle=psingle/sum(psingle);
78 Q=Q + n * psingle(n+1);
79% V=V + (n^2-n) * psingle(n+1);
83[XNMVA,QNMVA,~,~,~,~,pik]=pfqn_mvald(repmat(L,m,1),N,Z,repmat(mu(:,2:end),m,1))
86% VNMVA=VNMVA+(n^2-n)*pik(1,:);