LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
retrieval_nc.m
1%{ @file retrieval_nc.m
2 % @brief Exact recurrence for the normalizing constant of a delayed-hit (list-based) cache
3 %
4 % @author LINE Development Team
5%}
6
7%{
8 % @brief Computes the delayed-hit cache normalizing constant E(v,m) by the exact recurrence
9 %
10 % @details
11 % This function recursively computes the normalizing constant E(v,m) of a
12 % list-based cache with delayed hits, whose retrieval system has one IS station
13 % (index s=0) and r PS stations (s=1,...,r), using the exact recurrence relation
14 %
15 % E(v,m) = (1 + lambda_k*eta_{0,k}) E_k(v,m)
16 % + sum_{s=1}^{r} lambda_k*eta_{s,k}*(v_s+1) E_k(v+1_s, m)
17 % + sum_{j=1}^{h} m_j*gamma_{k,j} E_k(v, m-1_j)
18 %
19 % where E_k is the same constant for the system without item k. Boundary
20 % conditions are E = 1 if there are no items left and E = 0 if sum_j m_j exceeds
21 % the number of items or any m_j < 0. The plain normalizing constant is recovered
22 % as E(m) = E(0,m).
23 %
24 % @par Syntax:
25 % @code
26 % E = retrieval_nc(v, m, lambda, eta, gamma)
27 % @endcode
28 %
29 % @par Parameters:
30 % <table>
31 % <tr><th>Name<th>Description
32 % <tr><td>v<td>Moment-order vector for the PS stations (zeros(1,r) for the plain constant)
33 % <tr><td>m<td>Cache list capacities
34 % <tr><td>lambda<td>Per-item arrival rates
35 % <tr><td>eta<td>Fetching demands eta(i,s+1)=eta_{s,i} (column 1 = IS station s=0, columns 2..r+1 = PS stations). A PS column models any symmetric/identical-rate single-server discipline (PS, SIRO, FCFS, LCFS-PR), insensitive to the per-list service order.
36 % <tr><td>gamma<td>Access factors gamma(i,j)=gamma_{i,j}
37 % </table>
38 %
39 % @par Returns:
40 % <table>
41 % <tr><th>Name<th>Description
42 % <tr><td>E<td>Normalizing constant E(v,m)
43 % </table>
44%}
45function E=retrieval_nc(v,m,lambda,eta,gamma)
46E = sub_retrieval_nc(v(:).',m(:).',lambda,eta,gamma,numel(lambda));
47end
48
49function E=sub_retrieval_nc(v,m,lambda,eta,gamma,k)
50r=numel(v);
51h=numel(m);
52if sum(m)>k || min(m)<0
53 E=0;
54 return
55end
56if k==0
57 E=1;
58 return
59end
60
61% item k either out of the system or fetched at the IS station s=0
62E = (1+lambda(k)*eta(k,1))*sub_retrieval_nc(v,m,lambda,eta,gamma,k-1);
63
64% item k fetched at PS station s=1,...,r
65for s=1:r
66 vp=v;
67 vp(s)=vp(s)+1;
68 E = E + lambda(k)*eta(k,s+1)*(v(s)+1)*sub_retrieval_nc(vp,m,lambda,eta,gamma,k-1);
69end
70
71% item k stored in cache list j=1,...,h
72for j=1:h
73 if m(j)>0
74 E = E + gamma(k,j)*m(j)*sub_retrieval_nc(v,oner(m,j),lambda,eta,gamma,k-1);
75 end
76end
77end