{'fraction_non_alphanumeric': 0.03564710308502633, 'fraction_numerical': 0.01147479307750188, 'mean_word_length': 4.496381306865178, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Distributed Cooperative Spectrum Sensing in Mobile Ad Hoc Networks with Cognitive Radios

In cognitive radio mobile ad hoc networks (CR-MANETs), secondary users can cooperatively sense the spectrum to detect the presence of primary users. In this chapter, we propose a fully distributed and scalable cooperative spectrum sensing scheme based on recent advances in consensus algorithms. In the proposed scheme, the secondary users can maintain coordination based on only local information exchange without a centralized common receiver. We use the consensus of secondary users to make the final decision. The proposed scheme is essentially based on recent advances in consensus algorithms that have taken inspiration from complex natural phenomena including flocking of birds, schooling of fish, swarming of ants and honeybees. Unlike the existing cooperative spectrum sensing schemes, there is no need for a centralized receiver in the proposed schemes, which make them suitable in distributed CR-MANETs. Simulation results show that the proposed consensus schemes can have significant lower missing detection probabilities and false alarm probabilities in CR-MANETs. It is also demonstrated that the proposed scheme not only has proven sensitivity in detecting the primary user's presence, but also has robustness in choosing a desirable decision threshold.


Introduction of Spectrum Sensing in Cognitive Radio
The idea of cognitive radio is first presented officially in an article by Joseph Mitola and Gerald Q. Maguire, Jr. [13]. It is a novel approach in wireless communications that Mitola later describe in his PhD dissertation as: "The point in which wireless Personal Digital Assistants (PDAs) and the related networks are sufficiently computationally intelligent about radio resources and related computer-to-computer communications to detect user communications needs as a function of use context, and to provide radio resources and wireless services most appropriate to those needs." It is thought of as an ideal goal towards which a software-defined radio platform should evolve: a fully reconfigurable wireless black-box that automatically changes its communication variables in response to network and user demands.
The above citation originates from the following fact. On one hand, the growing number of wireless standards is occupying more and more naturally limited frequency bandwidth for exclusive use as licensed bands. However, large part of licensed bands are unused for what concerns a large amount of both time and space: even if a particular range of frequencies is reserved for a standard, at a particular time and at a particular location it could be found free. The Federal Communication Commission (FCC) estimates that the variation of use of licensed spectrum ranges from 15% to 85%, whereas according to Defence Advance Research Projects Agency (DARPA) only the 2% of the spectrum is in use in US at any given moment. It is then clear that the solution to these problems can be found dynamically looking at spectrum as a function of time and space.
With the high demand of bit transmission rate for 4G or IMT-advanced high-speed wireless applications, there are several approaches to increase the system capacity as stated in the following equation: Distributed Cooperative Spectrum Sensing in Mobile Ad Hoc Networks with Cognitive Radios 5 The first approach is using MIMO to increase n, so that capacity may have a gain proportionally. The second approach is trying to increase SNR. The third one is focusing on the bandwidth. Cognitive radio is among the third category, and thrives to fully utilize the frequency.

Functionalities of Cognitive Radios
The main functionalities of cognitive radios are [14]: • Spectrum Sensing (SS): detecting the unused spectrum and sharing it without harmful interference with other users, it is an important requirement of the cognitive Radio network to sense spectrum holes, detecting primary users is the most efficient way to detect spectrum holes. Spectrum sensing techniques can be classified into three categories: -Transmitter detection: cognitive radios must have the capability to determine if a signal from a primary transmitter is locally present in a certain spectrum, there are several approaches proposed: · Matched filter detection · Energy detection · Cyclostationary feature detection -Cooperative detection: refers to spectrum sensing methods where information from multiple cognitive radio users are incorporated for primary user detection.
• Spectrum Management (SMa): Capturing the best available spectrum to meet user communication requirements. Cognitive radios should decide on the best spectrum band to meet the quality of service requirements over all available spectrum bands, therefore spectrum management functions are required for cognitive radios, these management functions can be classified as: spectrum analysis and spectrum decision.
• Spectrum Mobility (SMo): is defined as the process when a cognitive radio user exchanges its frequency of operation. Cognitive radio networks target to use the spectrum in a dynamic manner by allowing the radio terminals to operate in the best available frequency band, maintaining seamless communication requirements during the transition to better spectrum.
• Spectrum Sharing (SSh): providing the fair spectrum scheduling method, which is one of the major challenges in open spectrum usage is the spectrum sharing. It can be regarded to be similar to generic media access control MAC problems in existing systems.

Individual and Cooperative Spectrum Sensing
Spectrum sensing can be conducted either non-cooperatively (individually), in which each secondary user conducts radio detection and makes decision by itself, or cooperatively, in which a group of secondary users perform spectrum sensing by collaboration. No matter in which way, the common topology of such a cognitive radio network can be depicted as in Fig. 1. Individual spectrum sensing is conducted by secondary users on its own, and each user has a local observation and a local decision accordingly. Thus, in Fig. 1, each secondary user performs the spectrum sensing locally and no communication is between one another, nor is the common receiver (fusion center). In such a condition, cognitive radio sensitivity can only be improved [6] by enhancing radio RF front-end sensitivity, exploiting digital signal processing gain for specific primary user signal, and network cooperation where users share their spectrum sensing measurements. However, if the sensing channels are facing deep fading or shadowing, then affected individuals will not be able to detect the presence of the primary user, which leads to missing detection failure.
In order to improve the performance of spectrum sensing, several authors have recently proposed cooperation among secondary users [2,4,5,15]. Cooperative spectrum sensing has been proposed to exploit Distributed Cooperative Spectrum Sensing in Mobile Ad Hoc Networks with Cognitive Radios 7 multi-user diversity in sensing process. It is usually performed in three successive stages: sensing, reporting and broadcasting. In the sensing stage, every cognitive user performs spectrum sensing individually. This can be shown as in Fig. 1, where secondary users try to collect the signal of interest through sensing channels. In the reporting stage, all the local sensing observations are reported to a common receiver via reporting channels (see Fig. 1) and the latter will make a final decision on the absence or the presence of the primary user.
Finally, the final decision is broadcasted via broadcast channels to all the secondary users concerned, which include not only the ones involved into the sensing stage, but also those that do not have sensing capabilities but want to participate into the spectrum sharing stage.
There are several advantages offered by cooperative spectrum sensing over the non-cooperative ones [5,11,16,19,24,[27][28][29]32]. If a secondary user is in the condition of deep shadowing and fading, it is very difficult for a secondary user to distinguish a white space from a deep shadowing effect. Therefore, a noncooperative spectrum sensing algorithm may not work well in this case, and a cooperative scheme can solve the problem by sharing the spectrum sensing information among secondary users. Moreover, because of the hidden terminal problem, it is very challenging for single cognitive radio sensitivity to outperform the primary user receiver by a large margin in order to detect the presence of primary users. For this reason, if secondary users spread out in the spatial distance, and any one of them detects the presence of primary users, then the whole group can gain benefit by collaboration.
Authors of [5] quantify the performance of spectrum sensing in fading environments and study the effect of cooperation. The simulation results in [5] indicate that significant performance enhancements can be achieved through cooperation. Authors of [16] study the possibility to forward the signal with higher SNR to the one on the boundary of decidability region of the primary user. The performance is evaluated under correlated shadowing and user compromise in [11]. When the exchange of observations from all secondary users to the common receiver is not applicable, authors of [19] show that it is still worth doing by cooperating a certain number of users with relatively higher SNR. Moreover, in [24], a linear-quadratic (LQ) fusion strategy is designed with the consideration of the correlation between the nodes. In order to further reduce the computational complexity, authors of [27] propose a heuristic approach so as to develop an optimal linear framework during cooperation. Sensing-throughput tradeoff is analyzed in [28] for both multiple mini-slots and multiple secondary users cooperative sensing.

Centralized Cooperative Spectrum Sensing
Although some research activities have been conducted in cooperative spectrum sensing, most of them use a common receiver (fusion center) to do data fusion for the final decision whether or not the primary user is present. However, a common receiver may not be available in some CR-MANETs. Moreover, as indicated in [11], gathering the entire received data at one place may be very difficult under practical communication constraints. In addition, authors of [4] study the reporting channels between the cognitive users and the common receiver. The results show that there are limitations for the performance of cooperation when the reporting channels to the common receiver are under deep fading. In summary, the use of a centralized fusion center in CR-MANETs may have the following problems (see Fig. 1): • Every secondary user needs to join/establish the connection with the common receiver, which requires a network protocol to implement.
• Some secondary users need a kind of relay routes to reach the common receiver if they are far away from the latter.
• Communication errors or packet drops can affect the performance of such a network if more users have worse reporting channels (e.g. Rayleigh Fading) to reach the common receiver.
• There should be a reliable wireless broadcast channel [20,22,61] for the common receiver to inform each of every user once there is a decision made.
• The current centralized network does not fit for the average calculation of all the estimated sensing energy levels, because it requires the common receiver to correctly receive all the local estimated sensing results.
Otherwise, the decision precision can not be guaranteed.

Mobile Ad Hoc Networks
In recent years, MANETs have become a popular subject because of their self-configuration and selforganization capabilities. Each device in a MANET is free to move independently in any direction, and will therefore change its links to other devices frequently.

Self-organization of MANETs
Due to the lack of centralized control, MANETs nodes cooperate with each other to achieve a common goal [30,33]. The major activities involved in self-organization are neighbor discovery, topology organization, and topology reorganization. Through periodically transmitting beacon packets, or promiscuous snooping on the channels, the activities of neighbors can be acquired. Each node in MANETs maintains the topology of the network by gathering the local or entire network information. MANETs need to update the topology information whenever the networks change such as participation of new node, failure of node and links, etc.
Therefore, self-organization is a continuous process that has to adapt to a variety of changes or failures.

Distributed Consensus-based Cooperative Spectrum Sensing Scheme
In this work, we will present a distributed consensus-based cooperative spectrum sensing scheme without using a common receiver. Our scheme is based on recent advances in consensus algorithms [12], or more precisely, bio-inspired mechanisms, which have become important approaches to handle complex communication networks [34][35][36]39]. An important motivational background of this area is initially related to the study of complex natural phenomena including flocking of birds, schooling of fish, swarming of ants and honeybees, among others (see the survey [37]). The investigation of such biological systems has generated fundamental insights into understanding the relation between group decision making at the higher level and the individual animals' communication at the lower level [31,[40][41][42][43][44]62], and in fact consensus seeking in animal colonies is vital for group survival [44]. Such collective animal behavior has motivated many effective yet simple control algorithms for the coordination of multi-agent systems in engineering. Recently, consensus problems have played a crucial role in spacial distributed control models [12,21,45], wireless sensor networks [46], and stochastic seeking with noise measurement [47]. Since these algorithms are usually constructed based on local communication of neighboring agents, they have low implementation complexity and good robustness, and the overall system may still function when local failure occurs.
The main highlights of this scheme are as follows.
• It is a fully distributed and scalable scheme. Unlike the existing schemes [29,32,60], there is no need for a common receiver to do the data fusion for the final decision. A secondary user only needs to set up neighborhood with those users having desired channel characteristics, such as Line of Sight ones, or even with probabilistic link failures. • Unlike most decision rules, such as OR-rule or 1-out-of-N, adopted in the existing schemes, we use the consensus of secondary users to make the final decision. Therefore, the proposed scheme can leverage the detection results among users in a severe wireless fading networks.
• The proposed spectrum sensing scheme uses a consensus algorithm to cope with two underlying network models, one with f ixed bidirectional graphs and one with random graphs.
Our consensus-based approach is different from those used in distributed/decentralized detection problems [8][9][10]50]. In a typical distributed detection problem [8,9,50], each sensor individually forms its own discrete messages based on its local measurement and then reports to a fusion center, and there is in general no direct communication among the sensors. In certain models [10], a sensor may indirectly obtain information about other sensors, but this is achieved by feedback from a common fusion center.

