# An Integrated Cognitive Radio Network for Coastal Smart Cities
## 2 Integrated Cognitive Hybrid Communications for a Coastal City
### Belief Propagation-Based Channel Selection Algorithm  
As in our previous works [16; 17], we performed spectrum sensing in this integrated cognitive architecture to detect the presence of PU when vehicles are moving on roads and ships are moving either near the shore or in deep sea. The subsection describes in detail the way in which vehicles and ships find the idle spectrum by sensing the environment, and how they combine their individual sensing results with each other and with their corresponding LC. A sensing table is generated by each vehicle and ship when it stores the sensing results obtained by periodically sensing the spectrum. Belief propagation [18] is a message-exchanging algorithm that aggregates beliefs by exchanging individual messages iteratively. The algorithm first computes the local sensing results for each node in the network. This is done by spectrum sensing where each node (vehicle and ship) uses an energy detection scheme to detect the existence of the PU. PUs are incumbent users utilizing licensed bands, such as high-frequency and very high-frequency, and can be any automobile traveler or other consumers located in places such as houses, shops, or restaurants for the terrestrial environment [19] and things such as oil/gas platforms or large vessels for the marine environment [20]. The TV spectrum was considered as the cognitive radio spectrum in this paper. The TV band is divided into \(M\) channels,and the activity of PU is modeled as an exponential on/off activity pattern. The following binary hypothesis model defines how each vehicle and ship senses the spectrum:  
\[x_{i}(t)= \begin{cases}n_{i}(t),&H_{0}\\ s_{i}(t)+n_{i}(t),&H_{1}\end{cases}  \tag{4}\]  
where \(n_{i}(t)\) is additive white Gaussian noise, \(s_{i}(t)\) is the primary signal received by the vehicle/ship \(i\), and \(i=1,2,...,VS\), with \(VS\) as the total number of vehicles and ships in the integrated coastal city. Each vehicle and ship computes its local observation about the spectrum as an a posteriori probability, which is calculated as:  
\[\varphi_{i}^{f}(H_{h})=P(H_{h}|x_{i})=\frac{P(x_{i}|H_{h})P(H_{h})}{P(x_{i})} \tag{5}\]  
where \(f\) represents the channel index--that is, like how [21], \(f\in M\), \(P(x_{i}|H_{h})\) is the probability density function of the normally distributed random variable \(x_{i}\) conditioned on \(H_{h}\), \((h=0,1)\). \(P(x_{i})\) is a normalizing constant, and \(P(H_{h})\) is the a priori probability that is supposed to be constant for all vehicles and ships. To compute the belief about the condition of the vehicle/ship \(j\) estimated by vehicle/ship \(i\), vehicles/ships \(i\) and \(j\) within the transmission range of one another combine their messages in the following manner:  
\[\mu_{ij}^{f}(H_{j})=w\sum_{H_{i}}\psi_{ij}^{f}(H_{i},H_{j})\times\varphi_{i}^{ f}(H_{i})\prod_{k\in(N_{i}-\{f\})}\mu_{ki}^{f}(H_{i}) \tag{6}\]  
\(\mu_{ij}^{f}(H_{j})\) defines the belief about the vehicle/ship \(j\)'s current condition estimated by vehicle/ship \(i\); \(w\) is the weight factor, and the term \(k\in(N_{i}-j)\) explains that \(k\) only considers the neighbors of \(i\) and it does not belong to the neighbors of \(j\), and the compatibility function, \(\psi_{ij}^{f}(H_{i},H_{j})\), is calculated as:  
\[\psi_{ij}^{f}(H_{i},H_{j})= \begin{cases}\eta&\text{if }H_{i}=H_{j}\\ 1-\eta&\text{if }H_{i}\
eq H_{j}\end{cases}  \tag{7}\]  
Each vehicle and ship eventually computes the belief as:  
\[b_{i}^{f}(H_{i})=w\ \varphi_{i}^{f}(H_{i})\prod_{k\in(N_{i})}\mu_{ki}^{f}(H_{i}) \tag{8}\]  
Based on these beliefs, each moving node then makes a final decision about the current state of the channel, as follows:  
\[D_{i}^{f}= \begin{cases}H_{0}&\text{if }b_{i}^{f}(H_{0})>b_{i}^{f}(H_{1})\\ H_{1}&\text{if }b_{i}^{f}(H_{0})<b_{i}^{f}(H_{1})\end{cases}  \tag{9}\]  
Now, the term \(min(Ch_{1},Ch_{2},...,Ch_{M})\) in (3) describes how a querying node selects the channel with the highest belief from the set of all the idle channels between two communicating nodes.