# Cooperation Based Proactive Caching in Multi-Tier Cellular Networks
## 5 Proposed Framework  
The prediction of the content requested in future must now leverage to determine which content is to be cache at the BS in each tier. Hence, cache hit ratio is maximized by not only placing the required content, requested by the users now but also it caches the content to be requested in future. If a user finds the requested content in its associated base station then the cache is a hit or otherwise a miss. However, due to limited capacity of the base station, cache hit ratio cannot achieve its maximum value 1, but if the requested contents and of course, the future requested contents are placed then optimum value of the cache hit ratio can be obtained. The average cache hit ratio is maximize by taking all tier into account.  
In this section, we formulate the proposed Algorithm 1 to the problem in (3). First of all we clustered the BSs in each tier based on past requests and initialize the capacity matrix \(S_{mt}\) and cache decision matrix \(X_{t}\). Then in cluster each, we find the average request of the files and sort them in descending order. Now, fill half of the cache of each BS with the contents whose average requests is greater and set the entry in the \(Xt\) matrix equal to 1 and update the cache size and repeat it till size of the BS reaches 50% of the maximum size. The rest of the cache is filled by the contents that will be requested in future predicted by CF. Weights similarity are find out using Equation (8) and \(P^{t}\) (\(m_{i,f}\)) using Equation (9) and are sorted in descending order. After doing this, if file f is not in the BSm and the BS current cache and the size of the file is less than maximum capacity than cache it and set the entry \(Xm\),j of the cache decision \(Xt\) equal to 1 and update the current cache of the SBS m. Repeat this algorithm until it touches the SB maximum caching capacity. Repeat this algorithm for all tiers except Macro BS. Finally, cache decision matrix \(Xt\) is obtained. Subscript/superscript 1, 2, and 3 show tier 1, tier 2, and tier 3, respectively.  
```
1 Input: P1, P2, P3, S1, S2, S3, L1, L2, L3, F1, F2, F3 Output: Xt
1. Cluster the base stations k = 1, 2, 3... Hk based on past requests in each tier except Macro cell
2.For Pico BS do
3. Initialize the cache size [S1] and caching matrix [X1]
4. [a,b] = **SORT** AR_fwhere AR is the average popularity of the most requested file. Sort AR by descending order.
5.For BSm in H\({}_{\text{K}}\)do
6.For i = 1......... F1 do
7.Gets index of ith highest AR in cluster k,
8.j -bi
9.ifL1j + \(\hat{s}_{m1}\leq 0.5\) + Sm1 then
10.Xmj = 1
11.\(\hat{s}_{m1}=\) L1j + \(\hat{s}_{m1}\)
12.else
13.Break
14.End
15.End
16.Calculate the similarity matrix i.e., Wi,j
17.Find the P(mit,f)
18. [a,b] \(\leftarrow\)**SORT** (P(mit,f)) /_Sorts it by descending order, returns a, b as ordered values and indices._
19.For BSm in H\({}_{\text{K}}\)do
20.For i = 1......... F1 do
21.ifL1f + \(\hat{s}_{m1}\leq\) Sm1 then
22.ifXm,f \(\
eq\) 1 then
23.Make Xm,f = 1
24.\(\hat{s}_{m1}=\) L1f + \(\hat{s}_{m1}\)
25.else
26.continue
27.else
28.break
29.returnX1
30.End
31.For Micro BS do
32.Repeat 3-30 and replacing all superscripts and subscripts 1 with 2 and return X2
33.For Macro BS
34.Initialize S3
35. [a,b] = **SORT** (CP) // Sort Content Popularity (CP) by descending order.
36.For i = 1......... F3 do
37.get index of the highest CP
38.j -bi
39.ifLj + S3 \(\leq\) S3 then
40.Xmj = 1
41.S3 = L3j + S3
42.else
43.Break
44.returnX3
45.End
```  
**Algorithm 1**Contents Caching