# On Optimal Cooperative Sensing with Energy Detection in Cognitive Radio
## 3 Cooperative Sensing with Optimal Thresholds
### Convex Optimization  
Under the region of satisfying (9), now we can obtain the globally optimal solution by applying the standard convex optimization procedure. Let \(\mathbf{v}=(v_{1},\cdots,v_{N})\), and the Lagrangian function of (A1) is  
\[L(\mathbf{v},\lambda) = \sum_{i=1}^{N}\log\mathcal{Q}\left(a_{i}\left((\log\mathcal{Q})^{ -1}(v_{i})-\bar{\tau}_{i}\right)\right)+\lambda\bigg{(}\log\overline{P^{f}}- \sum_{i=1}^{N}v_{i}\bigg{)},\]  
where \(\lambda\) is the Lagrange multiplier. The KKT condition for this problem consists of four parts, which are a primal feasible, dual feasible, complementary slackness, and zero gradient:  
\[\sum_{i=1}^{N}v_{i}^{*}-\log\overline{P^{f}} \leq 0,\] \[\lambda^{*} \geq 0,\] \[\lambda^{*}\left(\sum_{i=1}^{N}v_{i}^{*}-\log\overline{P^{f}}\right) = 0,\] \[\frac{\mathcal{Q}^{\prime}\left(a_{i}\left((\log\mathcal{Q})^{- 1}(v_{i}^{*})-\bar{\tau}_{i}\right)\right)\mathcal{Q}\left((\log\mathcal{Q})^{ -1}(v_{i}^{*})\right)a_{i}}{\mathcal{Q}\left(a_{i}\left((\log\mathcal{Q})^{-1} (v_{i}^{*})-\bar{\tau}_{i}\right)\right)\mathcal{Q}^{\prime}\left((\log \mathcal{Q})^{-1}(v_{i}^{*})\right)}-\lambda^{*} = 0,\quad i=1,\cdots,N. \tag{10}\]  
Since there is one Lagrange multiplier \(\lambda\) and also \(v_{i}\) can be expressed by a function of \(\lambda\) according to (10), one can obtain the optimal \((\mathbf{v}^{*},\lambda^{*})\) by adjusting \(\lambda\) based on some iterative methods such as bisection method and [PERSON]'s method. The details of the convex optimization algorithm are shown in Algorithm 1 based on the bisection method. ```
0: Given \(N\), \(\tau\), \(B\), \(\overline{P^{f}}\), and \(\gamma_{i}\) for all \(i\). 1: Set initial \(\lambda_{\min}\) and \(\lambda_{\max}\). 2: Calculate \(a_{i}\) and \(\bar{\gamma}_{i}\) for all \(i\). 3:while\(|\lambda_{\min}-\lambda_{\max}|>\varepsilon\)do
4:\(\lambda=(\lambda_{\min}+\lambda_{\max})/2\). 5: Given \(\lambda\), solve (10) toPU and SUs, respectively. As aforementioned in Section 2.3, one may easily verify that our approach can be extended to the OR rule in a similar manner because of its symmetric mathematical structure as with the AND rule. [PERSON] et al. [PERSON] et al. (2016) proposed a local optimal solution using iterative-threshold method, which is effective when SNRs are different. When average received SNRs are same for all cooperative sensing nodes, their sensing thresholds should be same [PERSON] et al. (2016). However, when SNRs are same, the method in [PERSON] et al. (2016) cannot achieve the performance of the uniform threshold method because of its inherent limitation of iteration procedure. By contrast, our proposed algorithm can achieve a globally optimal solution whether SNRs are same or not. For the identical SNR case, we also verify that the uniform threshold method exactly matches our globally optimal solution. In Figure 6, ROC curves are presented for both a single node sensing and cooperative sensing with seven nodes, i.e., \(N=7\). Each cooperative sensing node experiences its own average received SNR \(\bar{\gamma}_{i}\), which is randomly selected in the interval \([-10,-16]\) dB. We also set the \(\bar{\gamma}_{i}\) of a single node sensing to be either \(-10\) or \(-16\) dB to represent the best and the worst case scenarios, respectively. As can be seen, although cooperative sensing with _equal threshold_ (\(\sim\)-) is obviously better than that of a single node sensing with \(\bar{\gamma}_{i}=-16\) dB (\(\cdot\square\)-), it is interesting to observe that cooperative sensing (\(\sim\)-) can be worse than single node sensing with \(\bar{\gamma}_{i}=-10\) dB (\(\sim\)-). Namely, cooperation does _not_ necessarily guarantee better sensing performance unless the detection thresholds are properly set. However, cooperative sensing with _optimal thresholds_ (\(\sim\)-) significantly improves the sensing performance.