# Proactive Service Caching in a MEC System by Using Spatio-Temporal Correlation among MEC Servers
## 3 System Model
\begin{bmatrix}a_{1,1}(t)&\dots&a_{1,K}(t)\\ \dots&\dots&\dots\\ a_{m,1}(t)&\dots&a_{m,K}(t)\\ \dots&\dots&\dots\\ a_{M,1}(t)&\dots&a_{M,K}(t)\\ \end{bmatrix} . \tag{3}\]  
We denote the set of services in the service cache of a MECS \(m\) during a time slot \(t\) as  
\[S_{m}(t)=\{k|a_{m,k}(t)=1,\forall k\in\mathcal{K}\}. \tag{4}\]  
Our goal is to devise a controller that determines an optimal \(S_{m}(t),\forall m\in\mathcal{M}\) (i.e., an optimal \(A_{M\times K}(t)\)) at the beginning of a time slot \(t\), so that the cache hit rate in a MEC system during the time slot is maximized. We denote the set of users in the service area of a MECS \(m\) during a time slot \(t\) as \(U_{m}(t)\). We introduce an indicator function \(b_{m,u,k}(t)\). When \(b_{m,u,k}(t)=1\), it represents the situation where a task offloaded from a user \(u\) to a MECS \(m\) during a time slot \(t\) requests for a service \(k\). Otherwise, \(b_{m,u,k}(t)=0\). Then, our problem is formally stated as follows. \[ \begin{split} A_{M\times K}^{*}(t)&=\arg_{A_{M\times K }(t)}\max\sum_{m\in\mathcal{M}}\sum_{u\in U_{m}(t)}\sum_{k\in\mathcal{K}}a_{m, k}(t)b_{m,u,k}(t),\\ & s.t.\sum_{k\in\mathcal{K}}a_{m,k}(t)\leq\eta_{m},\ \ \forall m\in \mathcal{M}.\end{split}  \tag{5}\]  
Figure 2: System model. An optimal \(A_{M\times K}(t)\) is determined by the popularity of each service in each MECS during a time slot \(t\). In other words, if we know the popularity of each service within the service area of each MECS during a time slot, the optimal \(S_{m}(t)\), which we denote as \(S_{m}^{*}(t)\), can be determined by selecting the top \(\eta_{m}\) services with the highest popularity in each MECS \(m\). Then, the element \(a_{m,k}^{*}(t)\) in the optimal \(a_{m}(t)\) denoted by \(a_{m}^{*}(t)\) is determined as  
\[a_{m,k}^{*}(t)= \begin{cases}1&\text{if }k\in S_{m}^{*}(t)\\ 0&\text{otherwise,}\end{cases}  \tag{6}\]  
and the optimal \(A_{M\times K}(t)\) becomes \(A_{M\times K}^{*}(t)=\{a_{m}^{*}(t):m\in\mathcal{M}\}^{T}\). If we denote the popularity of a service \(k\) in a MECS \(m\) during a time slot \(t\) as \(f_{m,k}(t)\), it is determined by the service preference of the users in \(U_{m}(t)\), which is quantified as \(\sum_{u\in U_{m}}b_{m,u,k}(t)\). However, in terms of implementation, a controller cannot know \(b_{m,u,k}(t)\) at the beginning of a time slot \(t\), which makes it difficult to find an optimal \(A_{M\times K}(t)\) at the beginning of each time slot. To resolve these issues, we take a measurement-based approach inspired by a deep learning model for a sequence forecasting problem. The popularity of a service \(k\) in a MECS \(m\) is affected by \(\sum_{u\in U_{m}(t)}b_{m,u,k}(t)\). User service preferences (\(b_{m,u,k}(t)\)) vary in space and time because both \(U_{m}(t)\) and the service preferences in \(U_{m}(t)\) change in time and space. For example, the services used by users during daytime at the workplace differ from those utilized in the evening at home. Specifically, since a user can move from a MECS \(n\) to its neighboring MECS \(m\) during a time slot and vice versa, \(U_{m}(t)\) is influenced not only by \(U_{m}(t-1)\), \(U_{m}(t-2)\),..., but also by \(U_{n}(t-1)\), \(U_{n}(t-2)\),..., where \(n\in\mathcal{M}-\{m\}\). Therefore, the service popularity distribution in a MECS \(m\) and that in MECS \(n\) during a time slot exert mutual influence on each other. In other words, \(f_{m,k}(t)\) is affected by the spatio-temporal correlation among the MECSs in terms of the set of users (\(U_{m}(t)\) and \(U_{n}(t)\)) and their service preferences (\(b_{m,u,k}(t)\) and (\(b_{n,u,k}(t)\))). Therefore, we transform the problem in Equation (5) into a spatio-temporal sequence forecasting problem as follows. We denote the service popularity matrix of a MEC system during a time slot \(t\) as \(M\times K\) matrix \(F_{M\times K}(t)=\{f_{m}(t)|m\in\mathcal{M}\}^{T}\), where \(f_{m}(t)=\{f_{m,k}(t)|k\in\mathcal{K}\}\).