LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
npfqn_nonexp_approx.m
1function [ST,gamma,nservers,rho,scva,scvs,eta] = npfqn_nonexp_approx(method,sn,ST,V,SCV,T,U,gamma,nservers)
2% handler for non-exponential service and arrival processes
3M = sn.nstations;
4rho = zeros(M,1);
5scva = ones(M,1);
6scvs = ones(M,1);
7eta = ones(M,1);
8switch method
9 case {'default','none'}
10 % no-op
11 case {'hvmva'}
12 % no-op
13 case {'interp'}
14 for ist=1:M
15 nnzClasses = isfinite(ST(ist,:)) & isfinite(SCV(ist,:));
16 rho(ist) = sum(U(ist,nnzClasses));
17 if ~isempty(nnzClasses) && any(nnzClasses)
18 switch sn.sched(ist)
19 case SchedStrategy.FCFS
20 if range(ST(ist,nnzClasses))>0 || (max(SCV(ist,nnzClasses))>1 + GlobalConstants.FineTol || min(SCV(ist,nnzClasses))<1 - GlobalConstants.FineTol) % check if non-product-form
21 scva(ist) = 1; %use a M/G/k approximation
22 scvs(ist) = (SCV(ist,nnzClasses)*T(ist,nnzClasses)')/sum(T(ist,nnzClasses));
23 % multi-server asymptotic decay rate
24 gamma(ist) = (rho(ist)^nservers(ist)+rho(ist))/2;
25
26 if scvs(ist) > 1-1e-6 && scvs(ist) < 1+1e-6 && nservers(ist)==1
27 eta(ist) = rho(ist);
28 %continue % use M/M/1
29 else
30 % single-server (diffusion approximation, Kobayashi JACM)
31 eta(ist) = exp(-2*(1-rho(ist))/(scvs(ist)+scva(ist)*rho(ist)));
32 %[~,eta(i)]=qsys_gig1_approx_klb(sum(T(i,nnzClasses)),sum(T(i,nnzClasses))/rho(i),sqrt(scva(i)),sqrt(scvs(i)));
33 end
34 % interpolation (Sec. 4.2, LINE paper at WSC 2020)
35 % ai, bi coefficient here set to the 8th power as
36 % numerically appears to be better than 4th power
37 order = 8;
38 ai = rho(ist)^order;
39 bi = rho(ist)^order;
40 % for all classes
41 for k=find(nnzClasses)
42 if sn.rates(ist,k)>0
43 ST(ist,k) = max(0,1-ai)*ST(ist,k) + ai*(bi*eta(ist) + max(0,1-bi)*gamma(ist))*(nservers(ist)/sum(T(ist,nnzClasses)));
44 end
45 end
46 % we are already account for multi-server effects
47 % in the scaled service times
48 nservers(ist) = 1;
49 end
50 end
51 end
52 end
53end % method
54end