LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
cache_ttl_lrum.m
1%{ @file cache_ttl_lrum.m
2 % @brief Computes steady-state probabilities for TTL-based LRU(m) cache
3 %
4 % @author LINE Development Team
5%}
6
7%{
8 % @brief Computes steady-state probabilities for LRU(m) cache
9 %
10 % @details
11 % This function computes the steady-state probability distribution for a
12 % TTL-based LRU(m) cache system.
13 %
14 % @par Syntax:
15 % @code
16 % prob = cache_ttl_lrum(gamma, m)
17 % @endcode
18 %
19 % @par Parameters:
20 % <table>
21 % <tr><th>Name<th>Description
22 % <tr><td>gamma<td>Arrival rates per item per list
23 % <tr><td>m<td>Cache capacity vector
24 % </table>
25 %
26 % @par Returns:
27 % <table>
28 % <tr><th>Name<th>Description
29 % <tr><td>prob<td>Steady-state probability distribution
30 % </table>
31%}
32function prob=cache_ttl_lrum(gamma,m)
33gamma = gamma(1,:,2:end);
34gamma = reshape(gamma,size(gamma,2),size(gamma,3));
35[n,h]=size(gamma);
36t = cache_t_lrum(gamma,m); % the characteristic time of each list, a total of h lists
37
38probh = zeros(n,h); % steady state 1,...,h
39prob0 = zeros(n,1); % steady state 0
40trans = zeros(n,h);
41denom = zeros(1,n);
42
43for k =1:n
44 for j = 1:h
45 trans(k,j) = exp(gamma(k,j)*t(j))-1; %birth and death
46 end
47 denom(k) = sum(cumprod(trans(k,:)));
48end
49
50for k = 1:n
51 for l = 1:h
52 probh(k,l) = prod(trans(k,1:l))/(1+denom(k));
53 end
54 prob0(k) = 1-sum(probh(k,:));
55end
56prob = [prob0 probh];
57end