# Joint Optimization of Service Migration and Resource Allocation in Mobile Edge-Cloud Computing
## 3 System Model and Problem Definition
### Computation and Communication Model  
At the start of each time slot \(t\), a user offloads a task from a specific application type to the associated ES \(s_{i}\), where \(loc_{t}^{k}=i\). Utilizing the Shannon formula, the maximum transmission rate for offloading the task can be expressed as  
\[R_{t}^{j}=B\log_{2}\!\left(1+\frac{p_{t}^{j}g_{t}}{BN_{0}}\right), \tag{8}\]where \(B\) denotes the wireless channel bandwidth between the user and the RAN, \(p_{t}^{j}\) is the transmission power of user \(u_{j}\) or the associated RAN node, \(g_{t}\) represents the free-space path loss, and \(N_{0}\) is the noise power spectral density.  
The uplink transmission delay of \(task_{t}^{k}\) consists of two components: the delay for offloading the task to the nearest RAN node and the delay from this RAN node to ES \(s_{i}\), which hosts the SI. This can be represented as  
\[T_{t}^{tran,k}=\frac{V_{t}^{k}}{R_{t}^{j}}+\frac{V_{t}^{k}}{B_{loc_{t}^{j},i}}. \tag{9}\]  
Upon completion of \(task_{t}^{k}\) after \(r_{t}^{k}\) time slots, we define the resultant data size as \(V_{t+r_{t}^{k}}^{R,k}=\omega_{ret}^{W}V_{W}\), where \(V_{W}\) denotes the average task data size for the application type \(W\) of \(task_{t}^{k}\), and \(\omega_{ret}^{W}\) represents the ratio of the resultant data size to \(V_{W}\). The return delay of the task result can be expressed as  
\[T_{t+r_{t}^{k}}^{ret,k}=T_{t+r_{t}^{k}}^{box,k}+T_{t+r_{t}^{k}}^{down,k}, \tag{10}\]  
where \(T_{t+r_{t}^{k}}^{box,k}\) is the delay for returning the task result to the user's associated ES, and \(T_{t+r_{t}^{k}}^{down,k}\) is the delay for transmitting the result to the user over the wireless channel, given by  
\[T_{t+r_{t}^{k}}^{back,k}=\frac{V_{t+r_{t}^{k}}^{R,k}}{B_{\overline{v}_{t+r_{t} ^{k}}^{k},loc_{t+r_{t}^{k}}^{k}}}, \tag{11}\]  
\[T_{t+r_{t}^{k}}^{down,k}=\frac{V_{t+r_{t}^{k}}^{R,k}}{R_{t+r_{t}^{k}}^{j}}. \tag{12}\]  
Specifically, for results from the cloud, we have  
\[T_{t+r_{t}^{k}}^{back,k}=\frac{V_{t+r_{t}^{k}}^{R,k}}{B_{cloud,loc_{t+r_{t}^{k }}^{k}}}+\mu. \tag{13}\]  
The computational delay of a task on an ES depends on the task size, the computational intensity required for processing tasks, and the allocated computational resources. After \(task_{t}^{k}\) has been executed for a period of time in time slot \(t\), the remaining size of \(task_{t}^{k}\) can be expressed as  
\[V_{t+1}^{k}=V_{t}^{k}-\frac{p_{\overline{v}_{t}^{k}}\cdot(\tau-\phi_{t, \overline{v}_{t}^{k}})}{\kappa_{W}}, \tag{14}\]  
where \(\kappa_{W}\) denotes the computational intensity required by processing \(task_{t}^{k}\) of type \(W\) (measured in CPU cycles required per bit), and \(p_{\overline{v}_{t}^{k}}\) denotes the computational resources allocated to \(task_{t}^{k}\) on \(s_{\overline{v}_{t}^{k}}\) in time slot \(t\). The remaining time of \(task_{t}^{k}\) after the execution of the task in time slot \(t\) is updated as \(Rst_{t+1}^{k}=Rst_{t}^{k}-\tau\). The sum of the resources allocated to all tasks on \(s_{i}\) must satisfy its maximum resource constraint, i.e.,  
\[\textbf{C2}:\sum_{k=1}^{K_{t}}p_{\overline{v}_{t}^{k}}\leq p^{i},\quad\forall i \in\{1,\ldots,n\},\quad\forall t\in T. \tag{15}\]  
All mathematical symbols employed in this paper up to this point are systematically organized and presented in Table 1, following their order of introduction in the text.