Secondary Users Network Modeling
This section is organized in the following order. First, a network topology in distributed consensus-based cooperative spectrum sensing is presented. Then, the local spectrum sensing model is discussed in details. At last, the network model and consensus notions are presented.

Network Topology in Distributed Consensus-based Cooperative Spectrum Sensing
As shown in Fig. 2, no common receiver is necessary compared with Fig. 1, and secondary users are communicating with each other via communication channels that are in good radio coverage of each of secondary users. Secondary users that are far away from each other do not have direct communication channels due to poor radio signal quality.
There are two stages in the proposed cognitive radio consensus schemes. In the first stage, secondary users use a spectrum sensing model to make measurements about primary users at the beginning of detection. This is done via sensing channels in Fig. 2. We denote the local measurement of user i as Y i . In the second stage, secondary users establish communication links with their own neighbors to locally exchange information among them, and then calculate the obtained data so as to make a local decision whether primary users are around. The above process in the second stage is done iteratively. At the initial time instant k = 0, each user i sets x i (0) = Y i as the initial value of the local state variable. Next, at time k = 0, 1, 2, · · ·, according to the Before we introduce the detailed algorithms used in our consensus scheme, the common spectrum sensing model used in the first stage and the network model used in the second stage are to be presented, followed by the formal definition of the spectrum sensing consensus scheme.

