LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
cache_miss_fpi.m
1%{ @file cache_miss_fpi.m
2 % @brief Computes miss rates using fixed-point iteration
3 %
4 % @author LINE Development Team
5%}
6
7%{
8 % @brief Computes cache miss rates using FPI method
9 %
10 % @details
11 % This function computes global, per-user, and per-item miss rates for
12 % cache models using the fixed-point iteration (FPI) method.
13 %
14 % @par Syntax:
15 % @code
16 % [M, MU, MI, pi0] = cache_miss_fpi(gamma, m, lambda)
17 % @endcode
18 %
19 % @par Parameters:
20 % <table>
21 % <tr><th>Name<th>Description
22 % <tr><td>gamma<td>Item popularity probabilities
23 % <tr><td>m<td>Cache capacity vector
24 % <tr><td>lambda<td>(Optional) Arrival rates per user per item
25 % </table>
26 %
27 % @par Returns:
28 % <table>
29 % <tr><th>Name<th>Description
30 % <tr><td>M<td>Global miss rate
31 % <tr><td>MU<td>Per-user miss rate
32 % <tr><td>MI<td>Per-item miss rate
33 % <tr><td>pi0<td>Per-item miss probability
34 % </table>
35%}
36function [M,MU,MI,pi0]=cache_miss_fpi(gamma,m,lambda)
37% FPI method
38[n,~]=size(gamma);
39xi = cache_xi_fp(gamma,m);
40MI=zeros(n,1);
41for i=1:n
42 MI(i) = sum(lambda(:,i,1))/(1+gamma(i,:)*xi(:));
43end
44M=sum(MI);
45if nargin>2
46 u=size(lambda,1);
47 n=size(lambda,2);
48 MU=zeros(u,1);
49 pi0=zeros(1,n);
50 for i=1:n
51 pi0(i) = 1/(1+gamma(i,:)*xi(:));
52 for v=1:u
53 MU(v) = MU(v) + lambda(v,i,1)*pi0(i);
54 end
55 end
56end
57end