Matrix-Analytic Methods
QBD processes and matrix-analytic solutions.
The mam module implements matrix-analytic methods for analyzing queues with
structured Markov chains, including QBD, MAP, RAP, and G/M/1 and M/G/1 type processes.
Key function categories:
MAP analysis:
map_pie(),map_mean(),map_var(),map_scv(),map_skew()MAP fitting:
map2_fit(),mmpp2_fit(),aph_fit(),aph2_fit()PH distributions: Phase-type analysis and fitting
Transformations:
map_scale(),map_normalize(),map_timereverse()QBD methods:
qbd_R(),qbd_mapmap1(),qbd_raprap1()Compression:
compress_adaptive(),compress_spectral()
Matrix-Analytic Methods (MAM) for MAP/PH distributions.
This module provides functions for analyzing Markovian Arrival Processes (MAPs), Phase-Type (PH) distributions, and related matrix-analytic methods. It includes fitting algorithms, moment calculations, and various transformations.
Key function categories: - MAP analysis: map_pie, map_mean, map_var, map_scv, map_skew - MAP fitting: map2_fit, mmpp2_fit, aph_fit, aph2_fit - PH distributions: Phase-type analysis and fitting - Transformations: map_scale, map_normalize, map_timereverse - QBD methods: qbd_R, qbd_mapmap1, qbd_raprap1 - Compression: compress_adaptive, compress_spectral
These functions support advanced stochastic modeling with correlated arrivals and non-exponential service times.
- map_pie(D0, D1=None)[source]
Compute equilibrium distribution of the embedded discrete-time process.
Calculates the stationary distribution of the discrete-time Markov chain embedded at departure instants for a Markovian Arrival Process (MAP). The embedded process has transition matrix P = (-D0)^(-1) * D1.
- Parameters:
D0 – Generator matrix for non-arrival transitions, or MAP as container {D0,D1}.
D1 – Generator matrix for arrival transitions (optional if D0 is container).
- Returns:
- Equilibrium distribution of the discrete-time Markov chain
embedded at departure instants.
- Return type:
- map_mean(D0, D1=None)[source]
Calculate mean inter-arrival time of a MAP.
Computes the expected inter-arrival time for a Markovian Arrival Process.
- Parameters:
D0 – Generator matrix for non-arrival transitions, or MAP container
D1 – Generator matrix for arrival transitions (optional if D0 is container)
- Returns:
Mean inter-arrival time
- Return type:
- map_var(D0, D1=None)[source]
Calculate variance of inter-arrival times of a MAP.
Computes the variance of inter-arrival times for a Markovian Arrival Process.
- Parameters:
D0 – Generator matrix for non-arrival transitions, or MAP container
D1 – Generator matrix for arrival transitions (optional if D0 is container)
- Returns:
Variance of inter-arrival times
- Return type:
- map_scv(D0, D1=None)[source]
Calculate squared coefficient of variation of a MAP.
Computes the SCV (variance/mean²) of inter-arrival times.
- Parameters:
D0 – Generator matrix for non-arrival transitions, or MAP container
D1 – Generator matrix for arrival transitions (optional if D0 is container)
- Returns:
Squared coefficient of variation
- Return type:
- map_skew(D0, D1=None)[source]
Calculate skewness of inter-arrival times of a MAP.
Computes the third central moment normalized by variance^(3/2).
- Parameters:
D0 – Generator matrix for non-arrival transitions, or MAP container
D1 – Generator matrix for arrival transitions (optional if D0 is container)
- Returns:
Skewness of inter-arrival times
- Return type:
- map_moment(D0, D1, order)[source]
Compute (power) moments of interarrival times of the specified order.
Calculates the k-th moment E[X^k] where X is the interarrival time random variable of the MAP.
- Parameters:
D0 – Generator matrix for non-arrival transitions
D1 – Generator matrix for arrival transitions
order – Moment order to calculate (1=>E[X], 2=>E[X^2], …)
- Returns:
The k-th power moment of interarrival times
- Return type:
Examples
map_moment(D0, D1, 1) returns the first moment E[X]
map_moment(D0, D1, 2) returns the second moment E[X^2]
- map_lambda(D0, D1=None)[source]
Calculate arrival rate of a MAP.
Computes the long-run arrival rate (λ) of the Markovian Arrival Process.
- Parameters:
D0 – Generator matrix for non-arrival transitions, or MAP container
D1 – Generator matrix for arrival transitions (optional if D0 is container)
- Returns:
Arrival rate λ
- Return type:
- map_acf(D0, D1, lags)[source]
Compute autocorrelation coefficients of interarrival times.
Calculates the lag-k autocorrelation coefficients of the interarrival times for a Markovian Arrival Process. The autocorrelation coefficient at lag k measures the correlation between interarrival times that are k arrivals apart.
- Parameters:
D0 – Generator matrix for non-arrival transitions
D1 – Generator matrix for arrival transitions
lags – Array of positive integers specifying the lags of the autocorrelation coefficients to compute
- Returns:
- Autocorrelation coefficients returned in the same
order as the lags vector
- Return type:
Examples
map_acf(D0, D1, [1]) returns the lag-1 autocorrelation coefficient
map_acf(D0, D1, [1, 2, 3, 4, 5]) returns the first five autocorrelation coefficients
map_acf(D0, D1, np.logspace(0, 4, 5)) returns five logarithmically spaced autocorrelation coefficients in [1e0, 1e4]
- map_acfc(D0, D1, lags, u)[source]
Compute autocorrelation of a MAP’s counting process at specified lags.
Calculates the autocorrelation function of the counting process N(t) representing the number of arrivals in time interval [0,t], evaluated at discrete time points separated by timeslot length u.
- Parameters:
D0 – Generator matrix for non-arrival transitions
D1 – Generator matrix for arrival transitions
lags – Array of lag values (positive integers)
u – Length of timeslot (timescale parameter)
- Returns:
- Autocorrelation values of the counting process
at the specified lags
- Return type:
- map_idc(D0, D1=None)[source]
Compute the asymptotic index of dispersion.
Calculates I = SCV(1 + 2*sum_{k=1}^∞ ρ_k) where SCV is the squared coefficient of variation and ρ_k is the lag-k autocorrelation coefficient of inter-arrival times. I is also the limiting value of the index of dispersion for counts and of the index of dispersion for intervals.
- Parameters:
D0 – Generator matrix for non-arrival transitions, or MAP container {D0,D1}
D1 – Generator matrix for arrival transitions (optional if D0 is container)
- Returns:
Asymptotic index of dispersion
- Return type:
Examples
For a renewal process: map_idc(map_renewal(MAP)) equals the SCV of the MAP
- map_gamma(D0, D1=None)[source]
Estimate the auto-correlation decay rate of a MAP.
For MAPs of order higher than 2, performs an approximation of the autocorrelation function (ACF) curve using non-linear least squares fitting. For second-order MAPs, returns the geometric ACF decay rate. For Poisson processes (order 1), returns 0.
- Parameters:
D0 – Generator matrix for non-arrival transitions, or MAP container {D0,D1}
D1 – Generator matrix for arrival transitions (optional if D0 is container)
- Returns:
Autocorrelation decay rate (GAMMA parameter)
- Return type:
- map_gamma2(MAP)[source]
Calculate the second largest eigenvalue of the embedded transition matrix.
Computes the second-order gamma parameter (γ₂) which is the second largest eigenvalue (in absolute value) of the embedded discrete-time transition matrix P = (-D0)^(-1) * D1. This parameter characterizes the autocorrelation structure of the MAP beyond the dominant eigenvalue.
- Parameters:
MAP – MAP structure or container {D0, D1}
- Returns:
- Second largest eigenvalue of the embedded transition matrix
(complex number, but typically real for feasible MAPs)
- Return type:
Note
The eigenvalues are sorted by descending absolute value, where the first eigenvalue is 1 (for irreducible MAPs) and γ₂ is the second eigenvalue. This parameter is important for analyzing higher-order correlation properties.
- map_cdf(D0, D1, points)[source]
Calculate cumulative distribution function of a MAP.
Evaluates the CDF of inter-arrival times at specified points.
- Parameters:
D0 – Generator matrix for non-arrival transitions
D1 – Generator matrix for arrival transitions
points – Array of points to evaluate CDF at
- Returns:
CDF values at specified points
- Return type:
- map_piq(D0, D1=None)[source]
Compute the probability in queue (piq) for a MAP.
- Parameters:
D0 – Generator matrix for non-arrival transitions, or MAP container
D1 – Generator matrix for arrival transitions (optional if D0 is container)
- Returns:
Probability in queue vector
- Return type:
- map_embedded(D0, D1=None)[source]
Compute the embedded discrete-time process transition matrix.
Returns the transition matrix P of the discrete-time Markov chain embedded at arrival instants. If the MAP is feasible, then P must be an irreducible stochastic matrix. P(i,j) gives the probability that the MAP restarts in phase j if the last arrival occurred in phase i.
- Parameters:
D0 – Generator matrix for non-arrival transitions, or MAP container {D0,D1}
D1 – Generator matrix for arrival transitions (optional if D0 is container)
- Returns:
Transition matrix P = (-D0)^(-1) * D1 of the embedded process
- Return type:
- map_count_mean(MAP, t)[source]
Compute the mean of the counting process.
Calculates the expected number of arrivals in time interval (0, t] for a Markovian Arrival Process.
- Parameters:
MAP – Markovian Arrival Process as container {D0, D1}
t – The time period considered for each sample of the counting process
- Returns:
Mean number of arrivals in (0, t]
- Return type:
- map_count_var(MAP, t)[source]
Compute the variance of the counting process.
Calculates the variance of the number of arrivals in time interval (0, t] for a Markovian Arrival Process.
- Parameters:
MAP – Markovian Arrival Process as container {D0, D1}
t – The time period considered for each sample of the counting process
- Returns:
Variance of number of arrivals in (0, t]
- Return type:
- Reference:
He and Neuts, “Markov chains with marked transitions”, 1998 Verified special case of MMPP(2) with Andresen and Nielsen, 1998
- map_varcount(D0, D1, t)[source]
Compute variance of the counting process for a MAP.
Calculates the variance of the number of arrivals in time interval [0,t] for a Markovian Arrival Process. This is an alternative interface for map_count_var with direct matrix input.
- Parameters:
D0 – Generator matrix for non-arrival transitions
D1 – Generator matrix for arrival transitions
t – Time interval length
- Returns:
Variance of number of arrivals in time interval [0,t]
- Return type:
Note
This function provides the same computation as map_count_var but accepts the D0, D1 matrices directly rather than a MAP container.
- map2_fit(e1, e2, e3, g2)[source]
Fit a second-order MAP from moments and autocorrelation.
Constructs a Markovian Arrival Process of order 2 from given statistical moments and lag-1 autocorrelation coefficient using the explicit inverse characterization method for acyclic MAPs of second order.
- Parameters:
e1 – First moment E[X] (mean inter-arrival time)
e2 – Second moment E[X²]
e3 – Third moment E[X³] (if not provided, automatically selected)
g2 – Lag-1 autocorrelation coefficient
- Returns:
(D0, D1) - Generator matrices for the fitted MAP or None if infeasible
- Return type:
- Reference:
A. Heindl, G. Horvath, K. Gross “Explicit inverse characterization of acyclic MAPs of second order”
Note
The method automatically handles hyperexponential (h2>0) and hypoexponential (h2<0) cases, where h2 = (r2-r1²)/r1² with r1=e1, r2=e2/2.
- aph_fit(e1, e2, e3, nmax=10)[source]
Fit an Acyclic Phase-Type distribution to moments.
Fits an APH distribution to match the first three moments using the EC (Expectation-Conditional) algorithm.
- Parameters:
e1 – First moment (mean)
e2 – Second moment
e3 – Third moment
nmax – Maximum number of phases (default: 10)
- Returns:
- (alpha, T, feasible) where:
alpha: Initial probability vector
T: Sub-generator matrix
feasible: Whether the fit was feasible
- Return type:
- aph2_fit(M1, M2, M3)[source]
Fit a 2-phase APH distribution to moments.
Fits a 2-phase Acyclic Phase-Type distribution to match the first three moments.
- Parameters:
M1 – First moment (mean)
M2 – Second moment
M3 – Third moment
- Returns:
- (alpha, T, feasible) where:
alpha: Initial probability vector
T: Sub-generator matrix
feasible: Whether the fit was feasible
- Return type:
- aph2_fitall(M1, M2, M3)[source]
Fit a 2-phase APH distribution with all possible structures.
Tries all possible 2-phase APH structures to fit the given moments.
- Parameters:
M1 – First moment (mean)
M2 – Second moment
M3 – Third moment
- Returns:
Results for all feasible APH structures
- aph2_adjust(M1, M2, M3, method='default')[source]
Adjust moments to ensure feasible APH fitting.
Adjusts the input moments to be in the feasible region for 2-phase APH distribution fitting.
- Parameters:
M1 – First moment (mean)
M2 – Second moment
M3 – Third moment
method – Adjustment method (default: “default”)
- Returns:
(M1, M2, M3) - Adjusted moments
- Return type:
- mmpp2_fit(E1, E2, E3, G2)[source]
Fit a 2-state MMPP (Markov Modulated Poisson Process) to moments.
Fits a 2-state MMPP to match the first three moments and lag-1 autocorrelation of inter-arrival times.
- Parameters:
E1 – First moment (mean)
E2 – Second moment
E3 – Third moment
G2 – Lag-1 autocorrelation coefficient
- Returns:
- (D0, D1, feasible) where:
D0: Generator matrix for non-arrival transitions
D1: Generator matrix for arrival transitions
feasible: Whether the fit was successful
- Return type:
- mmpp2_fit1(mean, scv, skew, idc)[source]
Fit a 2-state MMPP using alternative parameterization.
Fits a 2-state MMPP using mean, SCV, skewness, and index of dispersion.
- Parameters:
mean – Mean inter-arrival time
scv – Squared coefficient of variation
skew – Skewness
idc – Index of dispersion for counts
- Returns:
- (D0, D1, feasible) where:
D0: Generator matrix for non-arrival transitions
D1: Generator matrix for arrival transitions
feasible: Whether the fit was successful
- Return type:
- mmap_mixture_fit(P2, M1, M2, M3)[source]
Fit a mixture of MMAPs to given moments.
- Parameters:
P2 – Mixing probabilities matrix
M1 – First moment matrix
M2 – Second moment matrix
M3 – Third moment matrix
- Returns:
Fitted MMAP mixture parameters
- mmap_mixture_fit_mmap(mmap)[source]
Fit mixture of MMAPs from MMAP representation.
- Parameters:
mmap – MMAP object or structure to fit mixture from
- Returns:
- (D0, D1, components) where:
D0: Generator matrix for non-arrival transitions
D1: Generator matrix for arrival transitions
components: List of mixture components
- Return type:
- mamap2m_fit_gamma_fb_mmap(mmap)[source]
Fit 2-moment MAMAP using gamma forward-backward algorithm from MMAP.
- Parameters:
mmap – MMAP structure to fit
- Returns:
Fitted MAMAP parameters
- mamap2m_fit_gamma_fb(M1, M2, M3, GAMMA, P, F, B)[source]
Fit 2-moment MAMAP using gamma forward-backward algorithm.
- Parameters:
M1 – First moment
M2 – Second moment
M3 – Third moment
GAMMA – Gamma parameter
P – Probability parameters
F – Forward parameters
B – Backward parameters
- Returns:
(D0, D1, D_classes) - Fitted MAMAP matrices and class matrices
- Return type:
- map_exponential(mean)[source]
Fit a Poisson process as a MAP.
Creates a Markovian Arrival Process representing a Poisson process (exponential inter-arrival times) with the specified mean.
- Parameters:
mean – Mean inter-arrival time of the process
- Returns:
(D0, D1) - MAP matrices representing the Poisson process
- Return type:
Examples
map_exponential(2) returns a Poisson process with rate λ=0.5
- map_erlang(mean, k)[source]
Fit an Erlang-k process as a MAP.
Creates a Markovian Arrival Process representing an Erlang-k distribution with the specified mean and number of phases.
- Parameters:
mean – Mean inter-arrival time of the process
k – Number of phases in the Erlang distribution
- Returns:
(D0, D1) - MAP matrices representing the Erlang-k process
- Return type:
Examples
map_erlang(2, 3) creates an Erlang-3 process with mean 2
- map_hyperexp(mean, scv, p)[source]
Fit a two-phase Hyperexponential process as a MAP.
Creates a Markovian Arrival Process representing a two-phase hyperexponential distribution with specified mean, squared coefficient of variation, and phase selection probability.
- Parameters:
mean – Mean inter-arrival time of the process
scv – Squared coefficient of variation of inter-arrival times
p – Probability of being served in phase 1 (default: p=0.99)
- Returns:
(D0, D1) - MAP matrices representing the hyperexponential process
- Return type:
Examples
map_hyperexp(1, 2, 0.99) creates a two-phase hyperexponential process where phase 1 is selected with probability 0.99
map_hyperexp(1, 2, 0.2) creates a two-phase hyperexponential process where phase 1 is selected with probability 0.2
Note
For some parameter combinations, a feasible solution may not exist. Use map_isfeasible() to check if the returned MAP is valid.
- map_scale(D0, D1, newMean)[source]
Rescale mean inter-arrival time of a MAP.
Returns a MAP with the same normalized moments and correlations as the input MAP, except for the mean inter-arrival time which is set to the specified new value.
- Parameters:
D0 – Generator matrix for non-arrival transitions
D1 – Generator matrix for arrival transitions
newMean – New mean inter-arrival time
- Returns:
(D0_scaled, D1_scaled) - Scaled and normalized MAP matrices
- Return type:
Examples
map_mean(map_scale(map_exponential(1), 2)) has mean 2
- map_normalize(D0, D1)[source]
Try to make a MAP feasible through normalization.
Normalizes the MAP matrices by: (1) ensuring D0+D1 is an infinitesimal generator, (2) setting all negative off-diagonal entries to zero, and (3) taking the real part of any complex values.
- Parameters:
D0 – Generator matrix for non-arrival transitions
D1 – Generator matrix for arrival transitions
- Returns:
(D0_norm, D1_norm) - Normalized MAP matrices that form a valid MAP
- Return type:
Examples
map_normalize([[0,0],[0,0]], [[1,2],[3,4]]) produces a valid MAP
- map_timereverse(map_input)[source]
Compute time-reversed MAP.
- Parameters:
map_input – Either tuple (D0, D1) or MAP container
- Returns:
(D0_rev, D1_rev) - Time-reversed MAP matrices
- Return type:
- map_mark(MAP, prob)[source]
Mark arrivals from a MAP according to given probabilities.
Takes a MAP with a single arrival type and returns a MMAP (Marked MAP) with the same unmarked inter-arrival process but marked arrivals specified by prob. prob[k] is the probability that an arrival will be marked with type k.
- Parameters:
MAP – Either tuple (D0, D1) or MAP container representing the input MAP
prob – Probability vector where prob[k] is the probability that arrivals are marked with type k (probabilities are normalized if they don’t sum to 1)
- Returns:
Marked MAP (MMAP) with multiple arrival types
Note
Input marking probabilities are automatically normalized if they don’t sum to 1.
- map_infgen(D0, D1)[source]
Compute infinitesimal generator matrix of MAP.
- Parameters:
D0 – Generator matrix for non-arrival transitions
D1 – Generator matrix for arrival transitions
- Returns:
Infinitesimal generator matrix
- Return type:
- map_super(MAPa, MAPb)[source]
Compute superposition of two independent MAPs.
Creates a MAP that represents the superposition (sum) of two independent Markovian Arrival Processes using Kronecker sum operations. The resulting MAP has arrivals from both input MAPs combined.
- Parameters:
MAPa – First MAP as tuple (D0_a, D1_a) or container {D0_a, D1_a}
MAPb – Second MAP as tuple (D0_b, D1_b) or container {D0_b, D1_b}
- Returns:
- (D0_super, D1_super) - Superposition MAP matrices where:
D0_super = kron(D0_a, I_b) + kron(I_a, D0_b) D1_super = kron(D1_a, I_b) + kron(I_a, D1_b)
- Return type:
Note
The output is automatically normalized to ensure a valid MAP.
- map_sum(MAP, n)[source]
Compute sum of n identical independent MAPs.
- Parameters:
MAP – MAP as tuple (D0, D1) or container
n – Number of identical MAPs to sum
- Returns:
(D0_sum, D1_sum) - Sum MAP matrices
- Return type:
- map_sumind(MAPs)[source]
Compute sum of multiple independent MAPs.
- Parameters:
MAPs – List of MAPs, each as tuple (D0, D1) or container
- Returns:
(D0_sum, D1_sum) - Sum MAP matrices
- Return type:
- map_checkfeasible(MAP, TOL=1e-10)[source]
Check if MAP satisfies feasibility conditions and return diagnostics.
- Parameters:
MAP – MAP as tuple (D0, D1) or container
TOL – Numerical tolerance (default: 1e-10)
- Returns:
Feasibility check results with diagnostic information
- map_isfeasible(MAP, TOL=1e-10)[source]
Evaluate feasibility of a MAP process.
Checks if a Markovian Arrival Process satisfies all feasibility conditions including proper matrix structure, non-negativity constraints, stochasticity, and irreducibility requirements.
- Parameters:
MAP – MAP as tuple (D0, D1) or container {D0, D1}
TOL – Numerical tolerance for feasibility checks (default: 1e-10)
- Returns:
True if MAP is feasible, False if infeasible
- Return type:
Examples
map_isfeasible([[0,0],[0,0]], [[1,2],[3,4]]) returns False (infeasible MAP)
Note
Numerical tolerance is based on the standard toolbox value in map_feastol().
- map_feastol()[source]
Get default feasibility tolerance for MAP validation.
- Returns:
Default tolerance value
- Return type:
- map_largemap()[source]
Get threshold for determining if a MAP is considered large.
- Returns:
Size threshold for large MAPs
- Return type:
- aph2_assemble(l1, l2, p1)[source]
Assemble a 2-phase APH distribution from parameters.
- Parameters:
l1 – Rate parameter for first phase
l2 – Rate parameter for second phase
p1 – Initial probability for first phase
- Returns:
(alpha, T) - Initial vector and generator matrix
- Return type:
- ph_reindex(PHs, stationToClass)[source]
Reindex phase-type distributions according to station-to-class mapping.
- Parameters:
PHs – List of phase-type distributions
stationToClass – Mapping from stations to classes
- Returns:
Reindexed phase-type distributions
- map_rand(K)[source]
Generate a random MAP with K states.
- Parameters:
K – Number of states in the MAP
- Returns:
(D0, D1) - Randomly generated MAP matrices
- Return type:
- map_randn(K, mu, sigma)[source]
Generate a random MAP with normally distributed matrix elements.
Creates a random Markovian Arrival Process with K states where the matrix elements are drawn from normal distributions with specified mean and standard deviation parameters. The resulting matrices are normalized to ensure feasibility.
- Parameters:
K – Number of states in the MAP
mu – Mean parameter for the normal distribution of matrix elements
sigma – Standard deviation parameter for the normal distribution
- Returns:
(D0, D1) - Random MAP matrices with normalized feasible structure
- Return type:
Note
The generated matrices undergo normalization via map_normalize() to ensure they form a valid MAP structure with proper generator properties.
- mmap_lambda(MMAP)[source]
Calculate arrival rate for each class in a Marked MAP.
Computes the arrival rate (lambda) for each job class in a Marked Markovian Arrival Process (MMAP). For a MMAP with C classes, returns a vector of C arrival rates.
- Parameters:
MMAP – Marked MAP structure as container {D0, D1, D2, …, DC+1} where D0 is the background generator and D1, D2, …, DC+1 are the arrival generators for each class
- Returns:
Vector of arrival rates for each job class
- Return type:
Note
This function is equivalent to mmap_count_lambda(MMAP).
- mmap_count_mean(MMAP, t)[source]
Compute the mean of the counting process for each class in a Marked MAP.
Calculates the expected number of arrivals in time interval (0, t] for each job class in a Marked Markovian Arrival Process (MMAP).
- Parameters:
MMAP – Marked MAP structure as container {D0, D1, D2, …, DC+1}
t – The time period considered for each sample of the counting process
- Returns:
Vector with the mean number of arrivals in (0, t] for each job class
- Return type:
Note
For a MMAP with C classes, returns a C-dimensional vector where mk[k] is the mean arrival count for class k in interval (0, t].
- mmap_count_var(MMAP, t)[source]
Compute variance of number of arrivals per class in time interval t for an MMAP.
- Parameters:
MMAP – Markovian Arrival Process with Multiple types
t – Time interval
- Returns:
Variance of number of arrivals per class in time t
- Return type:
- mmap_count_idc(MMAP, t)[source]
Compute index of dispersion for counts per class in time interval t for an MMAP.
- Parameters:
MMAP – Markovian Arrival Process with Multiple types
t – Time interval
- Returns:
Index of dispersion for counts per class
- Return type:
- mmap_idc(MMAP)[source]
Compute index of dispersion for counts of an MMAP.
- Parameters:
MMAP – Markovian Arrival Process with Multiple types
- Returns:
Index of dispersion for counts
- Return type:
- mmap_sigma2(mmap)[source]
Compute second-order statistics (variance) for an MMAP.
- Parameters:
mmap – Markovian Arrival Process with Multiple types
- Returns:
Second-order statistics matrix
- Return type:
- mmap_exponential(lambda_rates, n)[source]
Create an exponential MMAP with given arrival rates.
- Parameters:
lambda_rates – Array of arrival rates for each class
n – Number of states
- Returns:
Exponential MMAP with specified rates
- Return type:
MMAP
- mmap_mixture(alpha, MAPs)[source]
Create a mixture of MMAPs with given mixing probabilities.
- Parameters:
alpha – Mixing probability vector
MAPs – List of MMAP components
- Returns:
Mixture MMAP
- Return type:
MMAP
- mmap_super(MMAPa, MMAPb, opt='default')[source]
Compute superposition of two MMAPs.
- Parameters:
MMAPa – First MMAP
MMAPb – Second MMAP
opt – Superposition method (default: “default”)
- Returns:
Superposed MMAP
- Return type:
MMAP
- mmap_super_safe(MMAPS, maxorder=10, method='default')[source]
Safe superposition of multiple MMAPs with error checking.
Performs superposition of multiple Marked Markovian Arrival Processes with additional validation and error handling.
- Parameters:
MMAPS – List of MMAP matrices to superpose
maxorder – Maximum order for approximation
method – Superposition method
- Returns:
Superposed MMAP matrices
- mmap_compress(MMAP, config='default')[source]
Compress an MMAP using specified configuration.
Reduces the number of states in an MMAP while preserving key statistical properties using the specified configuration.
- Parameters:
MMAP – MMAP matrices to compress
config – Compression configuration
- Returns:
Compressed MMAP matrices
- mmap_normalize(MMAP)[source]
Fix MMAP feasibility by normalization.
Normalizes a Marked MAP to ensure feasibility by setting negative values to zero and enforcing the proper conditions for a valid MMAP structure. This includes ensuring the background matrix D0 has negative diagonal elements and the arrival matrices are non-negative.
- Parameters:
MMAP – Marked MAP structure as container {D0, D1, D2, …, DC+1}
- Returns:
Normalized MMAP structure that satisfies feasibility conditions
Note
The normalization process: 1. Sets negative off-diagonal elements in D0 to zero 2. Sets negative elements in arrival matrices to zero 3. Adjusts diagonal elements of D0 to maintain generator property
- mmap_scale(MMAP, M, maxIter=100)[source]
Scale an MMAP using iterative algorithm.
Adjusts the MMAP parameters using matrix M through an iterative scaling procedure.
- Parameters:
MMAP – MMAP matrices to scale
M – Scaling matrix
maxIter – Maximum number of iterations
- Returns:
Scaled MMAP matrices
- mmap_timereverse(mmap)[source]
Compute time-reversed MMAP.
Creates the time-reversed version of a Marked Markovian Arrival Process, reversing the direction of time.
- Parameters:
mmap – MMAP matrices to time-reverse
- Returns:
Time-reversed MMAP matrices
- mmap_hide(MMAP, types)[source]
Hide specific arrival types from an MMAP.
Removes specified arrival types from the MMAP, effectively filtering out those arrival classes.
- Parameters:
MMAP – MMAP matrices
types – Matrix specifying types to hide
- Returns:
MMAP with specified types hidden
- mmap_shorten(mmap)[source]
Shorten an MMAP by removing redundant elements.
Reduces the size of the MMAP representation by eliminating unnecessary components.
- Parameters:
mmap – MMAP matrices to shorten
- Returns:
Shortened MMAP matrices
- mmap_maps(MMAP)[source]
Extract individual MAP components from an MMAP.
Decomposes a Marked Markovian Arrival Process into its constituent MAP components.
- Parameters:
MMAP – MMAP matrices to decompose
- Returns:
List of individual MAP matrices
- Return type:
- mmap_pc(MMAP)[source]
Compute probability matrix for MMAP.
Calculates the probability matrix associated with the Marked Markovian Arrival Process.
- Parameters:
MMAP – MMAP matrices
- Returns:
Probability matrix
- Return type:
- mmap_forward_moment(MMAP, ORDERS, NORM=True)[source]
Compute forward moments for MMAP.
Calculates forward moments of the inter-arrival times for a Marked Markovian Arrival Process.
- Parameters:
MMAP – MMAP matrices
ORDERS – Array of moment orders to compute
NORM – Whether to normalize the moments
- Returns:
Forward moment matrix
- Return type:
- mmap_backward_moment(MMAP, ORDERS, NORM=True)[source]
Compute backward moments for MMAP.
Calculates backward moments of the inter-arrival times for a Marked Markovian Arrival Process.
- Parameters:
MMAP – MMAP matrices
ORDERS – Array of moment orders to compute
NORM – Whether to normalize the moments
- Returns:
Backward moment matrix
- Return type:
- mmap_cross_moment(mmap, k)[source]
Compute cross moments for MMAP.
Calculates cross moments between different arrival types in a Marked Markovian Arrival Process.
- Parameters:
mmap – MMAP matrices
k – Cross moment order
- Returns:
Cross moment matrix
- Return type:
- mmap_sample(MMAP, n, random=None)[source]
Generate random samples from an MMAP.
Produces random arrival times and classes according to the specified Marked Markovian Arrival Process.
- Parameters:
MMAP – MMAP matrices to sample from
n – Number of samples to generate
random – Random number generator (optional)
- Returns:
(times, classes) - Arrays of arrival times and class indices
- Return type:
- mmap_rand(order, classes)[source]
Generate a random MMAP with specified parameters.
Creates a random Marked Markovian Arrival Process with the given order (number of states) and number of classes.
- Parameters:
order – Number of states in the MMAP
classes – Number of arrival classes
- Returns:
Random MMAP matrices
- map_sample(MAP, n, random=None)[source]
Generate a random sample of inter-arrival times.
Produces random inter-arrival time samples according to the specified Markovian Arrival Process using Monte Carlo simulation.
- Parameters:
MAP – MAP as tuple (D0, D1) or MAP container {D0, D1}
n – Number of samples to be generated
random – Random number generator or seed (optional)
- Returns:
Set of n inter-arrival time samples
- Return type:
Examples
map_sample(MAP, 10) generates a sample of 10 inter-arrival times
map_sample(MAP, 1000, seed=42) generates 1000 samples with fixed seed
Warning
The function can be memory consuming and quite slow for sample sizes greater than n=10000.
- mmap_count_lambda(mmap)[source]
Compute arrival rate lambda for MMAP counting process.
Calculates the lambda parameters for the counting process associated with the Marked Markovian Arrival Process.
- Parameters:
mmap – MMAP matrices or MMAP object
- Returns:
Lambda parameters for counting process
- Return type:
- mmap_isfeasible(mmap)[source]
Check if an MMAP is feasible (valid).
Determines whether the given Marked Markovian Arrival Process satisfies all necessary conditions for validity.
- Parameters:
mmap – MMAP matrices or MMAP object
- Returns:
True if MMAP is feasible, False otherwise
- Return type:
- mmap_mark(mmap, prob)[source]
Mark an MMAP with specified probabilities.
Applies probability markings to a Markovian Arrival Process to create a Marked MAP with specified marking probabilities.
- Parameters:
mmap – MMAP matrices or MMAP object
prob – Marking probabilities matrix
- Returns:
Marked MMAP with applied probabilities
- aph_bernstein(f, order)[source]
Compute Bernstein approximation of function using Acyclic PH.
Approximates a function using Bernstein polynomials with an Acyclic Phase-type distribution representation.
- Parameters:
f – Function to approximate
order – Order of Bernstein approximation
- Returns:
Acyclic PH approximation result
- map_jointpdf_derivative(map_matrices, iset)[source]
Compute joint PDF derivative for MAP.
Calculates the derivative of the joint probability density function for a Markovian Arrival Process with respect to specified indices.
- Parameters:
map_matrices – List of MAP matrices [D0, D1]
iset – Set of indices for derivative computation
- Returns:
Joint PDF derivative result
- map_ccdf_derivative(map_matrices, i)[source]
Compute complementary CDF derivative for MAP.
Calculates the derivative of the complementary cumulative distribution function for a Markovian Arrival Process.
- Parameters:
map_matrices – List of MAP matrices [D0, D1]
i – Index parameter for derivative computation
- Returns:
Complementary CDF derivative result
- qbd_R(B, L, F, iter_max=100000)[source]
Compute the R matrix for a Quasi-Birth-Death process.
Solves the matrix equation R = F + R*L*R + R^2*B using iterative methods. The R matrix is fundamental in QBD analysis.
- Parameters:
B – Backward transition matrix
L – Local transition matrix
F – Forward transition matrix
iter_max – Maximum number of iterations (default: 100000)
- Returns:
The R matrix
- Return type:
- qbd_R_logred(B, L, F, iter_max=100000)[source]
Compute the R matrix using logarithmic reduction algorithm.
Alternative method for computing the R matrix that can be more numerically stable for certain QBD problems.
- Parameters:
B – Backward transition matrix
L – Local transition matrix
F – Forward transition matrix
iter_max – Maximum number of iterations (default: 100000)
- Returns:
The R matrix
- Return type:
- qbd_rg(map_a, map_s, util=None)[source]
Analyze a MAP/MAP/1 queue using QBD methods.
Analyzes a single-server queue with MAP arrivals and MAP service times using Quasi-Birth-Death process techniques.
- Parameters:
map_a – Arrival MAP (list/array with D0, D1 matrices)
map_s – Service MAP (list/array with D0, D1 matrices)
util – Utilization constraint (optional)
- Returns:
QBD analysis results including performance measures
- map_pdf(MAP, points)[source]
Compute probability density function of interarrival times.
Evaluates the probability density function (PDF) of the interarrival time distribution for a Markovian Arrival Process at the specified time points.
- Parameters:
MAP – MAP as tuple (D0, D1) representing the Markovian Arrival Process
points – Array of time points to evaluate the PDF at
- Returns:
- PDF values at the specified points, returned in the
same order as the points vector
- Return type:
Examples
map_pdf(MAP, [0.5, 1.0, 2.0]) returns PDF values at t=0.5, 1.0, 2.0
- map_prob(MAP, t)[source]
Compute probability for MAP at time t.
Calculates the probability measure associated with the Markovian Arrival Process at the specified time.
- Parameters:
MAP – MAP as tuple (D0, D1) matrices
t – Time point for probability computation
- Returns:
Probability value at time t
- Return type:
- map_joint(MAP1, MAP2)[source]
Compute joint distribution of two MAPs.
Creates the joint distribution representation of two independent Markovian Arrival Processes.
- Parameters:
MAP1 – First MAP as tuple (D0, D1)
MAP2 – Second MAP as tuple (D0, D1)
- Returns:
Joint MAP representation
- map_mixture(alpha, MAPs)[source]
Create mixture of multiple MAPs.
Constructs a mixture distribution from multiple Markovian Arrival Processes with given mixing probabilities.
- Parameters:
alpha – Mixing probabilities (weights) for each MAP
MAPs – List of MAP matrices to mix
- Returns:
Mixture MAP representation
- map_max(MAP1, MAP2)[source]
Compute maximum of two independent MAPs.
- Parameters:
MAP1 – First MAP as tuple (D0, D1)
MAP2 – Second MAP as tuple (D0, D1)
- Returns:
MAP representing max(X,Y) where X~MAP1, Y~MAP2
- map_renewal(MAPIN)[source]
Remove all correlations from a MAP to create a renewal process.
Transforms a Markovian Arrival Process into a renewal MAP process with the same cumulative distribution function (CDF) as the input MAP, but with no correlations between inter-arrival times.
- Parameters:
MAPIN – Input MAP as tuple (D0, D1) representing the original MAP
- Returns:
Renewal MAP with same marginal distribution but independent inter-arrival times
Note
The resulting process maintains the same inter-arrival time distribution but removes all temporal dependencies, making it a renewal process.
- map_stochcomp(MAP)[source]
Compute stochastic complement of MAP by eliminating states.
- Parameters:
MAP – MAP as tuple (D0, D1)
- Returns:
Reduced MAP with eliminated transient states
- qbd_mapmap1(MAP_A, MAP_S, mu=None)[source]
Analyze MAP/MAP/1 queueing system using QBD methods.
- Parameters:
MAP_A – Arrival MAP as tuple (D0, D1)
MAP_S – Service MAP as tuple (D0, D1)
mu – Service rate parameter (optional)
- Returns:
QBD analysis results including performance measures
- Return type:
- qbd_raprap1(RAP_A, RAP_S, util=None)[source]
Analyze RAP/RAP/1 queueing system using QBD methods.
- Parameters:
RAP_A – Arrival RAP (Rational Arrival Process)
RAP_S – Service RAP
util – Utilization parameter (optional)
- Returns:
QBD analysis results for RAP/RAP/1 queue
- Return type:
- qbd_bmapbmap1(BMAP_A, BMAP_S)[source]
Analyze BMAP/BMAP/1 queueing system using QBD methods.
- Parameters:
BMAP_A – Arrival Batch MAP
BMAP_S – Service Batch MAP
- Returns:
QBD analysis results for batch arrival/service system
- Return type:
- qbd_setupdelayoff(MAP_A, MAP_S, setup_time, delay_time, off_time)[source]
Analyze queue with setup, delay, and off periods using QBD methods.
Models a queueing system with server setup times, processing delays, and off periods using Quasi-Birth-Death process analysis.
- Parameters:
MAP_A – Arrival MAP as tuple (D0, D1).
MAP_S – Service MAP as tuple (D0, D1).
setup_time – Server setup time.
delay_time – Processing delay time.
off_time – Server off time.
- Returns:
Performance measures for the system with timing constraints.
- Return type:
- aph_simplify(a1, T1, a2, T2, p1, p2, pattern)[source]
Simplify APH representation using specified pattern.
- Parameters:
a1 – Initial vector for first APH
T1 – Generator matrix for first APH
a2 – Initial vector for second APH
T2 – Generator matrix for second APH
p1 – Probability parameter for first APH
p2 – Probability parameter for second APH
pattern – Simplification pattern identifier
- Returns:
(alpha, T) simplified APH representation
- Return type:
- randp(P, rows, cols=None)[source]
Pick random values with relative probability.
Returns integers in the range from 1 to len(P) with a relative probability, so that the value X is present approximately (P[X-1]/sum(P)) times.
- Parameters:
P – Probability vector (all values should be >= 0)
rows – Number of rows for output matrix
cols – Number of columns for output matrix (defaults to rows if not specified)
- Returns:
Matrix of random integers with specified probabilities
- aph_rand(n)[source]
Generate random APH distribution with n phases.
- Parameters:
n – Number of phases
- Returns:
(alpha, T) random APH representation
- Return type:
- amap2_fit_gamma(mean1, var1, mean2, var2, p)[source]
Fit 2-phase AMAP using gamma matching method.
- Parameters:
mean1 – Mean for first phase
var1 – Variance for first phase
mean2 – Mean for second phase
var2 – Variance for second phase
p – Phase probability
- Returns:
(D0, D1) fitted AMAP matrices
- Return type:
- mamap2m_fit_fb_multiclass(data, classes, options=None)[source]
Fit multiclass MAMAP using feedback method.
- Parameters:
data – Input data for fitting
classes – Number of classes
options – Fitting options (optional)
- Returns:
Fitted AMAP and quality metrics
- Return type:
- map_count_moment(MAP, k, lag=0)[source]
Compute count moments of MAP arrivals.
- Parameters:
MAP – MAP as tuple (D0, D1)
k – Moment order
lag – Time lag (default: 0)
- Returns:
Count moment value
- Return type:
- map_kurt(MAP)[source]
Calculate kurtosis of inter-arrival times for a MAP.
Computes the fourth moment (kurtosis) of the inter-arrival time distribution for a Markovian Arrival Process.
- Parameters:
MAP – MAP as tuple (D0, D1) of generator matrices.
- Returns:
Kurtosis of inter-arrival times.
- Return type:
- mmap_sigma2_cell(MMAP)[source]
Compute two-step class transition probabilities for MMAP (cell version).
- Parameters:
MMAP – Multi-class MAP matrices as cell structure
- Returns:
3D matrix of class transition probabilities
- amap2_adjust_gamma(mean1, var1, mean2, var2, p, target_mean, target_var)[source]
Adjust 2-phase AMAP gamma parameters to target moments.
- Parameters:
mean1 – Mean for first phase
var1 – Variance for first phase
mean2 – Mean for second phase
var2 – Variance for second phase
p – Phase probability
target_mean – Target mean value
target_var – Target variance value
- Returns:
Adjusted AMAP parameters
- amap2_fitall_gamma(data, options=None)[source]
Fit all gamma parameters for 2-phase AMAP from data.
- Parameters:
data – Input data for fitting
options – Fitting options (optional)
- Returns:
Fitted AMAP parameters and quality metrics
- Return type:
- mmpp2_fit_mu00(data, options=None)[source]
Fit 2-phase MMPP parameter mu00 from data.
- Parameters:
data – Input data for parameter fitting
options – Fitting options (optional)
- Returns:
Fitted mu00 parameter
- mmpp2_fit_mu11(data, options=None)[source]
Fit 2-phase MMPP parameter mu11 from data.
- Parameters:
data – Input data for parameter fitting
options – Fitting options (optional)
- Returns:
Fitted mu11 parameter
- mmpp2_fit_q01(data, options=None)[source]
Fit 2-phase MMPP parameter q01 from data.
- Parameters:
data – Input data for parameter fitting
options – Fitting options (optional)
- Returns:
Fitted q01 parameter
- mmpp2_fit_q10(data, options=None)[source]
Fit 2-phase MMPP parameter q10 from data.
- Parameters:
data – Input data for parameter fitting
options – Fitting options (optional)
- Returns:
Fitted q10 parameter
- assess_compression_quality(original_MAP, compressed_MAP, metrics=['mean', 'var', 'acf'])[source]
Assess quality of MAP compression by comparing metrics.
Evaluates how well a compressed MAP approximates the original MAP by comparing specified statistical metrics.
- Parameters:
original_MAP – Original MAP as tuple (D0, D1).
compressed_MAP – Compressed MAP as tuple (D0, D1).
metrics – List of metrics to compare (default: [‘mean’, ‘var’, ‘acf’]).
- Returns:
Quality assessment results for each metric.
- Return type:
- compress_adaptive(MAP, target_order, options=None)[source]
Compress MAP using adaptive compression algorithm.
- Parameters:
MAP – MAP as tuple (D0, D1)
target_order – Target order for compression
options – Compression options (optional)
- Returns:
Compressed MAP with reduced order
- compress_autocorrelation(MAP, target_order, options=None)[source]
Compress MAP preserving autocorrelation properties.
- Parameters:
MAP – MAP as tuple (D0, D1)
target_order – Target order for compression
options – Compression options (optional)
- Returns:
Compressed MAP preserving autocorrelation structure
- compress_spectral(MAP, target_order, options=None)[source]
Compress MAP using spectral decomposition methods.
- Parameters:
MAP – MAP as tuple (D0, D1)
target_order – Target order for compression
options – Compression options (optional)
- Returns:
Compressed MAP using spectral techniques
- compress_with_quality_control(MAP, target_order, quality_threshold=0.95, options=None)[source]
Compress MAP with quality control constraints.
- Parameters:
MAP – MAP as tuple (D0, D1)
target_order – Target order for compression
quality_threshold – Quality threshold (default: 0.95)
options – Compression options (optional)
- Returns:
Compressed MAP and quality metrics
- Return type:
- qbd_G(A0, A1, A2)[source]
Compute G matrix for Quasi-Birth-Death (QBD) process.
Calculates the G matrix which represents the probability generating function for the first passage time from level k to k+1.
- Parameters:
A0 – Transition rate matrix for level down
A1 – Transition rate matrix for same level
A2 – Transition rate matrix for level up
- Returns:
G matrix
- Return type:
- ph_fit(data, max_phases=10)[source]
Fit phase-type distribution to empirical data.
Estimates the parameters of a phase-type distribution that best fits the given data using maximum likelihood estimation.
- Parameters:
data – Empirical data to fit
max_phases – Maximum number of phases to use
- Returns:
(alpha, T) - Initial probability vector and transition rate matrix
- Return type:
- ph_mean(alpha, T)[source]
Compute mean of phase-type distribution.
Calculates the expected value (first moment) of a phase-type distribution with given initial vector and transition matrix.
- Parameters:
alpha – Initial probability vector
T – Transition rate matrix
- Returns:
Mean of the phase-type distribution
- Return type:
- ph_var(alpha, T)[source]
Compute variance of phase-type distribution.
Calculates the variance (second central moment) of a phase-type distribution with given parameters.
- Parameters:
alpha – Initial probability vector
T – Transition rate matrix
- Returns:
Variance of the phase-type distribution
- Return type:
- ph_pdf(alpha, T, points)[source]
Compute PDF of phase-type distribution at given points.
Evaluates the probability density function of a phase-type distribution at the specified points.
- Parameters:
alpha – Initial probability vector
T – Transition rate matrix
points – Points at which to evaluate the PDF
- Returns:
PDF values at the specified points
- Return type:
- ph_cdf(alpha, T, points)[source]
Compute CDF of phase-type distribution at given points.
Evaluates the cumulative distribution function of a phase-type distribution at the specified points.
- Parameters:
alpha – Initial probability vector
T – Transition rate matrix
points – Points at which to evaluate the CDF
- Returns:
CDF values at the specified points
- Return type:
- qbd_psif(A0, A1, A2, B, options=None)[source]
Compute finite QBD stationary probability vector.
Calculates the stationary probability vector for a finite Quasi-Birth-Death process with boundary conditions.
- Parameters:
A0 – Transition rate matrix for level down
A1 – Transition rate matrix for same level
A2 – Transition rate matrix for level up
B – Boundary condition matrix
options – Optional solver options
- Returns:
Stationary probability vector
- Return type:
- qbd_psi(A0, A1, A2, options=None)[source]
Compute Psi matrix for QBD process using iterative methods.
- Parameters:
A0 – QBD backward transition matrix
A1 – QBD local transition matrix
A2 – QBD forward transition matrix
options – Computational options (optional)
- Returns:
Psi matrix for QBD fundamental matrices
- Return type:
- aph2_check_feasibility(M1, M2, M3)[source]
Check feasibility of 2-phase APH distribution parameters.
- Parameters:
M1 – First moment
M2 – Second moment
M3 – Third moment
- Returns:
True if parameters are feasible for 2-phase APH
- Return type:
- aph2_canonical(a1, t11, a2, t22)[source]
Convert 2-phase APH to canonical form.
- Parameters:
a1 – Initial probability for first phase
t11 – Transition rate for first phase
a2 – Initial probability for second phase
t22 – Transition rate for second phase
- Returns:
Canonical form APH parameters
- Return type:
- map_cdf_derivative(MAP, x, order=1)[source]
Compute derivative of MAP cumulative distribution function.
- Parameters:
MAP – MAP as tuple (D0, D1)
x – Point at which to evaluate derivative
order – Derivative order (default: 1)
- Returns:
CDF derivative value at point x
- Return type:
- map_rand_moment(K, target_mean=1.0, target_var=1.0)[source]
Generate random MAP with specified moments.
Creates a random Markovian Arrival Process with the given number of states and target statistical moments.
- Parameters:
K – Number of states
target_mean – Target mean inter-arrival time
target_var – Target variance of inter-arrival time
- Returns:
(D0, D1) - Random MAP matrices with target moments
- Return type:
- qbd_solve(A0, A1, A2)[source]
Solve Quasi-Birth-Death process for stationary distribution.
Computes the stationary probability distribution and rate matrix for an infinite QBD process.
- Parameters:
A0 – Transition rate matrix for level down
A1 – Transition rate matrix for same level
A2 – Transition rate matrix for level up
- Returns:
(pi0, R) - Boundary probabilities and rate matrix
- Return type:
- amap2_fit_gamma_map(map_obj)[source]
Fits AMAP(2) by approximating arbitrary-order MAP with preserved correlation structure.
- Parameters:
map_obj – Input MAP object to approximate
- Returns:
Fitted AMAP(2) parameters (D0, D1)
- Return type:
- amap2_fit_gamma_trace(trace)[source]
Fits AMAP(2) from empirical traces while preserving autocorrelation characteristics.
- Parameters:
trace – Empirical trace data (array-like)
- Returns:
Fitted AMAP(2) parameters (D0, D1)
- Return type:
- aph2_fit_map(map_obj)[source]
Fits APH(2) distributions by approximating arbitrary-order MAP processes.
- Parameters:
map_obj – Input MAP object to approximate with APH(2)
- Returns:
Fitted APH(2) parameters (alpha, T)
- Return type:
- aph2_fit_trace(trace)[source]
Fits APH(2) distributions from empirical inter-arrival time traces.
- Parameters:
trace – Empirical trace data (array-like)
- Returns:
Fitted APH(2) parameters (alpha, T)
- Return type:
- qbd_r(A0, A1, A2)[source]
Computes the rate matrix R for QBD processes.
- Parameters:
A0 – Level down transition matrix
A1 – Level transition matrix
A2 – Level up transition matrix
- Returns:
Rate matrix R
- Return type:
- map_block(MAP, k)[source]
Extracts a block from a MAP representation.
- Parameters:
MAP – Markovian Arrival Process representation
k – Block index
- Returns:
The k-th block of the MAP
- Return type:
- map_feasblock(MAP)[source]
Computes feasibility blocks for MAP representation.
- Parameters:
MAP – Markovian Arrival Process representation
- Returns:
Feasibility block information
- Return type:
- map_kpc(MAP, k)[source]
Computes k-th order phase-type correlation for MAP.
- Parameters:
MAP – Markovian Arrival Process representation
k – Correlation order
- Returns:
k-th order correlation coefficient
- Return type:
- map_pntiter(MAP, n, epsilon=1e-8)[source]
Point process iteration method for MAP analysis.
- Parameters:
MAP – Markovian Arrival Process representation
n – Number of iterations
epsilon – Convergence tolerance
- Returns:
Iteration results
- Return type:
- map_pntquad(MAP, n)[source]
Point process quadrature method for MAP analysis.
- Parameters:
MAP – Markovian Arrival Process representation
n – Number of quadrature points
- Returns:
Quadrature results
- Return type:
- map2mmpp(MAP)[source]
Converts MAP to MMPP representation.
- Parameters:
MAP – Markovian Arrival Process representation
- Returns:
MMPP representation with D0 and D1 matrices
- Return type:
- m3pp_rand(n, params=None)[source]
Generates random M3PP (third-order Markov-modulated Poisson process).
- Parameters:
n – Number of states
params – Optional parameters for generation
- Returns:
Random M3PP representation
- Return type:
- m3pp_interleave_fitc_theoretical(M3PP1, M3PP2)[source]
Fits interleaved M3PP using theoretical approach.
- Parameters:
M3PP1 – First M3PP process
M3PP2 – Second M3PP process
- Returns:
Interleaved M3PP representation
- Return type:
- m3pp_interleave_fitc_trace(trace1, trace2)[source]
Fits interleaved M3PP from trace data.
- Parameters:
trace1 – First trace data
trace2 – Second trace data
- Returns:
Fitted M3PP representation
- Return type:
- m3pp_superpos_fitc(M3PPs)[source]
Fits superposition of multiple M3PP processes.
- Parameters:
M3PPs – List of M3PP processes
- Returns:
Superposed M3PP representation
- Return type:
- m3pp_superpos_fitc_theoretical(M3PPs)[source]
Fits superposition of M3PP processes using theoretical approach.
- Parameters:
M3PPs – List of M3PP processes
- Returns:
Superposed M3PP representation
- Return type:
- maph2m_fit(data, m, h)[source]
Fits PH(2,m) distribution to data.
- Parameters:
data – Input data for fitting
m – Number of phases
h – Hyper-parameter
- Returns:
Fitted PH(2,m) representation
- Return type:
- maph2m_fitc_approx(moments, m)[source]
Approximate fitting of PH(2,m) from moments.
- Parameters:
moments – Statistical moments
m – Number of phases
- Returns:
Fitted PH(2,m) representation
- Return type:
- maph2m_fitc_theoretical(params, m)[source]
Theoretical fitting of PH(2,m) distribution.
- Parameters:
params – Theoretical parameters
m – Number of phases
- Returns:
Fitted PH(2,m) representation
- Return type:
- maph2m_fit_mmap(MMAP, m)[source]
Fits PH(2,m) from MMAP representation.
- Parameters:
MMAP – Marked MAP representation
m – Number of phases
- Returns:
Fitted PH(2,m) representation
- Return type:
- maph2m_fit_multiclass(data, classes, m)[source]
Fits PH(2,m) for multiclass data.
- Parameters:
data – Multiclass input data
classes – Class definitions
m – Number of phases
- Returns:
Fitted multiclass PH(2,m) representation
- Return type:
- maph2m_fit_trace(trace, m)[source]
Fits PH(2,m) from trace data.
- Parameters:
trace – Trace data
m – Number of phases
- Returns:
Fitted PH(2,m) representation
- Return type:
- mmap_embedded(MMAP)[source]
Computes embedded process of MMAP.
- Parameters:
MMAP – Marked MAP representation
- Returns:
Embedded process representation
- Return type:
- mmap_count_mcov(MMAP, lag)[source]
Computes cross-covariance of counts for MMAP.
- Parameters:
MMAP – Marked MAP representation
lag – Time lag for covariance
- Returns:
Cross-covariance matrix
- Return type:
- mmap_issym(MMAP)[source]
Checks if MMAP is symmetric.
- Parameters:
MMAP – Marked MAP representation
- Returns:
True if MMAP is symmetric
- Return type:
- mmap_max(MMAPs)[source]
Computes maximum of multiple MMAPs.
- Parameters:
MMAPs – List of MMAP representations
- Returns:
Maximum MMAP representation
- Return type:
- mmap_mixture_order2(MMAPs, weights)[source]
Creates second-order mixture of MMAPs.
- Parameters:
MMAPs – List of MMAP representations
weights – Mixture weights
- Returns:
Mixed MMAP representation
- Return type:
- mmap_modulate(MMAP, modulation)[source]
Modulates MMAP with given modulation function.
- Parameters:
MMAP – Marked MAP representation
modulation – Modulation function or parameters
- Returns:
Modulated MMAP representation
- Return type:
- mmap_pie(MMAP)[source]
Computes stationary distribution of MMAP.
- Parameters:
MMAP – Marked MAP representation
- Returns:
Stationary distribution
- Return type:
- mmap_sigma(MMAP)[source]
Computes sigma parameter for MMAP.
- Parameters:
MMAP – Marked MAP representation
- Returns:
Sigma parameter
- Return type:
- mmap_sum(MMAPs)[source]
Computes sum of multiple MMAPs.
- Parameters:
MMAPs – List of MMAP representations
- Returns:
Summed MMAP representation
- Return type:
- mmpp2_fitc(data)[source]
Fits MMPP(2) using correlation fitting.
- Parameters:
data – Input data for fitting
- Returns:
Fitted MMPP(2) representation
- Return type:
- mmpp2_fitc_approx(moments)[source]
Approximate fitting of MMPP(2) from moments.
- Parameters:
moments – Statistical moments
- Returns:
Fitted MMPP(2) representation
- Return type:
- qbd_r_logred(A0, A1, A2)[source]
Computes the rate matrix R using logarithmic reduction.
- Parameters:
A0 – Level down transition matrix
A1 – Level transition matrix
A2 – Level up transition matrix
- Returns:
Rate matrix R computed via logarithmic reduction
- Return type:
- mapqn_bnd_lr(MAP, N, Z=None)[source]
Computes lower and upper response time bounds for MAP queueing networks.
- Parameters:
MAP – MAP representation of arrival process
N – Population vector
Z – Think times (optional)
- Returns:
Lower and upper bounds
- Return type:
- mapqn_bnd_lr_mva(MAP, N, Z=None)[source]
Computes MAP queueing network bounds using MVA approach.
- Parameters:
MAP – MAP representation of arrival process
N – Population vector
Z – Think times (optional)
- Returns:
MVA-based bounds
- Return type:
- mapqn_bnd_lr_pf(MAP, N, Z=None)[source]
Computes MAP queueing network bounds using product-form approach.
- Parameters:
MAP – MAP representation of arrival process
N – Population vector
Z – Think times (optional)
- Returns:
Product-form based bounds
- Return type:
- mapqn_bnd_qr(MAP, N, Z=None)[source]
Computes queue length and response time bounds for MAP queueing networks.
- Parameters:
MAP – MAP representation of arrival process
N – Population vector
Z – Think times (optional)
- Returns:
Queue and response time bounds
- Return type:
- mapqn_bnd_qr_delay(MAP, N, Z, delay)[source]
Computes bounds for MAP queueing networks with delay.
- Parameters:
MAP – MAP representation of arrival process
N – Population vector
Z – Think times
delay – Delay parameters
- Returns:
Bounds with delay consideration
- Return type:
- mapqn_bnd_qr_ld(MAP, N, Z, mu)[source]
Computes bounds for load-dependent MAP queueing networks.
- Parameters:
MAP – MAP representation of arrival process
N – Population vector
Z – Think times
mu – Load-dependent service rates
- Returns:
Load-dependent bounds
- Return type:
- mapqn_lpmodel(MAP, N, Z=None)[source]
Creates linear programming model for MAP queueing network.
- Parameters:
MAP – MAP representation of arrival process
N – Population vector
Z – Think times (optional)
- Returns:
LP model components
- Return type:
- mapqn_parameters(MAP, N)[source]
Extracts parameters from MAP queueing network.
- Parameters:
MAP – MAP representation of arrival process
N – Population vector
- Returns:
Network parameters
- Return type:
- mapqn_parameters_factory(params_dict)[source]
Factory method to create MAP queueing network parameters.
- Parameters:
params_dict – Dictionary of parameters
- Returns:
Formatted network parameters
- Return type:
- mapqn_qr_bounds_bas(MAP, N, Z=None)[source]
Computes Balanced Asymptotic System (BAS) bounds for MAP queueing networks.
- Parameters:
MAP – MAP representation of arrival process
N – Population vector
Z – Think times (optional)
- Returns:
BAS bounds
- Return type:
- mapqn_qr_bounds_rsrd(MAP, N, Z=None)[source]
Computes Response-time Scaled Routing Delay (RSRD) bounds for MAP queueing networks.
- Parameters:
MAP – MAP representation of arrival process
N – Population vector
Z – Think times (optional)
- Returns:
RSRD bounds
- Return type:
- m3pp22_fitc_approx_cov(mean, scv, skew, cov)[source]
Implements parameter fitting for second-order Marked Markov Modulated Poisson Process.
- Parameters:
mean – Mean inter-arrival time
scv – Squared coefficient of variation
skew – Skewness
cov – Covariance matrix
- Returns:
Fitted M3PP(2,2) parameters
- Return type:
- mamap2m_coefficients(mean, scv, skew)[source]
Computes coefficients for MAMAP(2,m) fitting.
- Parameters:
mean – Mean value
scv – Squared coefficient of variation
skew – Skewness
- Returns:
Coefficient matrix
- Return type:
- m3pp22_fitc_approx_cov_multiclass(means, scvs, skews, covs)[source]
Implements constrained optimization for fitting M3PP(2,2) parameters given an underlying.
- Parameters:
means – Mean inter-arrival times per class
scvs – Squared coefficients of variation per class
skews – Skewness values per class
covs – Covariance matrices
- Returns:
Fitted M3PP(2,2) parameters for multiple classes
- Return type:
- m3pp22_interleave_fitc(processes)[source]
Implements lumped superposition of multiple M3PP(2,2) processes using interleaved.
- Parameters:
processes – List of M3PP(2,2) process parameters
- Returns:
Interleaved M3PP(2,2) parameters
- Return type:
- m3pp2m_fitc(mean, scv, skew, num_classes)[source]
Implements exact fitting of second-order Marked Markov Modulated Poisson Process.
- Parameters:
mean – Mean inter-arrival time
scv – Squared coefficient of variation
skew – Skewness
num_classes – Number of classes
- Returns:
Fitted M3PP(2,m) parameters
- Return type:
- m3pp2m_fitc_approx(mean, scv, skew, num_classes)[source]
Implements approximation-based fitting for M3PP(2,m) using optimization methods.
- Parameters:
mean – Mean inter-arrival time
scv – Squared coefficient of variation
skew – Skewness
num_classes – Number of classes
- Returns:
Fitted M3PP(2,m) parameters
- Return type:
- m3pp2m_fitc_approx_ag(mean, scv, skew, num_classes)[source]
Implements auto-gamma approximation method for M3PP(2,m) parameter fitting.
- Parameters:
mean – Mean inter-arrival time
scv – Squared coefficient of variation
skew – Skewness
num_classes – Number of classes
- Returns:
Fitted M3PP(2,m) parameters using auto-gamma
- Return type:
- m3pp2m_fitc_approx_ag_multiclass(means, scvs, skews, num_classes)[source]
Implements multiclass auto-gamma fitting for M3PP(2,m) with variance and covariance.
- Parameters:
means – Mean inter-arrival times per class
scvs – Squared coefficients of variation per class
skews – Skewness values per class
num_classes – Number of classes
- Returns:
Fitted M3PP(2,m) parameters for multiple classes
- Return type:
- m3pp2m_interleave(processes)[source]
Implements interleaved superposition of multiple M3PP(2,m) processes to construct.
- Parameters:
processes – List of M3PP(2,m) process parameters
- Returns:
Interleaved M3PP(2,m) parameters
- Return type:
- m3pp_interleave_fitc(processes)[source]
Implements fitting and interleaving of k second-order M3PP processes with varying.
- Parameters:
processes – List of M3PP process parameters
- Returns:
Interleaved M3PP parameters
- Return type:
- mamap22_fit_gamma_fs_trace(trace)[source]
Fits MAMAP(2,2) from trace data using gamma autocorrelation and forward-sigma characteristics.
- Parameters:
trace – Empirical trace data
- Returns:
Fitted MAMAP(2,2) parameters
- Return type:
- mamap22_fit_multiclass(class_data)[source]
Fits MAMAP(2,2) processes for two-class systems with forward moments and sigma characteristics.
- Parameters:
class_data – Data for multiple classes
- Returns:
Fitted MAMAP(2,2) parameters for multiple classes
- Return type:
- mamap2m_fit(mean, scv, skew, num_states)[source]
Fits MAMAP(2,m) processes matching moments, autocorrelation, and class characteristics.
- Parameters:
mean – Mean value
scv – Squared coefficient of variation
skew – Skewness
num_states – Number of states
- Returns:
Fitted MAMAP(2,m) parameters
- Return type: