# Mobility- and Energy-Aware Cooperative Edge Offloading for Dependent Computation Tasks +
## 5 Solution of Dynamic Computation Offloading Optimization Problem
### Conversion of \(Op1\) into QCQP  
The first conversion step for OPI is to convert the integer constraints to a quadratic formulation:  
\[ \begin{split}& x_{k}(x_{k}-1)=0,\ h_{k}^{i}\Big{(}h_{k}^{i}-1 \Big{)}=0,\ s_{k}^{m}(s_{k}^{m}-1)=0,\\ & s_{k}^{i,m}\Big{(}s_{k}^{i,m}-1\Big{)}=0,\ \forall k\in\mathcal{K}, \forall i\in\mathcal{I},\forall m\in\mathcal{M}.\end{split}  \tag{25}\]  
With these quadratic constraint formulations, the QCQP transformation of OP1 becomes  
\[ \begin{split} OP2:&\min_{\alpha,\beta}\quad E_{ \text{tot}}^{\text{exe}}\\ & s.t:C1:& x_{k}(x_{k}-1)=0,\ h_{k}^{i}\Big{(}h_{k}^{i }-1\Big{)}=0,\\ & s_{k}^{m}(s_{k}^{m}-1)=0,\ s_{k}^{i,m}\Big{(}s_{k}^{i,m}-1\Big{)} =0,\\ &\forall k\in\mathcal{K},\forall i\in\mathcal{I},\forall m\in \mathcal{M};\\ & C2:x_{k}+\sum_{i=1}^{I}h_{k}^{i}+\sum_{m=1}^{M}s_{k}^{m}+\sum_{m =1}^{M}\sum_{i=1}^{I}s_{k}^{i,m}=1,\ \ \forall k\in\mathcal{K};\\ & C3_{0}:ST_{k}=0\ \forall j\in\mathcal{P}(k),\mathcal{P}(k)= \emptyset,\ \forall k\in\mathcal{K};\\ & C3_{1}:ST_{k}-FT_{j}\geq 0,\ \forall j\in\mathcal{P}(k), \mathcal{P}(k)\
eq\emptyset,\ \ \forall k\in\mathcal{K};\\ & C4:FT_{K}\leq T_{d}^{\text{max}};\ \ C5:FT_{k}\leq T_{s,k},\ \forall k\in \mathcal{K};\end{split}  \tag{26}\]  
where we reformulated \(C1\) and vectorized C3. Next, we define a vector \(v\) of dimension \(((2+I+M+IM)K+1)\times 1\) as \(v=[\alpha,\beta,1]^{T}\), and a standard unit vector \(e_{j}\) with the \(j\)th entry equal to 1 and dimension \(((2+I+M+IM)K+1)\times 1\). Furthermore, we define  
\[ \begin{split} v=&[x_{1},h_{1}^{1},\ldots,h_{1}^{I}, s_{1}^{1},\ldots,s_{1}^{M},s_{1}^{1,1},\ldots,s_{1}^{I,M},\ldots,x_{K},\\ & h_{K}^{1},\ldots,h_{K}^{I},s_{K}^{1},\ldots,s_{K}^{M},s_{K}^{1,1 },\ldots,s_{K}^{IM},ST_{1},\ldots,ST_{K},1]^{T},\\ n_{0}=&[E_{1}^{I},E_{1}^{h_{1}},\ldots,E_{1}^{h_{I} },E_{1}^{s_{1}},\ldots,E_{1}^{s_{M}},E_{1}^{s_{1}},\ldots,\\ & E_{1}^{s_{I,M}},\ldots,E_{K}^{I_{K}},E_{K}^{h_{I}},\ldots,E_{K} ^{h_{I}},E_{1}^{s_{1}},\ldots,E_{K}^{s_{M}},\\ & E_{K}^{s_{1}},\ldots,E_{K}^{s_{I,M}},\mathbf{0}_{1\times(K+1)} ]\end{split}  \tag{27}\]  
as the set of decisions to which devices the tasks should be offloaded to or through, respectively; \(n_{0}\) is the vector of energy consumptions associated with a full set of decisions, extended by a row of zeros for the optimizer, and\[n_{1k}= e_{(1+l+M+IM)(k-1)+1}+\cdots+e_{(1+l+M+IM)k-1} \tag{28}\] \[+e_{(1+l+M+IM)k}+e_{(1+l+M+IM)K+k}\] \[n_{2}= [0_{1\times(2+l+M+IM)(K-1)},T_{K}^{l},T_{K}^{h_{1}},\ldots,T_{K}^ {h_{l}},\] \[T_{K}^{s_{1}},\ldots,T_{K}^{s_{M}},T_{K}^{s_{1},\ldots,T_{K}^{s_{M }},0_{1\times(K-1)},1,0]^{T}\] \[n_{3}= e_{(2+l+M+IM)(j-1)+1}+\cdots+e_{(2+l+M+IM)j-1}\] \[+e_{(2+l+M+IM)j}+e_{(2+l+M+IM)K+j}\] \[n_{T}= [T_{1}^{l},T_{1}^{h_{1}},\ldots,T_{1}^{h_{1}},T_{1}^{s_{1}}, \ldots,T_{1}^{s_{M}},T_{1}^{s_{1}},\ldots,\] \[T_{1}^{s_{1},M},\ldots,T_{K}^{s_{M}},T_{K}^{h_{1}},\ldots,T_{K}^ {s_{1}},\ldots,T_{K}^{s_{M}},\] \[T_{K}^{s_{1},\ldots,T_{K}^{s_{M}},1_{1\times(K+1)}]}\] \[n_{T_{s}}= [T_{d}^{\max},T_{s,d}^{h_{1}},\ldots,T_{s,d}^{h_{1}},T_{s,d}^{s_ {1}},\ldots,T_{s,d}^{s_{M}},T_{s,d}^{s_{1},\ldots,}\] \[+e_{(1+l+M+IM)k}+e_{(1+l+M+IM)K+k}\]0 \[+e_{(1+l+M+IM)k}+e_{(1+l+M+IM)K+k}\]1  
are the reformulated equations for the constraints, consisting of standard unit vectors as well as task execution times and sojourn times. The vector \(n_{1k}\) corresponds to the \((1+l+M+IM)\) probabilities of the offloading strategies for task \(k\) and additionally the task \(k\) deadline (used in C5). In the definition of \(n_{2}\), \(T_{K}^{l}\) is the local task \(K\) execution time from Equation (4), \(T_{K}^{h_{k}}\) is the UH\({}_{i}\) task \(K\) execution time from Equation (6), \(T_{K}^{\text{gen}}\) is the server \(m\) task \(K\) execution time from Equation (9), and \(T_{K}^{s_{i},m}\) is the task \(k\) execution time with relaying via UH\({}_{i}\) to server \(m\) from Equation (12); these execution times for the various tasks \(k\), \(k=1,\ldots,K\), are also used in the definition of \(n_{T}\).