## 4 Problem Formulation and Analysis  
The offloading decision determined the execution location for the computational tasks (e.g., sMEC offloading or mMEC offloading). Therefore, we divided the computation-offloading decision into two phases. The first involves task offload to the MEC server via the SBS, and the second involves task execution at the sMEC or the mMEC (migration from SBS to the mMEC through the fiber-optic link). Let \(\mathbf{Y}=\{y_{mn}|m\in\mathcal{M},n\in\mathcal{N}\}\) denote the offloading-decision matrix, where each element \(y_{mn}\) is given as follows:  
\[y_{mn}= \begin{cases}1,&\text{if the MD $m$ offloads its computational task to the sMEC $n$,}\\ 0,&\text{otherwise.}\end{cases}  \tag{12}\]  
Because a task is offloaded to at most one MEC server, the following constraint must be satisfied: \(\sum_{n=1}^{N}y_{mn}\leq 1,\ \forall m\in\mathcal{M}\). Let \(\mathbf{Z}=\{z_{mn}|m\in\mathcal{M},n\in\mathcal{N}\}\) represent the matrix of offloading place for task \(I_{m}\):  
\[z_{mn}= \begin{cases}1,&\text{the task $I_{m}$ is executed on the sMEC $n$,}\\ 0,&\text{the task $I_{m}$ is executed on the mMEC.}\end{cases}  \tag{13}\]  
The following constraint ensures that each task can be executed by at most one MEC server: \(\sum_{n=1}^{N}z_{mn}\leq 1,\ \forall m\in\mathcal{M}\). Additionally, we denote \(\mathcal{M}_{\text{off}}=\{m\in\mathcal{M},n\in\mathcal{N}|y_{mn}=1,z_{mn}=1\}\) as the set of MDs that offload their tasks to sMECs and \(\mathcal{M}_{n}=\{m\in\mathcal{M}|y_{mn}=1,z_{mn}=1\}\) as the set of MDs that offload their tasks to the sMEC \(m\). Finally, we denote the computational-resource matrix for the sMEC as \(F=\{f_{mn}|m\in\mathcal{M},n\in\mathcal{N}\}\), where \(f_{mn}>0\) is the resource allocation of sMEC \(n\) to computational task \(I_{m}\) offloaded from MD \(m\in\mathcal{M}_{n}\). Typically, the amount of computing resources at the sMEC is limited; therefore, the following constraint must be satisfied: \(\sum_{m\in\mathcal{M}_{n}}f_{mn}\leq f_{m}^{\text{max}},\ \forall n\in\mathcal{N}\), where \(f_{n}^{\text{max}}\) denotes the maximum computing capability of sMEC \(n\). Moreover, \(f_{mn}=0\) if \(m\
otin\mathcal{M}_{n}\), indicating that sMEC \(n\) does not allocate any computing resources to MD \(m\). Here, we describe joint optimization of resource allocation and computation-offloading decision strategies in order to minimize the total computing overhead of MDs, including completion time and energy consumption. In particular, the total time necessary to accomplish computational task \(I_{m}\) is computed as follows:  
\[T_{m}=\sum_{n=1}^{N}y_{mn}\left(T_{mn}^{t}+z_{mn}T_{mn}^{es}+(1-z_{mn})(T_{mn }^{tm}+T_{mn}^{cm})\right)+\left(1-\sum_{n=1}^{N}y_{mn}\right)T_{m}^{l} \tag{14}\]  
The total energy consumption required to complete computational task \(I_{m}\) is computed as follows:  
\[E_{m}=\sum_{n=1}^{N}y_{mn}\left(z_{mn}E_{mn}^{\text{sbs}}+(1-z_{mn})E_{mn}^{ mbs}\right)+\left(1-\sum_{n=1}^{N}y_{mn}\right)E_{m}^{l} \tag{15}\]Therefore, the optimization problem can be expressed as follows:  
\[\underset{Y,Z,F}{\text{minimize}} \sum_{m=1}^{M}(\lambda_{m}^{e}E_{m}+\lambda_{m}^{t}T_{m})\] subject to C1: \[y_{mn},z_{mn}\in\{0,1\},\ \forall m\in\mathcal{M},\ \forall n\in\mathcal{N},\] C2: \[\sum_{n=1}^{N}y_{mn}\leq 1,\ \forall m\in\mathcal{M},\] C3: \[\sum_{n=1}^{N}z_{mn}\leq 1,\ \forall m\in\mathcal{M},\] C4: \[\sum_{m=1}^{M}y_{mn}\leq H,\ \forall\ n\in\mathcal{N},\] C5: \[f_{mn}>0,\ \forall m\in\mathcal{M}_{\text{off}},\ \forall n\in\mathcal{N},\] C6: \[\sum_{m\in\mathcal{M}_{n}}f_{mn}\leq f_{n}^{\text{max}},\forall n\in \mathcal{N},\]  
where \(\lambda_{m}^{e},\lambda_{m}^{t}\in[0,1]\). and \(\lambda_{m}^{e}+\lambda_{m}^{t}=1\) depict the weights associated with energy consumption and completion time for MD \(m\) and \(H\) is the number of subcarriers (denoting the number of MDs allowed to offload their computational tasks simultaneously).