LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
map_compute_R.m
1function R = map_compute_R(C, D, mu)
2% MAP_COMPUTE_R Compute rate matrix R for MAP/M/1 queue
3%
4% R = MAP_COMPUTE_R(C, D, mu) computes the matrix R, which is the minimal
5% nonnegative solution of the matrix equation:
6% D + R(C - mu*I) + mu*R^2 = O
7%
8% This matrix is used in the analysis of MAP/M/1 queues based on
9% quasi-birth-death processes.
10%
11% Input:
12% C - M x M matrix governing MAP transitions without arrivals
13% D - M x M matrix governing MAP transitions with arrivals
14% mu - Service rate (scalar)
15%
16% Output:
17% R - M x M rate matrix (minimal nonnegative solution)
18%
19% Reference:
20% Masuyama, H., & Takine, T. (2003). Sojourn time distribution in a
21% MAP/M/1 processor-sharing queue. Operations Research Letters, 31(6),
22% 406-412.
23%
24% See also: MAP_M1PS_SOJOURN, MAP_M1PS_H_RECURSIVE
25
26% Copyright (c) 2012-2025, Imperial College London
27% All rights reserved.
28
29M = size(C, 1);
30I = eye(M);
31
32% Use iterative method to solve for R: R = -D(C - mu*I + mu*R)^{-1}
33% Start with R = O
34R = zeros(M);
35max_iter = 1000;
36tol = 1e-10;
37
38for iter = 1:max_iter
39 R_old = R;
40 % R_{k+1} = -D * inv(C - mu*I + mu*R_k)
41 R = -D / (C - mu*I + mu*R);
42
43 % Check convergence
44 if norm(R - R_old, inf) < tol
45 break;
46 end
47end
48
49if iter == max_iter
50 warning('MAP_COMPUTE_R:NoConvergence', ...
51 'R computation did not converge within %d iterations', max_iter);
52end
53
54% Ensure non-negativity (numerical errors might produce small negative values)
55R(R < 0) = 0;
56
57end