LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
DPHFromMG.m
1% [beta, B] = DPHFromMG(alpha, A, precision)
2%
3% Obtains a Markovian representation of a matrix
4% geometric distribution of the same size, if possible.
5%
6% Parameters
7% ----------
8% alpha : vector, shape (1,M)
9% The initial vector of the matrix-geometric
10% distribution.
11% A : matrix, shape (M,M)
12% The matrix parameter of the matrix-geometric
13% distribution.
14% precision : double, optional
15% A representation is considered to be a Markovian one
16% if it is closer than the precision
17%
18% Returns
19% -------
20% beta : vector, shape (1,M)
21% The initial probability vector of the Markovian
22% representation
23% B : matrix, shape (M,M)
24% Transition probability matrix of the Markovian
25% representation
26%
27% References
28% ----------
29% .. [1] G Horváth, M Telek, "A minimal representation of
30% Markov arrival processes and a moments matching
31% method," Performance Evaluation 64:(9-12) pp.
32% 1153-1168. (2007)
33
34function [beta, B] = DPHFromMG (alpha, A, precision)
35
36 function nrep = transfun (orep, B)
37 nrep = {orep{1}*B, inv(B)*orep{2}*B};
38 end
39
40 function d = evalfun (orep, k)
41 if nargin<2
42 k = 0;
43 end
44 ao = orep{1};
45 Ao = orep{2};
46 av = 1-sum(Ao,2);
47 Ad = Ao - diag(diag(Ao));
48 if rem(k,2) == 0
49 d = -min([min(ao), min(av), min(min(Ad))]);
50 else
51 d = -sum(ao(ao<0)) - sum(av(av<0)) - sum(sum(Ad(Ad<0)));
52 end
53 end
54
55 if ~exist('precision','var')
56 precision = 1e-14;
57 end
58
59 global BuToolsCheckInput;
60 if isempty(BuToolsCheckInput)
61 BuToolsCheckInput = true;
62 end
63
64 if BuToolsCheckInput && ~CheckMGRepresentation(alpha, A)
65 error('DPHFromMG: Input isn''t a valid MG distribution!');
66 end
67
68 nrep = FindMarkovianRepresentation ({alpha, A}, @transfun, @evalfun, precision);
69 beta = nrep{1};
70 B = nrep{2};
71end
72