# A Cross-Layer Optimization QoS Scheme in Wireless Multimedia Sensor Networks
## 3 Problem Formation and Dynamic Algorithm
### Design Dynamic Algorithm via Lyapunov Optimization
In each time slot, the optimal transmission power of node \(n\) is gained through multiple iterations of \(p_{m}^{T}(t)\). \(p_{m}^{T}(t)\) denotes the \(t^{\text{th}}\) iteration of \(p_{m}^{T}(t)\). \((j,j)\) represents other links, except for \((n,\,n)\), in the network. \(p_{m}^{T}(t)\) is updated as follows:

\[p_{m}^{T}(tt+1)=p_{m}^{T}(tt)+\kappa\cdot\
abla_{(n_{s},n_{s}^{{}^{\prime}})} \Psi(p^{T}(tt))\,, \tag{45}\]

where \(\kappa\) is the step size. The gradient of \(\Psi(p^{T}(tt))\) is calculated as:

\[\
abla_{(n_{s},n_{s}^{{}^{\prime}})}\Psi(p^{T}(tt))=\frac{B\cdot w_{m}}{B_{F}^ {2}\cdot p_{m}^{T}(tt)}+\delta_{s}-\sum_{j\
eq a}\frac{\frac{B \cdot w_{j}\cdot G_{w_{j}^{{}^{\prime}}}}{\sum_{k\
eq j,k\
eq s}/(k\
eq j)} \cdot W_{j}\cdot G_{w_{j}^{{}^{\prime}}}}{\sum_{k\
eq j,k\
eq s}/(k\
eq j)}\,. \tag{46}\]

If we set

\[m_{j}(tt)=\frac{\frac{B}{B_{F}^{2}}\cdot w_{j}\cdot\text{SINR}_{j} (tt)}{p_{g}^{T}(tt)\cdot G_{j}}\,, \tag{47}\]

then (45) can be transformed into:

\[p_{m}^{T}(tt+1)=p_{m}^{T}(tt)+\kappa\cdot\left[\frac{B\cdot w_{m}}{B_{F}^{2} \cdot p_{m}^{T}(tt)}+\delta_{t}-\sum_{j\
eq a}G_{w_{j}^{{}^{\prime}}}\cdot m _{j}(tt)\right]. \tag{48}\]

\(\text{H}\) denotes the Hessian matrix of \(\Psi(p^{T}(tt))\). \(I\) is the row-coordinate of \(\text{H}\), and \(c\) is the column-coordinate of \(\text{H}\). The following equality can be derived:

\[\text{H}_{l,e}= \begin{cases}-\frac{B\cdot w_{l}}{B_{F}^{2}\cdot (p_{l}^{T}(tt))^{2}}+\sum_{j\
eq l}\frac{B\cdot w_{j}\cdot G_{w_{j}^{{}^{ \prime}}}\cdot B_{F}^{2}}{\left(\sum_{k\
eq j}G_{w_{j}^{{}^{\prime}}}\cdot p_{ w_{j}^{{}^{\prime}}}^{T}(tt)+n_{j}\right)^{2}}&\text{if }l=c\\ \\ \sum_{j\
eq l,j\
eq c}\frac{B\cdot w_{j}\cdot G_{w_{j}^{{}^{\prime}}}\cdot G_{ \bar{w}_{j}^{{}^{\prime}}}\cdot B_{F}^{2}}{\left(\sum_{k\
eq j}G_{w_{j}^{{}^{ \prime}}}\cdot p_{w_{j}^{{}^{\prime}}}^{T}(tt)+n_{j}\right)^{2}}&\text{if }l \
eq c\end{cases} . \tag{49}\]

\(L\) and \(C\) are defined as:

\[L=\max_{l}[\sum_{c<n\
eq l}\sum_{j\
eq l,j\
eq c}\frac{B\cdot w_{j}\cdot G_{ \bar{y}}\cdot G_{\bar{y}}\cdot B_{F}^{2}}{\left(\sum_{k\
eq j}G_{w_{j}^{{}^{ \prime}}}\cdot p_{w_{j}^{{}^{\prime}}}^{T}(tt)+n_{j}\right)^{2}}+|-\frac{B \cdot w_{\bar{y}}}{B_{F}^{2}\cdot(p_{ll}^{T}(tt))^{2}}+\sum_{j\
eq l}\frac{B \cdot w_{\bar{y}}\cdot G_{\bar{y}}^{2}\cdot B_{F}^{2}}{\left(\sum_{k\
eq j}G_{ w_{j}^{{}^{\prime}}}\cdot p_{w_{j}^{{}^{\prime}}}^{T}(tt)+n_{j}\right)^{2}}\,] (50)

\[C=\max_{c}[\sum_{l\
eq c}\sum_{j\
eq l,j\
eq c}\frac{B\cdot w_{j}\cdot G_{\bar{ y}}\cdot G_{\bar{y}}\cdot B_{F}^{2}}{\left(\sum_{k\
eq j}G_{\bar{y}}\cdot p_{w_{j}^{{}^{ \prime}}}^{T}(tt)+n_{j}\right)^{2}}+|-\frac{B\cdot w_{c}}{B_{F}^{2}\cdot(p_{c }^{T}(tt))^{2}}+\sum_{j\
eq c}\frac{B\cdot w_{j}\cdot G_{\bar{y}}^{2}\cdot B_{F }^{2}}{\left(\sum_{k\
eq j}G_{\bar{y}}\cdot p_{w_{j}^{{}^{\prime}}}^{T}(tt)+n_{ j}\right)^{2}}\,] (51)

We set \(K=\sqrt{L\cdot C}\), \(\varepsilon\leq\frac{2}{1+K}\). The step size \(\kappa\) is set as: \(\varepsilon\leq\kappa\leq\frac{2-\varepsilon}{K}\). If step size is small enough, the algorithm can achieve global convergence. The details of the algorithm implemented in each iteration \(tt\) are as follows: (i) The receiving node of each link \((j,j)\) in \(I_{c}\) measure and gain \(SINR_{j}(tt)\) and \(G_{j}\). Node \(j\) also calculates \(w_{j}\) and \(m_{j}(tt)\) using (37) and (47), respectively. (ii) Each receiving node \(j\) broadcasts \(m_{j}(tt)\) in the network. (iii) After gathering \(m_{j}(tt)\) from all receiving nodes, each send node updates its transmission power according to (48). (iv) \(tt=tt+1\), and jump to (i) again. (v) The iterations are stopped until convergence is achieved. ``` There are \(s\) links in link set \(I_{c}\), which are \((n_{1},n_{i})\),\((n_{2},n_{2}^{\prime})\  
3.2, was set to be 150m. Data was transmitted in packets with a length of 4000 bits. There was a total of \(N\) nodes in the network, including one sink node, \(0.8\cdot N\) non-real-time nodes, and \(0.2\cdot N-1\) multimedia nodes.