LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
cache_ttl_hlru.m
1%{ @file cache_ttl_hlru.m
2 % @brief Computes steady-state probabilities for TTL-based hierarchical LRU cache
3 %
4 % @author LINE Development Team
5%}
6
7%{
8 % @brief Computes steady-state probabilities for hierarchical LRU cache
9 %
10 % @details
11 % This function computes the steady-state probability distribution for a
12 % TTL-based hierarchical LRU cache system.
13 %
14 % @par Syntax:
15 % @code
16 % prob = cache_ttl_hlru(lambda, m)
17 % @endcode
18 %
19 % @par Parameters:
20 % <table>
21 % <tr><th>Name<th>Description
22 % <tr><td>lambda<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_hlru(lambda,m)
33lambda = lambda(1,:,2:end);
34lambda = reshape(lambda,size(lambda,2),size(lambda,3));
35[n,h]=size(lambda); % n totalitems, h lists
36
37t = cache_t_hlru(lambda,m);
38probh = zeros(n,1); % steady state at list h
39prob0 = zeros(n,1); % steady state at list 0
40temp1 = ones(n,1);
41temp2 = zeros(n,1);
42
43for k = 1:n
44 for s = 1:h
45 temp1(k) = temp1(k)*(1-exp(-lambda(k,s)*t(s)));
46 end
47
48 middtemp = 1;
49 middtemp2 = 0;
50 for l = 1:h-1
51 for s = 1:l
52 middtemp = middtemp*(1-exp(-lambda(k,s)*t(s)));
53 end
54 middtemp2 = middtemp2+middtemp;
55 end
56 temp2(k) = exp(-lambda(k,h)*t(h))*(1+middtemp2);
57
58 probh(k) = temp1(k)/(temp1(k)+temp2(k));
59 prob0(k) = 1/(temp1(k)+temp2(k))/exp(lambda(k,h)*t(h));
60end
61prob = [prob0 probh];
62end