1classdef MAP < MarkovModulated
2 % Markovian Arrival Process
for correlated arrival modeling
4 % Models arrival streams with correlation and burstiness via D0 and D1 matrices.
6 % Copyright (c) 2012-2026, Imperial College London
11 function self = MAP(D0,D1)
12 % MAP Create a Markovian Arrival Process instance
14 % @brief Creates a MAP with specified D0 and D1 matrices
15 % @param D0 Generator matrix
for transitions without arrivals
16 % @param D1 Rate matrix
for transitions with arrivals
17 % @
return self MAP instance with specified matrices
19 self@MarkovModulated(
'MAP',2);
20 if nargin < 2 && iscell(D0)
25 setParam(self, 1,
'D0', D0);
26 setParam(self, 2,
'D1', D1);
27 self.process = {D0,D1};
28 if ~map_isfeasible(self.D)
29 line_warning(mfilename,'MAP
is infeasible.\n');
33 function n = getNumberOfPhases(self)
34 % The method call needs its receiver: without it this reads as a
35 % call to a function named D and errors out, which made every model
36 % holding a MAP fail at getStruct time (refreshPetriNetNodes.m:50
37 % asks a Markovian firing distribution for its phase
count).
38 n = size(self.D(0), 1);
41 function Di = D(self, i, wantSparse)
47 % Return representation matrix, e.g., D0=MAP.D(0)
52 Di=self.getProcess{i+1};
61 Di=full(self.getProcess{i+1});
66 function meant = evalMeanT(self, t)
67 % MEANT = EVALMEANT(SELF,T)
69 meant = map_count_mean(self.D, t);
72 function vart = evalVarT(self, t)
73 % VART = EVALVART(SELF,T)
75 % Evaluate
the variance-time curve at timescale t
76 vart = map_count_var(self.D, t);
79 function acf = evalACFT(self, lags, timescale)
80 % ACF = EVALACFT(self, lags)
82 % Evaluate
the autocorrelation in counts at timescale t
84 acf = map_acfc(self.D, lags, timescale);
87 function acf = getACF(self, lags)
88 % ACF = GETACF(self, lags)
90 acf = map_acf(self.D,lags);
93 function [gamma2, gamma] = getACFDecay(self)
94 % [gamma2, gamma] = GETACFDECAY(self)
96 % gamma2: asymptotic decay rate of acf
97 % gamma: interpolated decay rate of acf
99 gamma2 = map_gamma2(self.D);
101 gamma = map_gamma(self.D);
105 function
id = getIDC(self, t) % index of dispersion
for counts
106 % IDC = GETIDC() % ASYMPTOTIC INDEX OF DISPERSION
109 id = map_idc(self.D);
111 id = map_count_var(self.D,t) / map_count_mean(self.D,t);
115 function lam = getRate(self)
118 lam = map_lambda(self.D);
121 function mapr = toTimeReversed(self)
122 mapr = MAP(map_timereverse(self.D));
125 function X = sample(self, n)
127 if nargin<2 %~exist('n','var'),
130 MAP = self.getProcess;
131 if map_isfeasible(MAP)
132 X = map_sample(MAP,n);
134 line_error(mfilename,'This process
is infeasible (negative rates).');
138 function self = setMean(self,MEAN)
139 % UPDATEMEAN(SELF,MEAN)
140 % Update parameters to match
the given mean
141 newMAP = map_scale(self.D,MEAN);
142 self.params{1}.paramValue = newMAP{1};
143 self.params{2}.paramValue = newMAP{2};
146 function
bool = isImmediate(self)
147 bool = self.getMean < GlobalConstants.FineTol;
150 function mmdp = toMMDP(self)
151 % TOMMDP Convert MAP to MMDP (deterministic representation)
153 % Converts
this Markovian Arrival Process to a Markov-Modulated
154 % Deterministic Process suitable
for fluid queue analysis.
156 % @
return mmdp MMDP representation of
this MAP
158 mmdp = MMDP.fromMAP(self);
165 function
map = rand(order)
168 % Generate random MAP
using uniform random numbers
172 map = MAP(map_rand(order));
175 function
map = randn(order, mu, sigma)
176 % MAP = RANDN(ORDER, MU, SIGMA)
178 % Generate random MAP
using specified Gaussian parameter and
179 % taking
the absolute value of
the resulting values
180 map = MAP(map_randn(order, mu, sigma));