The Spectrum Sensing Model
In the first stage, secondary users make measurements about primary users at the beginning of each time slot. Three kinds of methods are widely used for spectrum sensing [6]: matched filter, energy detector and cyclostationary feature detector.

• Matched Filter
The optimal way for any signal detection is a matched filter [51], since it maximizes received signal-tonoise ratio. However, a matched filter effectively requires demodulation of a primary user signal. This means that cognitive radio has a priori knowledge of primary user signal at both PHY and MAC layers [23,25,26,30], e.g. modulation type and order, pulse shaping, packet format. Such information might be pre-stored in CR memory, but the cumbersome part is that for demodulation it has to achieve coherency with primary user signal by performing timing and carrier synchronization, even channel equalization. This is still possible since most primary users have pilots, preambles, synchronization words or spreading codes that can be used for coherent detection. For examples: TV signal has narrowband pilot for audio and video carriers; CDMA systems have dedicated spreading codes for pilot and synchronization channels; OFDM packets have preambles for packet acquisition. The main advantage of matched filter is that due to coherency it requires less time to achieve high processing gain [52]. However, a significant drawback of a matched filter is that a cognitive radio would need a dedicated receiver for every primary user class.

• Energy Detector
One approach to simplify matched filtering approach is to perform non-coherent detection through energy detection. This sub-optimal technique has been extensively used in radiometry. There are several drawbacks of energy detectors that might diminish their simplicity in implementation. First, a threshold used for primary user detection is highly susceptible to unknown or changing noise levels. Even if the threshold would be set adaptively, presence of any in-band interference would confuse the energy detector. Furthermore, in frequency selective fading it is not clear how to set the threshold with respect to channel notches.
Second, energy detector does not differentiate between modulated signals, noise and interference. Since, it cannot recognize the interference, it cannot benefit from adaptive signal processing for canceling the interferer. Furthermore, spectrum policy for using the band is constrained only to primary users, so a cognitive user should treat noise and other secondary users differently. Lastly, an energy detector does not work for spread spectrum signals: direct sequence and frequency hopping signals, for which more sophisticated signal processing algorithms need to be devised. In general, we could increase detector robustness by looking into a primary signal footprint such as modulation type, data rate, or other signal feature.

