# A Cross-Layer Optimization QoS Scheme in Wireless Multimedia Sensor Networks
## 3 Problem Formation and Dynamic Algorithm
### Design Dynamic Algorithm via Lyapunov Optimization
\begin{array}{l}E\{\Delta_{F}\Theta(t)\}\leq B^{{}^{\prime}}-(1/B_{F}^{2}) \cdot\sum_{m=M}\left[V\cdot\mathrm{U}_{m}(\eta_{m}(t))-Y_{m}(t)\cdot\eta_{m}( t)\right]\\ -(1/B_{F}^{2})\cdot\sum_{m=M}\tau_{m}(t)\cdot\{Y_{m}(t)-q_{n}\tau_{n}(t)\cdot Q _{n}(t)\cdot 1_{[m=q_{m}]}\}\\ -(1/B_{F}^{2})\cdot\sum_{m=M}\sum_{i=M}\mu_{i}(t)[q_{n}\tau_{n}(t)\cdot Q _{n}(t)-q_{i}\tau_{i}(t)\cdot Q_{i}(t)]\\ -\sum_{m=M}(e_{n}\,/\,(\theta_{n}^{E})^{2})\cdot(E_{n}(t)-\theta_{n}^{E}) \cdot(\sum_{i<O(n)}p_{n}^{T}(t)\cdot t_{slot}+e^{max})\,\,.\end{array}  \tag{27}\]  
In (27), \(B^{{}^{\prime}}\) is a constant which can be evaluated as:  
\[B^{{}^{\prime}}=\frac{1}{2}(e_{mn}\,/\,(\theta_{n}^{E})^{2})\cdot(|N|\cdot p _{n,mn}^{T}\cdot t_{slot}+e^{max})^{2}+2(1/B_{F}^{2})\cdot(A_{mn}^{(n)})^{2} \,\,\,\,+\frac{1}{2}(q_{mn}\tau_{mn}\,/\,B_{F}^{2})\cdot(2\mu_{mn}+A_{mn}^{(n) })^{2} \tag{28}\]  
where \(|N|\) is the number of nodes in the network. \(e_{mn}\), \(\tau_{mn}\), and \(q_{mn}\) are the maximal values of \(e_{n}\), \(\tau_{n}(t)\), and \(q_{n}\). According to (22), (23), and (24), the values of \(e_{mn}\), \(\tau_{mn}\) and \(q_{mn}\) are \(e\), \(1\), and \(e\). The main design principle of the algorithm CLADS (cross-layer algorithm for different services) is to minimize the right-hand side of (27). The algorithm includes four components:  
* **Source rate control:**For each session \(m\in M\) at source node \(s_{n}\), the admitted rate \(r_{n}(t)\) is chosen to solve:  
\[ \begin{array}{ll}\text{maximize}&r_{n}(t)\cdot\{Y_{m}(t)-q_{n}\tau_{n}(t) \cdot Q_{n}(t)\cdot 1_{\{n=t_{n}\}}\}\\ &\text{subject to}&0\leq r_{n}(t)\leq A_{m}(t)\,.\end{array}  \tag{29}\]  
Problem (29) is a linear optimization problem, and \(r_{n}(t)\) can be calculated as:  
\[r_{n}(t)=\left\{ \begin{array}{ll}A_{n}(t)&\text{if }Y_{n}(t)>q_{n}\tau_{n}(t) \cdot Q_{n}(t)\cdot 1_{\{n=t_{n}\}}\\ 0&\text{if }Y_{n}(t)\leq q_{n}\tau_{n}(t)\cdot Q_{n}(t)\cdot 1_{\{n=t_{n}\}} \end{array} \right.. \tag{30}\]  
\(\bullet\) **Virtual input rate control:**  
For each session \(m\in M\) at source node \(s_{m}\), the virtual input rate \(\eta_{n}(t)\) is chosen to solve:  
\[ \begin{array}{ll}\text{maximize}&V\cdot\text{U}_{m}(\eta_{n}(t))-Y_{m}(t) \cdot\eta_{m}(t)\\ &\text{subject to}&0\leq\eta_{m}(t)\leq A_{max}^{(m)}\,.\end{array}  \tag{31}\]  
Since \(U_{m}(. )\) is differentiable according to the definition in (16), considering the constraint of (31), \(\eta_{m}(t)\) can be calculated as:  
\[\eta_{m}(t)=\max[\min\{U_{m}^{-1}(V\,/\,Y_{m}(t)),A_{max}^{(m)}],0\}\,. \tag{32}\]  
When session \(m\) is a non-real-time service, the utility function \(U_{m}(t)\) is defined as (18), and the following equality can be derived:  
\[U_{m}^{-1}(V\,/\,Y_{m}(t))=e^{V\,/\,Y_{m}(t)}-1\,. \tag{33}\]  
The utility function of a real-time service is defined as (17), and the following can be derived:  
\[U_{m}^{-1}(V\,/\,Y_{m}(t))=\left\{ \begin{array}{ll}b-1\,/\,a\cdot\log(Y_{m} (t)\,/\,V-1)&\text{if }Y_{m}(t)>V\\ B_{max}&\text{if }Y_{m}(t)\leq V\end{array} \right.. \tag{34}\]  
\(\bullet\) **Joint routing scheduling and power control:**  
At each node \(n\
eq d.\), the scheme is implemented to route the packets, allocate transmission opportunities to links, and decide the transmission powers. The joint optimization problem of routing, scheduling, and power control is as follows:  
\[ \begin{array}{ll}\text{maximize}&\Psi\\ &\text{subject to}&\eqref{eq:1},\eqref{eq:2},\eqref{eq:3}.\end{array}  \tag{35}\]  
where the expression of \(\Psi\) is as:  
\[\begin{array}{ll}\Psi=(1\,/\,B_{r}^{2})\cdot\sum_{s\
eq d.}\sum_{i\in O(t)} \mu_{n}(t)[q_{n}\tau_{n}(t)\cdot Q  
\[ \begin{split}\text{maximize}&\sum_{n\
eq d,\,i\in O(t)} \Psi_{{}_{1}}\\ \text{subject to}&\eqref{eq:1},\,\eqref{eq:2},\end{split}