LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
MMAPFromMRAP.m
1% D = MMAPFromMRAP(H, precision)
2%
3% Obtains a Markovian representation of a rational
4% arrival process of the same size, if possible, using the
5% procedure published in [1]_.
6%
7% Parameters
8% ----------
9% H : list/cell of matrices of shape(M,M), length(N)
10% The H0...HN matrices of the MRAP to transform
11% precision : double, optional
12% A representation is considered to be a Markovian one
13% if it is closer to it than this precision
14%
15% Returns
16% -------
17% D : list/cell of matrices of shape(M,M), length(N)
18% The D0...DN matrices of the MMAP (if found)
19%
20% References
21% ----------
22% .. [1] András Horváth, Gábor Horváth, Miklós Telek, "A
23% traffic based decomposition of two-class queueing
24% networks with priority service". COMPUTER NETWORKS
25% 53:(8) pp. 1235-1248. (2009)
26
27function D = MMAPFromMRAP (H,prec)
28
29 if ~exist('prec','var')
30 prec = 1e-14;
31 end
32
33 global BuToolsCheckInput;
34 if isempty(BuToolsCheckInput)
35 BuToolsCheckInput = true;
36 end
37
38 if BuToolsCheckInput && ~CheckMRAPRepresentation(H)
39 error('MMAPFromMRAP: Input isn''t a valid MRAP representation');
40 end
41
42 function nH = transfun (oH, B)
43 nH = cell(1,length(oH));
44 for i=1:length(oH)
45 nH{i} = inv(B)*oH{i}*B;
46 end
47 end
48
49 function dist = evalfun (oH, k)
50 if nargin<2
51 k = 0;
52 end
53 oH0 = oH{1} - diag(diag(oH{1}));
54 if rem(k,2) == 0
55 dist = min(min(oH0));
56 for k=2:length(oH)
57 dist = min(dist, min(min(oH{k})));
58 end
59 else
60 dist = sum(oH0(oH0<0));
61 for k=2:length(oH)
62 oHk = oH{k};
63 dist = dist + sum(oHk(oHk<0));
64 end
65 end
66 dist = -dist;
67 end
68
69 D = FindMarkovianRepresentation (H, @transfun, @evalfun, prec);
70end