• Cyclostationary Feature Detection
Modulated signals are in general coupled with sine wave carriers, pulse trains, repeating spreading, hoping sequences, or cyclic prefixes which result in built-in periodicity. Even though the data is a stationary random process, these modulated signals are characterized as cyclostationary, since their statistics, mean and autocorrelation, exhibit periodicity. This periodicity is typically introduced intentionally in the signal format so that a receiver can exploit it for: parameter estimation such as carrier phase, pulse timing, or direction of arrival. This can then be used for detection of a random signal with a particular modulation type in a background of noise and other modulated signals.
In summary, Matched filter is optimal theoretically, but it needs the prior knowledge of the primary system, which means higher complexity and cost to develop adaptive sensing circuits for different primary wireless systems. Energy detection is suboptimal, but it is simple to implement and does not have too much requirement on the position of primary users. Cyclostationary feature detection can detect the signals with very low SNR, but it still requires some prior knowledge of the primary user [4].
In this chapter, we consider the modeling scenario where the prior knowledge of the primary user is unknown. For implementation simplicity, an energy detection spectrum sensing method [5] is used. Fig. 3 shows the block-diagram of an energy detector. The input band pass filter (BPF) selects the center frequency f s and the bandwidth of interest W . This filter is followed by a squaring device and subsequently an integrator over a period of T . The output Y of the integrator is the received energy at the secondary user and its distribution depends on whether the primary user signal is present or not. The goal of spectrum sensing is to decide between the following two hypotheses, where x(t) is the signal received by the secondary user, s(t) is the primary user's transmitted signal, n(t) is the additive white Gaussian noise (AWGN) and h is the amplitude gain of the channel. We also denote by γ the signal-to-noise ratio (SNR). The output of integrator in Fig. 3 is Y , which serves as the decision statistic.
Following the work of [53], Y has the following form, where χ 2 2TW and χ 2 2TW (2γ) denote random quantities with central and non-central chi-square distributions, respectively, each with 2TW degrees of freedom and a non-centrality parameter of 2γ for the latter distribution. For simplicity we assume that the time-bandwidth product, TW , is an integer number, which is denoted by m.
Under Rayleigh fading, the gain h is random, and the resulting SNR γ would have an exponential distribution, so in this case the distribution of the output energy depends on the average SNR (γ). When the primary user is absent, Y is still distributed according to χ 2 2TW . When the primary user is present, Y may be denoted 14 F. Richard Yu, Helen Tang, Minyi Huang, Peter Mason, and Zhiqiang Li as the sum of two independent random variables [54], [55]: where the distribution of Y χ is χ 2 2TW −2 and Y e has an exponential distribution with parameter 2(γ + 1). As a summary, after T seconds, each secondary user i detects the energy and gets the measurement Y i ∈ R + .

