LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
cache_mva.m
1%{ @file cache_mva.m
2 % @brief Exact Mean Value Analysis for caches
3 %
4 % @author LINE Development Team
5%}
6
7%{
8 % @brief Performs exact Mean Value Analysis for cache systems
9 %
10 % @details
11 % This function computes exact performance metrics for cache systems
12 % using Mean Value Analysis with given item popularity probabilities
13 % or arrival rates and cache capacity.
14 %
15 % @par Syntax:
16 % @code
17 % [pi, pi0, pij, x, u, E] = cache_mva(gamma, m)
18 % @endcode
19 %
20 % @par Parameters:
21 % <table>
22 % <tr><th>Name<th>Description
23 % <tr><td>gamma<td>Item popularity probabilities or arrival rates
24 % <tr><td>m<td>Cache capacity vector (size h for h levels)
25 % </table>
26 %
27 % @par Returns:
28 % <table>
29 % <tr><th>Name<th>Description
30 % <tr><td>pi<td>State probability vector
31 % <tr><td>pi0<td>Miss probability per item
32 % <tr><td>pij<td>Hit probability per item per list
33 % <tr><td>x<td>Throughput vector
34 % <tr><td>u<td>Utilization per item
35 % <tr><td>E<td>Normalizing constant
36 % </table>
37%}
38function [pi,pi0,pij,x,u,E] = cache_mva(gamma,m)
39[n,h]=size(gamma);
40SS=[];
41for l=1:h
42 SS = State.cartesian(SS, [1:(m(l)+1)]');
43end
44SS=SS-1;
45pi=zeros(size(SS,1),n);
46pij=zeros(size(SS,1),n,h);
47x=zeros(1,h);
48E=1;
49%Ecur=SS(1,:);
50for s=1:size(SS,1)
51 mcur = SS(s,:);
52 for l=1:h
53 mcur_l = oner(mcur,l);
54 s_l = matchrow(SS,mcur_l);
55 if s_l > 0
56 x(l) = mcur(l)/(gamma(:,l)'*(1-pi(s_l,:))');
57 pij(s,:,l) = gamma(:,l)'.*(1-pi(s_l,:))*x(l);
58 pi(s,:) = pi(s,:) + pij(s,:,l);
59 end
60 end
61end
62s = matchrow(SS,m);
63pi=pi(s,:)';
64pij=reshape(pij(s,:,:),n,h);
65pi0=1-pi;
66if nargout>2
67 for l=1:h
68 for k=1:n
69 u(k,l)=x(l)*gamma(k,l);
70 end
71 end
72end
73end