3 % @file pfqn_nc_sanitize.m
4 % @brief Sanitize and preprocess network parameters
for NC solvers.
10 % @brief Sanitize and preprocess network parameters
for NC solvers.
11 % @fn pfqn_nc_sanitize(lambda, L, N, Z, atol)
12 % @param lambda Arrival rate vector.
13 % @param L Service demand matrix.
14 % @param N Population vector.
15 % @param Z Think time vector.
16 % @param atol Absolute tolerance.
17 % @
return lambda Sanitized arrival rates.
18 % @
return L Sanitized service demands (rescaled).
19 % @
return N Sanitized populations.
20 % @
return Z Sanitized think times (rescaled).
21 % @
return lGremaind Log normalization factor from removed
classes.
24function [lambda,L,N,Z,lGremaind] = pfqn_nc_sanitize(lambda,L,N,Z,atol)
32lambda=lambda(:,nnzclasses);
34zeroclasses=find((sum(L,1)+sum(Z,1))<atol);
38lambda(:,zeroclasses)=[];
42zerodemands=find(L<atol);
43if ~isempty(zerodemands)
44 lGremaind = lGremaind + N(zerodemands) * log(Z(zerodemands))
' - sum(log(N(zerodemands)));
50Lmax = max(L,[],1); % use L, which has been santized to always be ~=0
52 Lmax = ones(1,size(Z,2));
54L = L./repmat(Lmax,size(L,1),1);
55Z = Z./repmat(Lmax,size(Z,1),1);
56lGremaind = lGremaind + N*log(Lmax)';
57% sort from smallest to largest think time
59 [~,rsort] = sort(sum(Z,1),
'ascend');
66% ensure zero think time
classes are anyway frist
67zerothinktimes=find(Z<atol);
68nonzerothinktimes = setdiff(1:size(L,2),zerothinktimes);
69L=L(:,[zerothinktimes,nonzerothinktimes]);
70N=N(:,[zerothinktimes,nonzerothinktimes]);
71Z=Z(:,[zerothinktimes,nonzerothinktimes]);