# Context-Aware Caching Distribution and UAV Deployment: A Game-Theoretic Approach
## 3 UAV-Assisted Caching Game
### Log-Linear Caching Algorithm  
After proposing the UAV-assisted caching game, it is desirable to find the NE point mentioned above. Therefore, the log-linear caching algorithm is proposed to optimize the performance of UAV-assisted networks motivated by Reference [16]. Different from greedy algorithms, the proposed algorithm guarantees that each UAV will not always take its best action. The mechanism avoids the dilemma of UAV-assisted networks falling into the local optimum. It will eventually result in a better NE solution by discarding a temporary good action. The detailed running mechanism of the proposed algorithm is as follows: Firstly, related parameters and actions of UAVs are initialized; secondly, one UAV is selected randomly to enter an exploratory stage, i.e., the selected UAV randomly chooses a new action with equal probability; finally, the selected UAV decides whether to explore the new action or to keep the original action according to its updating rules. More details are described in Algorithm 1. ```
1:\(\mathcal{N}=\{1,...,N\}\)
2:\(\mathcal{N}=\{1,...,N\}\)
3:\(\mathcal{N}=\{1,...,N\}\)
4:\(\mathcal{N}=\{1,...,N\}\)
5:\(\mathcal{N}=\{1,...,N\}\)
6:\(



the performance of all UAVs. Therefore, the proposed algorithm can maximize the performance of UAV-assisted networks. The similar proof process has been completed and more details can be read in Reference [33]. Thus, Theorem 2 is proved. ```
1. Initialization (1) Initialize randomly users' locations, file popularity and file requests \(Q_{m}\), \(m\in\mathcal{M}\). Initialize randomly \(l_{n}\) and \(c_{n}\),\(n\in\mathcal{N}\) satisfying to \(c1\) and \(c2\). (2) Moreover, set \(k=0\) as the round count and \(k_{\max}\) as the maximum round. 2. Repeat Round \(k=k+1\) Choose UAV \(n\) randomly. Repeat iterations:: (1) Calculate \(U_{n}\) by taking the action \(a_{n}\). (2) Generate \(a_{n}^{\prime}\) randomly from its strategy space (3) Calculate \(U_{n}^{\prime}\) by taking the action \(a_{n}^{\prime}\) and keep other UAVs' actions. (4) Update strategy: \(\Pr\left[a_{n}(k+1)=a_{n}(k)\right]=\frac{\exp(\beta U_{n})}{Y}\) \(\Pr\left[a_{n}(k+1)=a^{\prime}{}_{n}(k)\right]=\frac{\exp(\beta U^{\prime}{}_ {n})}{Y}\) where \(Y=\ \exp\left(\beta U_{n}\right)+\ \exp\left(\beta U^{\prime}{}_{n}\right)\), and \(\beta\) is the learning parameter. Meanwhile, all other UAVs keep their actions, and \(a_{-n}(k+1)=a_{-n}(k)\). (5) until \(k\geq k_{\max}\) or \(\Pr\left[a_{n}(k+1)\right]>0.95\), \(n\in\mathcal{N}\) End iterations Output : \(a^{*}=(a_{1}^{*},a_{2}^{*},...,a_{N}^{*})\)
```

**Algorithm 1**Log-linear caching algorithm (LCA)

## 4 Simulation and Numerical Results and Discussion

In this part, we conduct the simulation with MATLAB software and compare the impact of key parameters, i.e., the number of system files on the performance of UAV-assisted networks. Meanwhile, the simulation results verifies the effectiveness of the proposed model. ### Simulation Scenario

Considering a square region of \(200\times 200\) m\({}^{2}\), there are \(M=20\) users located randomly waiting to be served. Meanwhile, the communication distance threshold of UAVs is \(D_{n}=100\) m and the learning parameter of the proposed algorithm is \(\beta=40+k/25\), where \(k\) is the number of the current iterations. The different overheads per file per distance are \(w_{1}=0.1\), \(w_{2}=0.3\), \(w_{3}=2\), and \(w_{4}=5\), respectively. Moreover, the communication threshold is \(r_{th}=55\) dB. The communication probability threshold is \(P_{threshold}=0.5\). The transmitting power of UAVs and background noise are \(P_{n}=0.1\) w and \(N_{0}=-100\) dbm, respectively. The path loss exponent is \(\alpha=3\). The Nakagami fading is \(h\sim\Gamma\left(2,0.5\right)\). Inspired by Reference [24], the parameter related to the environment \(a\) and \(b\) is \(a=11.95\) and \(b=0.136\). ### Convergence Behavior

As shown in Figure 2, the performance of UAV-assisted networks finally converges to a stable state.