butools.map.MMAPFromMRAP¶
-
butools.map.
MMAPFromMRAP
()¶ Matlab: D = MMAPFromMRAP(H, precision)
Mathematica: D = MMAPFromMRAP[H, precision]
Python/Numpy: D = MMAPFromMRAP(H, precision)
Obtains a Markovian representation of a rational arrival process of the same size, if possible, using the procedure published in [R28].
Parameters: H : list/cell of matrices of shape(M,M), length(N)
The H0...HN matrices of the MRAP to transform
precision : double, optional
A representation is considered to be a Markovian one if it is closer to it than this precision
Returns: D : list/cell of matrices of shape(M,M), length(N)
The D0...DN matrices of the MMAP (if found)
References
[R28] (1, 2) András Horváth, Gábor Horváth, Miklós Telek, “A traffic based decomposition of two-class queueing networks with priority service”. COMPUTER NETWORKS 53:(8) pp. 1235-1248. (2009) Examples
For Matlab:
>>> x = 0.18; >>> H0 = [-5., 0.1+x, 0.9, 1.; 1., -8., 0.9, 0.1; 0.9, 0.1, -4., 1.; 1., 2., 3., -9.]; >>> H1 = [0.1-x, 0.7, 0.1, 0.1; 0.1, 1., 1.8, 0.1; 0.1, 0.1, 0.1, 0.7; 0.7, 0.1, 0.1, 0.1]; >>> H2 = [0.1, 0.1, 0.1, 1.7; 1.8, 0.1, 1., 0.1; 0.1, 0.1, 0.7, 0.1; 0.1, 1., 0.1, 0.8]; >>> H = {H0, H1, H2}; >>> moms = MarginalMomentsFromMRAP(H); >>> disp(moms); Columns 1 through 6 0.33951 0.24583 0.27424 0.41206 0.77677 1.7594 Column 7 4.6515 >>> jmom = LagkJointMomentsFromMRAP(H, 3, 1); >>> G = MMAPFromMRAP(H); >>> disp(G{1}); -4.6311 0.17674 0.85564 0.92969 1.0899 -8.0182 0.6718 0.037188 1.2592 0.039062 -4.2279 0.92969 0.85625 2.0472 3.0031 -9.1228 >>> disp(G{2}); 0.013162 0.54118 0.10313 0.19567 0.21755 0.95606 1.8821 0.088018 0.2338 0.055469 0.059953 0.65078 0.96289 0.065679 0.030318 0.09082 >>> disp(G{3}); 0.3392 0.016891 0.1532 1.3066 2.3529 0.093338 0.62233 0.0070033 0.14415 0.088281 0.6746 0.092969 0.41951 0.96644 0.087782 0.59286 >>> rmoms = MarginalMomentsFromMMAP(G); >>> disp(rmoms); Columns 1 through 6 0.33951 0.24583 0.27424 0.41206 0.77677 1.7594 Column 7 4.6515 >>> rjmom = LagkJointMomentsFromMMAP(G, 3, 1); >>> err = norm(rjmom{1}-jmom{1})+norm(rjmom{2}-jmom{2}); >>> disp(err); 1.1874e-15
For Mathematica:
>>> x = 0.18; >>> H0 = {{-5., 0.1+x, 0.9, 1.},{1., -8., 0.9, 0.1},{0.9, 0.1, -4., 1.},{1., 2., 3., -9.}}; >>> H1 = {{0.1-x, 0.7, 0.1, 0.1},{0.1, 1., 1.8, 0.1},{0.1, 0.1, 0.1, 0.7},{0.7, 0.1, 0.1, 0.1}}; >>> H2 = {{0.1, 0.1, 0.1, 1.7},{1.8, 0.1, 1., 0.1},{0.1, 0.1, 0.7, 0.1},{0.1, 1., 0.1, 0.8}}; >>> H = {H0, H1, H2}; >>> moms = MarginalMomentsFromMRAP[H]; >>> Print[moms]; {0.33950747762450084, 0.2458255719823656, 0.2742374276605113, 0.4120601813350093, 0.7767718404933559, 1.7594286078546524, 4.651534763161781} >>> jmom = LagkJointMomentsFromMRAP[H, 3, 1]; >>> G = MMAPFromMRAP[H]; >>> Print[G[[1]]]; {{-4.631096923246836, 0.1767431722689076, 0.8556401694342012, 0.9296874999999999}, {1.089926373504154, -8.018189880952379, 0.6717986882242408, 0.03718750000000001}, {1.2591506958007814, 0.0390625, -4.2279006958007805, 0.9296875}, {0.8562506287479182, 2.047180907362945, 3.0030799771240595, -9.122812499999998}} >>> Print[G[[2]]]; {{0.013161771259610652, 0.5411755660597573, 0.10313314003824185, 0.19567013888888887}, {0.2175499987728381, 0.9560645171957671, 1.8821030700102306, 0.08801828703703704}, {0.23379669189453123, 0.055468750000000004, 0.059953308105468756, 0.65078125}, {0.9628872413087414, 0.065679065237206, 0.03031780115268766, 0.09082040343915343}} >>> Print[G[[3]]]; {{0.33919587344215035, 0.01689127178649242, 0.15319994043895765, 1.3065983796296292}, {2.3528665610661585, 0.09333804012345678, 0.6223335271172633, 0.007003317901234591}, {0.14414825439453127, 0.08828125, 0.6746017456054687, 0.09296875}, {0.4195116361795369, 0.9664386522201472, 0.08778184639867956, 0.5928643408289241}} >>> rmoms = MarginalMomentsFromMMAP[G]; >>> Print[rmoms]; {0.33950747762450095, 0.24582557198236582, 0.2742374276605117, 0.41206018133501016, 0.7767718404933577, 1.7594286078546573, 4.651534763161796} >>> rjmom = LagkJointMomentsFromMMAP[G, 3, 1]; >>> err = Norm[rjmom[[1]]-jmom[[1]]]+Norm[rjmom[[2]]-jmom[[2]]]; >>> Print[err]; 1.1623659668586761*^-15
For Python/Numpy:
>>> x = 0.18 >>> H0 = ml.matrix([[-5., 0.1+x, 0.9, 1.],[1., -8., 0.9, 0.1],[0.9, 0.1, -4., 1.],[1., 2., 3., -9.]]) >>> H1 = ml.matrix([[0.1-x, 0.7, 0.1, 0.1],[0.1, 1., 1.8, 0.1],[0.1, 0.1, 0.1, 0.7],[0.7, 0.1, 0.1, 0.1]]) >>> H2 = ml.matrix([[0.1, 0.1, 0.1, 1.7],[1.8, 0.1, 1., 0.1],[0.1, 0.1, 0.7, 0.1],[0.1, 1., 0.1, 0.8]]) >>> H = [H0, H1, H2] >>> moms = MarginalMomentsFromMRAP(H) >>> print(moms) [0.33950747762450084, 0.24582557198236554, 0.27423742766051129, 0.41206018133500932, 0.7767718404933559, 1.7594286078546524, 4.6515347631617807] >>> jmom = LagkJointMomentsFromMRAP(H, 3, 1) >>> G = MMAPFromMRAP(H) >>> print(G[0]) [[-4.64977 0.17674 0.87432 0.92969] [ 1.08918 -8.01819 0.67255 0.03719] [ 1.24047 0.03906 -4.20922 0.92969] [ 0.92119 2.04995 2.92193 -9.12281]] >>> print(G[1]) [[ 0.00923 0.54118 0.10706 0.19567] [ 0.21578 0.95606 1.88387 0.08802] [ 0.22072 0.05547 0.07303 0.65078] [ 0.95681 0.07544 0.03283 0.08168]] >>> print(G[2]) [[ 0.31295 0.01689 0.17945 1.3066 ] [ 2.35273 0.09334 0.62247 0.007 ] [ 0.14228 0.08828 0.67647 0.09297] [ 0.41103 0.965 0.08971 0.61725]] >>> rmoms = MarginalMomentsFromMMAP(G) >>> print(rmoms) [0.3395074776245009, 0.24582557198236571, 0.27423742766051162, 0.41206018133500988, 0.77677184049335724, 1.7594286078546562, 4.6515347631617923] >>> rjmom = LagkJointMomentsFromMMAP(G, 3, 1) >>> err = la.norm(rjmom[0]-jmom[0])+la.norm(rjmom[1]-jmom[1]) >>> print(err) 9.65812159364e-16