# Cooperative Caching and Resource Allocation in Integrated Satellite-Terrestrial Networks
## 4 Problem Formulation
### Cooperative Caching and Resource Allocation Problem
#### 4.1.4 Problem Description
For _strategy 2_, as the required content was deployed on satellite \(v_{4}\), the content service can be just provided by routing path \(v_{4}\to v_{0}\), where the deployment costs can be only from the network bandwidth consumption. Furthermore, the candidates \(\{v_{5},v_{6},\cdots,v_{12}\}\) in the third layer will continue to be searched and _strategy 3_ can be obtained, where the required content was also deployed on satellite \(v_{8}\) and the content service can be just provided by routing path \(v_{8}\to v_{3}\to v_{0}\). Therefore, considering that the bandwidth consumption of _strategy 3_ is more than that of _strategy 2_, _strategy 3_ will be viewed as the feasible strategy with minimum deployment costs. In a dynamic environment, for each time slot, the ground station can autonomously perceive the changes in the surroundings and then make the strategies for new users one-by-one. The cache contents on satellites will be released to reduce the storage resource usage when the idle time is more than the threshold time. However, in practical application scenarios, considering the real-time of content services, the content services are provided  
Figure 3: Content service provisioning by neighborhood search. based on the content caching strategies generated in the previous time slot, and then, the performance can be improved based on the current service requirements. The procedure of the proposed CCRA algorithm for one time slot is shown in Algorithm 1, where the input parameters include users \(U\) and sub-network hops \(h_{sub}\), and the output parameters are the feasible strategies \(S_{U}^{*}\) for all the users. In the beginning, the state information can be updated, e.g., network operation, resource utilization, and content caching. Then, the new accessed users \(U_{v}\) for each satellite \(v\) are sorted by content popularity in descending order, and the feasible strategy with minimum deployment costs will be searched for each user. ```
0: Users \(U\), sub-network hops \(h_{sub}\);
0:\(S_{U}^{*}\);
1:Initialize: Update the information of network state;
2:for each \(v\in V\)do
3: Sort all users by content popularity in descending order;
4:for each \(u\in U_{v}\)do
5:\(s_{u}=\varnothing\), \(A_{layer}\leftarrow\{v_{u,a},path=\varnothing\}\);
6:while\(A_{layer}\
eq\varnothing\)do
7:\(\bar{A}_{layer}=\varnothing\);
8:for each \(a\in A_{layer}\)do
9:if the required content is deployed then
10:if Equations (12)-(15) are satisfied then
11:\(s_{u}\leftarrow\{a,\textit{True},\textit{True}\}\);
12:endif
13:else
14:if Equations (13)-(15) are satisfied then
15:\(s_{u}\leftarrow\{a,\textit{True},\textit{False}\}\);
16:endif
17:endif
18:if the current hops are less than \(h_{sub}\)then
19:\(\bar{A}_{layer}\leftarrow\) the available neighbors and paths;
20:endif
21:endfor
22:\(A_{layer}\leftarrow\bar{A}_{layer}\);
23:endwhile
24:if\(s_{u}=\varnothing\) or satellite \(v_{d,a}\in V_{v,sub}\)then
25:for each \(path\in P_{u,d}^{L}\)do
26:if the bandwidth resources are satisfied then
27:\(s_{u}\leftarrow\{path,\textit{False},\textit{False}\}\) and break;
28:endif
29:endfor
30:endif
31:\(s_{u}^{*}\gets min\ s_{u}\) calculated by Equation (19) and provide content service by \(s_{u}^{*}\);
32: Update the information of network state again;
33:endfor
34:endfor
35:return\(S_{U}^{*}=\{s_{u}^{*}|u\in U\}\);
```  
**Algorithm 1** Proposed CCRA Algorithm. For each user \(u\), in the beginning, the strategy set can be indicated as \(s_{u}=\varnothing\), the information concerning the root candidate, i.e., access satellite \(v_{u,a}\), in the initial layer can be indicated as \(A_{layer}\leftarrow\{v_{u,a},path=\varnothing\}\), and an auxiliary set is also indicated as \(\bar{A}_{layer}=\varnothing\) to describe the procedure of the proposed algorithm more clearly. Then, all the candidates in \(A_{layer}\) will be searched to obtain the feasible strategies, where there are two possible scenarios for each candidate \(a\) to be considered.