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