The Network Model and Consensus Notions
In the second stage, secondary users establish communication links with its neighbors to locally exchange information among them. In our scheme, the network formed by the secondary users can be described by a standard graph model. For simplicity, this can be represented by an undirected graph (to be simply called consisting of a set of nodes {i = 1, 2, · · · , n} and a set of edges E ⊂ N × N . Denote each edge as an unordered pair (i, j). Thus, if two secondary users are connected by an edge, it means they can mutually exchange information. A path in G G G consists of a sequence of nodes i 1 connected by a path. For convenience of exposition, we often refer node i as secondary user i. The two names, secondary user and node, will be used interchangeably. The secondary user j (resp., node j) is a neighbor of The number of elements in N i is denoted by |N i | and called the degree of node i.
Throughout this chapter, the analysis is for undirected graphs, because we only deal with good duplex wireless links by which two adjacent nodes can establish communication (being connected) with each other.
That is, the graph G G G is connected, and the information exchange between two neighboring nodes is bidirectional.
The Laplacian of the graph G G G is defined as L L L = (l i j ) n×n , where The matrix L L L defined by (5) is positive semi-definite. Further, if G G G is a connected undirected graph, then rank(G G G) = n − 1 (see, e.g., [37]).
Since the cooperative spectrum sensing problem is viewed as a consensus problem where the users locally exchange information regarding their individual detection outcomes before reaching an agreement, we give the formal mathematical definition of consensus as follows.
The underlying network turns out to consist of secondary users reaching a consensus via local communication with their neighbors on a graph G G G = (N , E ).
For the n secondary users distributed according to the graph model G G G, we assign them a set of state variables x i , i ∈ N . Each x i will be called a consensus variable, and in the cooperative spectrum sensing context, it is essentially used by node i for its estimate of the energy detection. By reaching consensus, we mean the individual states x i asymptotically converge to a common value x * , i.e., for each i ∈ N , where k is the discrete time, k = 0, 1, 2, · · · , and x i (k) is updated based on the previous states of node i and its neighbors.
The special cases with are called average-consensus, max-consensus, and min-consensus, respectively. It is worth mentioning that the existing spectrum sensing algorithm with the OR-rule can be viewed as a form of max-consensus. This chapter is intended to propose a cooperative spectrum sensing scheme in the framework of average-consensus.

Distributed Consensus-based Cooperative Spectrum Sensing in Fixed Graphs
In this chapter, let us assume the secondary users have established duplex wireless connections with their desired neighbors, and the connections remain working until the consensus is reached. This kind of topology is called as a fixed graph. Based on this assumption, we are going to propose the spectrum sensing consensus algorithm as follows.

The Consensus Algorithm
We denote for user i, its measurement Y i at time k = 0 by x i (0) = Y i ∈ R + . The state update of the consensus variable for each secondary user occurs at discrete time k = 0, 1, 2, · · · , which is associated with a given sampling period. From k = 0, 1, 2, · · · , the iterative form of the consensus algorithm can be stated as follows where The number ∆ is called the maximum degree of the network.
This algorithm can be written in the vector form: where P P P = I I I − εL L L. Notice that the upper bound in (8) for ε ensures that P P P is a stochastic matrix, and in fact one can further show that P P P is ergodic when G G G is connected 1 . Since G G G is an undirected graph, all row sums and column sums of L L L are equal to zero. Hence P P P is a doubly stochastic matrix (i.e.,P P P is a nonnegative matrix and all of its row sums and column sums are equal to one).
We also point out that (9) uses only a particular construction of the coefficient matrix for the consensus algorithm, which is based on the graph Laplacian L L L. As long as each node has the prior knowledge of an upper bound of the maximum degree ∆ of the network, the iteration may be implemented and there is no necessity for neighboring nodes to exchange information regarding the network structure. Also, it is possible to construct P P P in other forms. An alternative choice of P P P may be based on the so called Metropolis weights [46] by takingp where d i = |N i | is the degree of node i. If G G G is a connected graph and we define P P P = (p i j ) n×n , then P P P is an ergodic doubly stochastic matrix. When P P P is used in (9) in place of P P P, the state average will still be preserved as an invariant during the iterations and our convergence analysis below is still valid. Notice that when P P P is used in the consensus algorithm, it is only required that any two neighboring nodes report to each other their degrees, and the knowledge of the maximum degree of the network is no longer needed.
We cite a theorem concerning the convergence property of the consensus algorithm.
Theorem 1. (see, e.g., [37]) Consider a network of secondary users, with topology G G G applying the distributed consensus algorithm (7), where u i (k) = ε ∑ j∈N i (x j (k) − x i (k)), 0 < ε < 1/∆ , and ∆ is the maximum degree of the network. Let G G G be a connected undirected graph. Then

A consensus is asymptotically reached for all initial states;
2. P P P is doubly stochastic, and an average-consensus is asymptotically reached with the limit According to Theorem 1, if we choose ε such that 0 < ε < 1/∆ , then an average-consensus is ensured and the final common value x * = (1/n) ∑ n i=1 x i (0) will be the average of the initial vector x x x( ( (0 0 0) ) ), or equivalently, the average of Y Y Y T T T = {Y 1 ,Y 2 , · · · ,Y n }, which has been obtained during the energy detection stage.
Finally, by comparing the average consensus result x * with a pre-defined threshold λ based on Fig. 3, every secondary user i gets the final data fusion locally:

Performance of the Consensus Algorithm
It is quite apparent that the convergence rate is yet another interesting issue in evaluating the performance of the spectrum sensing consensus algorithm. This is due to the fact that secondary users must continuously detect the presence of primary users, and back up as soon as possible on recognizing such incident. From this point of view, the speed of reaching a consensus is the key in the design of the network topology as well as the analysis of the performance of a consensus algorithm for a given spectrum sensing network. For the connected undirected graph G G G, the above algorithm can ensure exponential convergence rate, where the error can be parameterized in the form O(e −δt ) with the exponent δ > 0. To have some bound estimate for the parameter δ , we first recall that P P P = I I I − εL L L. Since L is a positive semi-definite matrix, denote its n eigenvalues 18 F. Richard Yu, Helen Tang, Minyi Huang, Peter Mason, and Zhiqiang Li by 0 = λ 1 < λ 2 ≤ · · · ≤ λ n .
Here λ 2 > 0 since the undirected graph G is connected which ensures that the rank of L L L is equal to n − 1 ( [57]). The second smallest eigenvalue λ 2 of L L L is usually called the algebraic connectivity of the undirected graph G G G. Then the second largest absolute value of the eigenvalues of P P P is determined as α(ε) = max{|1 − ελ 2 |, |1 − ελ n |}, which can be verified to satisfy α(ε) < 1. By using standard results in nonnegative matrix theory (see, e.g., [58]), we can obtain an upper bound for δ . In fact, we can take δ as any value in the interval (0, − ln α(ε)). We also remark that similar convergence rate estimates can be carried out when general weight matrices in averaging are used.
Since P P P has a unit eigenvalue, we see that the difference between the first two largest absolute values of the eigenvalues of P P P is given as g(ε) = 1 − α(ε), which is customarily called the spectral gap of P P P. In general, the greater is g(ε), the greater is the upper bound − ln α(ε) for the exponent δ , and the faster is the convergence of the consensus algorithm. In practical implementations, it is desirable to choose a suitable value for ε to increase the spectral gap g(ε) while P P P is ensured to be ergodic. We will discuss the convergence rate in the simulation part of this chapter.

Distributed Consensus-based Cooperative Spectrum Sensing in Random Graphs
In the previous section, it has been assumed that any two neighboring nodes can reliably exchange data at all times. Hence the network topology remains unchanged during the overall time period of interest. This kind of network modeling may not be accurate in certain situations. For example, fading of wireless signals can cause packet errors, which will result in wireless link failures for that period. Furthermore, even under LOS channels, moving objects between neighboring nodes may temporarily affect signal reception. For the above reasons, in this chapter, we consider a more realistic inter-node communication model with random link failures. Unlike the previous model, which is based on fixed bidirectional graphs, the new model is based on random graphs. Nevertheless, similar to the previous fixed topology scenario, for the random graph based modeling below, we still consider bidirectional links when two nodes can communicate.

Random Graph Modeling of the Network Topology
Before characterizing random connectivity of the network of all secondary users, let us first introduce a fixed Concerning the statistical properties of link failures, we assume that for all links (each associated with an edge in the graph G G G) fail independently with the same probability p ∈ (0, 1). For notational simplicity we use the same parameter p to model the failure probability. The generalization of the modeling and analysis to link-dependent failure probabilities is straightforward.

The Algorithm with Random Graphs
For the random link failure-prone model, the two spectrum sensing stages introduced in the previous chapter are still applicable. In the first stage, each node performs the radio detection and computes the measurements according to (2). During the second stage, at time k each node exchanges states information with its neighbors and performs the corresponding computation to generate its state update x i (k + 1). Let ∆ be the maximum degree of the graph G G G, and take ε ∈ (0, 1/∆ ).
The state of user i ∈ N is updated by the rule where ε is a pre-determined constant step size. If N i (k) = / 0 (empty set), (13) reduces to x i (k + 1) = x i (k).
Proof. We can write the algorithm (13) in the vector form where L L L(k) is the Laplacian of the graph G G G(k). For a vector z z z = (z 1 , · · · , z n ) T , denote the Euclidean norm |z z z| = (∑ n i=1 z 2 i ) 1/2 . For any given sample point, we can show that M M M(k) = I I I − εL L L(k) is a symmetric aperiodic stochastic matrix so that it has all its eigenvalues within the interval (−1, 1] (see, e.g., [58]), and therefore M M M(k) determines a paracontracting map [46,59] On the other hand, it is straightforward to check that (1/n) ∑ n j=1 x j (k) remains as a constant since M M M(k) is a doubly stochastic matrix (i.e., nonnegative matric with all row sums and column sums equal to one). Now it follows that each x i (k) converges to (1/n) ∑ n j=1 x j (0) with probability one, as k → ∞. We continue to analyze mean square convergence. Since E|x x x(0)| 2 < ∞ and sup i∈N ,k≥0 |x i (k)| ≤ max i∈N |x i (0)| ≤ |x x x(0)|, by the probability one convergence of x i (k), it follows from dominated convergence results in probability theory that x i (k) also converges to (1/n) ∑ n j=1 x j (0) in mean square. Now, we proceed to give an estimation of the mean square convergence rate within the random network model. Denote Ave(x x x(0)) = (1/n) ∑ n j=1 x j (0). It is straightforward to show that

By the fact x x x T [B B B T (k)B B B(k)]x x x ≤ x x x T x x x , the equality (16) leads to
x (17) with probability one. On the other hand, by the link failure assumption, there exists a set A 1 ⊂ Ω such that P(A 1 ) > 0 and for each ω ∈ A 1 , the associated matrix value B B B(k) = I I I − εL L L. Without the loss of generality, we can assume A 1 has been chosen in such a manner that for any ω ∈ A 1 , (17) also holds.

x x T [B B B T (k)B B B(k)]x x x = x x x T x x x
By noticing the fact that for any z z z ∈ R n , we obtain from (17) that Hence, (19) implies that x x x is the eigenvector of I I I − εL L L associated with the eigenvalue 1, which further implies Finally, by elementary calculation we obtain the convergence rate estimate 2 In fact, we have the simplified expression:

Simulation Results and Discussions
In this section, we present and discuss the simulation results of the distributed consensus-based scheme.

Simulation Setup
In the simulations, we assume that all secondary users are experiencing i.i.d. Rayleigh fading without spatial correlation. Each secondary user uses an energy detector. We simulate the output Y of the energy detector directly in our simulations. When the primary user is absent, Y is a random quantity with chi-square distribution. When the primary user is present, Y may be denoted as the sum of two independent random variables [54], [55]. The parameters of Y depend on the average SNR in the Rayleigh fading (see (3) and (4)). The simulations are done in three test conditions. In the first condition, every user has the same average SNR(γ), which is 10dB. In the second condition, each user has different average SNR(γ) varying from 5dB to 9dB. In the third condition, each user has different average SNR(γ) varying from 5dB to 15dB. The relevant information of primary users, such as the position, the moving direction and the moving velocity, is unknown to the secondary users.
We compare the performance of the proposed scheme with that of an existing OR-rule cooperative sensing scheme [29,32,60], which is better than AND-rule and MAJORITY-rule in many cases of practical interest [32,60]. In the OR-rule cooperative sensing scheme, each secondary user makes local spectrum sensing decision, which is a binary variable -a "one" denotes the presence of a primary user, and a "zero" denotes its absence. Then, all of the local decisions are sent to a data collector to sum up all local decision values. If the sum is greater than or equal to one, a primary user is believed to be present.
In the first stage of spectrum sensing, after time synchronization, every secondary user performs energy detection with TW = 5 individually to get local measurement Y i at the selected center frequency f s and the bandwidth of interest W . To set up the initial energy vector X X X(0), we set x i (0) = Y i .
In the second stage, the existing method and the proposed consensus algorithm (7) are conducted based on fixed graph models, while the proposed consensus algorithm (13) is run based on random graph models.
For fixed graphs, the basic requirement is to set up duplex wireless channels. In the simulations, we consider a network topology with 10 secondary users that establish a graph, G G G = {N , E }, as shown in Fig. 0.4(a). For random graphs, we use the same set of nodes as in Fig. 0.4(b), but replace solid lines with dotted ones, which Distributed Cooperative Spectrum Sensing in Mobile Ad Hoc Networks with Cognitive Radios 23 have probabilities of link failure of 40% (refer to Fig. 0.4(b)). The links in those figures stand for bidirectional wireless links. With regard to link failure probabilities, they mean both directions will fail to work in case of link failure. We also consider a network topology with 50 nodes in the simulations, which is shown in Fig.   5. All of the 50 nodes are located randomly. The links in the 50-node network have probabilities of failure of 40%.

Convergence of the Consensus Algorithm
Figs. 0.6(a) and 0.6(b) show the estimated primary user energy in the network with a 10-node fixed graph.
We can observe that, although the initially sensed energy varies greatly due to their different wireless channel conditions for different secondary nodes, a consensus will be reached after several iterations. The step size ε has effects on the convergence rate of the consensus algorithm. According to (7) and (13) On the interval (0, 0.2), the spectral gap g(ε) may be shown to be which monotonically decreases on (0, 0.2). We note that for this specific network topology, when ε = 0.2, the resulting matrix P P P = I − εL L L is ergodic. On the interval (0, 0.2] the spectral gap is maximized at ε = 0.2. In below we select two values for ε, 0.1 and 0.19, in Fig. 0.6(a) and Fig. 0.6(b), respectively. We can see that the algorithm converges faster when ε = 0.19 than that when ε = 0.1, which is due to the fact that ε = 0.19 corresponds to a larger spectral gap g(0. 19).
After about 5 iterations in Fig. 0.6(b), the difference between the nodes is less than 1 dB, which indicates that a consensus is achieved. Fig. 7 shows the estimated primary user energy in the network with a random graph when ε = 0.19. Comparing Fig. 7 with Fig. 0.6(b), we can see that the algorithm converges more slowly  in the random graph case due to the random link failure in the CR network. In Fig. 7, after about 10 iterations, the difference between the nodes is less than 1 dB, which indicates that a consensus is achieved. Fig. 8 shows the convergence performance for the 50-node network. ε = 0.15 is used. We can observe that the algorithm converges more slowly in the 50-node network compared to the 10-node network due to a larger number of nodes. Nevertheless, after about 30 iterations, the difference between the nodes is less than 1 dB, which indicates that a consensus is achieved.
In the rest of the simulations, we conduct the simulations in three scenarios. In scenario one, under each of the three test conditions, the simulations are conducted by using one of the existing methods and the proposed scheme, respectively. The purpose of this scenario is to evaluate the performance of the proposed scheme in terms of P m (probability of missing detection) and P f (probability of false alarm). In scenario two, we focus on test condition one, and try to find the best detection sensitivity for different algorithms. In scenario three, we also work on test condition one, and set a fixed detection threshold λ as stated in (11) to simulate the real situation in practice.

Scenario One
We compare the performance of the proposed scheme with that of an existing OR-rule cooperative sensing scheme [29,32,60]. Before the comparison, let us discuss briefly the relationship between P m (probability of missing detection)= 1 -P d (probability of detection) and P f (probability of false alarm). The fundamental tradeoff between P m and P f has different implications in the context of spectrum sensing [5]. A high P m will  Step Estimated Energy Level of the Primary User node 1 node 2 node 3 node 4 node 5 node 6 node 7 node 8 node 9 node 10 result in the missing detection of primary users with high probability, which in turn increases the interference to primary users. On the other hand, a high P f will result in low spectrum utilization since false alarms increase the number of missed opportunities (white spaces). As expected, P f is independent of γ since under H 0 there is no primary signal.
Figs. 9 and 10 show P f vs. P m . We can see that the proposed algorithm has better performance than the existing OR-rule cooperative sensing scheme. The numbers beside the curves are the corresponding thresholds λ in dB. In Fig. 9, where each secondary user has the same average SNR 10dB, if the threshold λ is false alarm probability (P f ) (Each secondary user has the same average SNR, γ = 10dB).
in the range of 11.4 to 12dB, both P f and P m can simultaneously drop below the probability of 10 −2 for the proposed consensus algorithm in both fixed and random graphs. Also, the results are the same between the fixed and random models. In comparison, to reach the same goal, the existing OR-rule method must set λ to be around 14.8dB, which has far worse P m (10 −2 vs. 10 −3 ) with regard to the same P f level (10 −2 ).
In condition two, secondary users undergo different average SNR varying from 5dB to 9dB. In condition three, secondary users undergo different average SNR varying from 5dB to 15dB. The similar results are demonstrated in Figs. 10 and 11 for condition two and three, respectively.

Scenario Two
Next, we examine the performance of detection probabilities P d to find out the sensitivity in detecting the primary user's presence. Fig. 12 shows P d (detection probability = 1 − P m ) vs. average SNR (γ) of secondary users. Condition one is used in this scenario, and the simulation is performed when the average SNR varies from 5dB to 10dB for all the nodes. The decision threshold, λ , is chosen so as to keep P f = 10 −1 . Timebandwidth product, TW , is set to be 5, which is the same as before. From Fig. 12, we see that the proposed scheme can have a significant improvement in terms of the required average SNR for detection. In particular,  false alarm probability (P f ) (Each secondary user has different average SNR varying from 5dB to 9dB).   if the probability of detection is expected to be kept above 0.99 (or P m < 10 −2 ), the existing spectrum sensing scheme requiresγ = 7.8dB. This required average SNR is higher than those in the proposed consensus scheme, both of which are approximately 6.8dB.

Scenario Three
In reality, it is unlikely to adjust the threshold λ on demand with regard to the different average SNR. Rather, a fixed threshold that can work in anyγ is much more desirable. We can call it as threshold robustness.
Therefore, in this scenario, we use condition one and intend to set a pre-defined threshold λ by using (11) so as to achieve a certain goal. In fact, there are three options when we choose such a goal to keep missing detection probability (P m ) below a certain level, to keep false alarm probability P f around a certain level, or to keep both P m and P f as low as possible.
We first try to keep P m below 10 −2 when all the ten users undergo the same γ varying from 5dB to 10dB. Fig. 0.13(a) shows a fixed λ that lets P m below 10 −2 for the average SNR ranging from 5dB to 10dB. As the result, the worst P f decreases from 0.586 by using the existing method to 0.356 in both the random graph and the fixed graph by using the proposed scheme.
The second option is to let P f always around 10 −1 when all the ten users undergo γ varying from 5dB to 10dB. The result is shown in Fig. 0.13(b), where P f keeps around 10 −1 . The proposed consensus algorithm (a) Missing detection probability (P m ) and false alarm probability (P f ) vs. average SNR (γ) with fixed threshold λ to keep P m below 10 −2 , when all the ten users undergo same γ varying from 5dB to 10dB. Pm, Existing method in fixed graphs@λ=13.8dB Pm, Proposed fixed−graph−based consensus@λ=10.8dB Pm, Proposed random−digraph−based consensus@λ=10.8dB Pf, Existing method in fixed graphs@λ=13.8dB Pf, Proposed fixed−graph−based consensus@λ=10.8dB Pf, Proposed random−digraph−based consensus@λ=10.8dB (b) Missing detection probability (P m ) and false alarm probability (P f ) vs. average SNR (γ) with fixed threshold λ to keep P f below 10 −1 , when all the ten users undergo same γ varying from 5dB to 10dB. In the third option, keep both P m and P f as low as possible. When determining a threshold, we refer to Fig. 0.14(a), which shows the worst case when all the ten users suffers γ = 5dB. For the consensus scheme to have better missing detection performance, the threshold chosen in the proposed scheme should be lower than that in the OR-rule scheme. In Fig. 0.14(a), we can see that, with the same missing detection probability, the threshold is lower in the proposed scheme than that in the OR-rule scheme. On the other hand, with this lower threshold, a better false alarm probability can be achieved in the proposed scheme. The reason is that, when there is no primary user, the output of the energy detector, Y , of each secondary user is a random quantity with central chi-square distribution (please see Eq. (2)). Since Y varies greatly, it is easy for a secondary user to have a false alarm in the OR-rule scheme. By contrast, the consensus scheme does not use the raw data Y to make decisions. Instead, it uses the consensus among the secondary users to make decisions, thus it can remove some randomness in the raw data Y . Therefore, the consensus scheme can have a better false alarm probability than the OR-rule scheme with the same threshold. This can be shown in Fig. 0.14(a). From Fig. 0.14(a), we can also observe that both missing detection and false alarm probabilities are low when the threshold is round 11dB for the consensus scheme and when the threshold is around 13.6 dB for the OR-rule scheme. In Fig. 0.14(a), if we compare the performance of the consensus scheme with a threshold 11dB to that of the OR-rule scheme with a threshold 13.6 dB, we can see that both missing detection and false alarm probabilities are lower in the consensus scheme than those in the OR-rule scheme. We choose λ = 11dB for the proposed consensus algorithm, and λ = 13.6dB for the existing method to conduct our numerical studies. Fig. 0.14(b) illustrates the result of such a fixed λ . It is seen that both P m and P f have better performance for the proposed algorithm than those of the existing method. P m and P f drops to a relatively low level. This highlights the overall advantage in so-called threshold robustness for the proposed consensus algorithm. That is, for a given λ , the proposed consensus algorithm can output less P m and P f than those of the existing method. The algorithm works well in both fixed graphs and random ones. Another observation in scenario three is, when the average SNR rises, P m drops for a given threshold λ , but P f remains more or less at the same level. This means, for a fixed λ , P m is subject to the change of the average SNR. In contrast, P f is stable, because this parameter deals with the condition of H 0 , where only the collective noises exists.

Conclusion
In this chapter, we have presented a fully distributed and scalable scheme for spectrum sensing based on recent advances in consensus algorithms. Cooperative spectrum sensing is modeled as a multi-agent coordination problem. Secondary users can maintain coordination based on only local information exchange Distributed Cooperative Spectrum Sensing in Mobile Ad Hoc Networks with Cognitive Radios Pm, Existing method in fixed graphs Pm, Proposed fixed−graph−based consensus Pm, Proposed random−digraph−based consensus Pf, Existing method in fixed graphs Pf, Proposed fixed−graph−based consensus Pf, Proposed random−digraph−based consensus (a) Missing detection probability (P m ) and false alarm probability (P f ) vs. threshold λ in dB when same γ = 5dB for all users. (b) Missing detection probability (P m ) and false alarm probability (P f ) vs. average SNR (γ) with fixed threshold λ to keep both P m and P f below a certain level, when all the ten users undergo same γ varying from 5dB to 10dB. without a centralized receiver. Simulation results were presented to show the effectiveness of the proposed consensus-based scheme. It is shown that both missing detection probability and false alarm probability can be significantly reduced in the proposed scheme compared to those in the existing schemes.
Also, as the real network topologies undergo random changes and the primary user may randomly enter and leave the network, a protocol is necessary to quickly decide when the consensus is considered to be practical reached. If the secondary users cannot efficiently form a decision in finite steps, the energy measurements obtained at the beginning may become obsolete. To address this finite time detection issue, in implementations a certain toleration threshold may be used by the users. A secondary user may stop the iteration if it finds the difference between the states of each neighbor and itself has fallen below the threshold. The choice of threshold depends on empirical studies. Our simulation indicates that the threshold may be chosen to be around a fraction of 1 dB or close to 1 dB.
One limitation of the proposed scheme is that the choice of the step size ε depends on the maximum number of neighbors of a node in the network. In other words, each node needs to have the prior knowledge of an upper bound of the maximum degree of the network. To solve this problem, an alternative approach may be used, which is based on so called Metropolis weights [46]. This approach does not need the knowledge of the maximum degree of the network. Future work is in progress in this direction. In addition, we plan to study transport layer issues [63] and heterogeneous networks issues [?] in the proposed framework. Moreover, we also want to simplify the data format of detection statistics from each secondary user to save the wireless bandwidth. Finally addition, as energy detection does not work well for spread spectrum signals, other approaches will be studied to deal with such networks.