## 4 Layered SDN-Based Optimization Framework
### Iterative Solution via Gradient Descent  
We omit the time index \(t\) to avoid notational clutter. The dual objective function of the subproblem (3) can be written as  
\[\Phi_{1}\Big{(}y_{g},\lambda_{y_{g}};\mathbf{Q}\Big{)}\triangleq\lambda_{y_{g}}y _{g}+\max_{z_{g}}\sum_{n\in\mathcal{N}_{g}}(Q_{n}-\lambda_{y_{g}})z_{n}, \tag{9}\]  
whereby \(\mathbf{Q}\) denotes the vector of queue occupancies. We introduce the Lagrangian dual variable \(\lambda_{Z}\) for the constraint in (3), the Lagrangian dual variables \(\{\lambda_{x_{o}}:o=1,\ldots,O\}\) for the constraints in (4), and the Lagrangian dual variables \(\{\lambda_{y_{g}}:g\in\mathcal{G}\}\) for the constraints in (5). Then, unfolding all the constraints, we obtain (10) and following a cascade of primal dual decompositions (see [42]), the optimization can be solved via the sequence of projected gradient descent updates:  
\[\overbrace{\overbrace{\big{\}}\big{\}}_{\Phi_{4}(\lambda_{Z}; \mathbf{Q})}^{\Phi_{5}(\lambda_{Z};\mathbf{Q})}\] \[\min_{\lambda_{Z}}\;\lambda_{Z}Z+\sum_{o=1}^{O}\max_{x_{o}}\left(- \lambda_{Z}-\frac{\Theta_{o}}{V}\right)x_{o}+\min_{\lambda_{x_{o}}}\;\lambda_ {x_{o}}x_{o}+\sum_{g\in\mathcal{G}_{o}}\max_{y_{g}}\overbrace{-\lambda_{x_{o }}y_{g}+\min_{\lambda_{y_{g}}}\Phi_{1}(y_{g},\lambda_{y_{g}};\mathbf{Q})}^{ \Phi_{5}(\lambda_{Z};\mathbf{Q})} \tag{10}\]  
\[\lambda_{Z}^{(k+1)} =\!\left[\lambda_{Z}^{(k)}\!-\!\alpha_{1}^{(k)}\!\left(\!Z\!-\! \sum_{o=1}^{O}\!\operatorname*{argmax}_{x_{o}}\Phi_{4}\!\left(\lambda_{z}^{(k )},x_{o}\right)\right)\right]^{+} \tag{11}\] \[x_{o}^{(k+1)} =\!\left[x_{o}^{(k)}\!\!+\!\alpha_{2}^{(k)}\!\left(\!\operatorname* {argmin}_{\lambda_{x_{o}}}\Phi_{3}\!\left(x_{o}^{(k)},\lambda_{x_{o}}\right)\! -\!\lambda_{Z}\!-\!\frac{\Theta_{o}}{V}\right)\right]^{+}\] (12) \[\lambda_{x_{o}}^{(k+1)} =\!\left[\lambda_{x_{o}}^{(k)}\!\!-\!\alpha_{3}^{(k)}\!\left(\!x _{o}\!-\!\!\sum_{g\in\mathcal{G}_{o}}\!\operatorname*{argmax}_{y_{g}}\Phi_{2 }\!\left(\lambda_{x_{o}}^{(k)},y_{g}\right)\!\right)\right]^{+}\] (13) \[y_{g}^{(k+1)} =\!\left[y_{g}^{(k)}+\!\alpha_{4}^{(k)}\!\left(\!\operatorname*{ argmin}_{\lambda_{y_{g}}}\Phi_{1}(y_{g}^{(k)},\lambda_{y_{g}})-\lambda_{x_{o}} \right)\right]^{+}, \tag{14}\]  
where the different \(\alpha\) denote step sizes. The bottom layer optimization in (9) can be solved with Algorithm 1, while the solution for a general utility is shown in [90]. We note that to ensure the convergence of the decomposition, the updates in (11)-(14) must be read as follows: to reach the optimal \(\lambda_{Z}\), the SDN orchestrator needs to perform a sufficient number of iterations in (11). However, before computing one iteration of (11), the operator layer below should perform a sufficient number of iterations of (12) upon receiving the Lagrangian \(\lambda_{Z}\), and so on. Unless a value can be computed in closed form in one shot, each update that includes the solution of an optimization problem (i.e., it has an argmax or argmin term in the update) requires a sufficient number of gradient descent updates at the lower level to approximate the solution of the subproblem. Therefore, the indices \(k\) in (11)-(14) are _not_ associated with the same timescale. If the computation at each layer and the communication delays among layers were all negligible, we would be in the _timescale separation_ regime [42; 43]. However, this is not possible in a real system, since latencies play a significant role in real networks and the framework we are about to explain explicitly takes these latencies into consideration. We also note that in this decomposition model, there is no sharing of information among the operators, which makes the model more practical. All message passing occurs only between neighboring layers, whereby the lower layer sends the optimal resource allocation and the upper layer sends the dual variable.