A Consensus-Based Protocol for Spectrum Sharing Fairness in Cognitive Radio Ad Hoc and Sensor Networks

Spectrum sharing fairness is an important topic in cognitive radio ad hoc networks (CRAHNs) and cognitive radio sensor networks (CRSNs). Consensus-based protocols can provide light-weight and efficient solutions for CRAHNs and CRSNs but the theoretical ground needs to be investigated for spectrum sharing fairness. In this paper, we investigate the convergence condition when applying a consensus-based protocol to spectrum sharing while ensuring spectrum sharing fairness. Based on the local observation and local control scheme using spectrum-related information, an individual cognitive node can effectively perform the spectrum sharing. Then we propose a consensus-based protocol for spectrum sharing. Supported with computer simulation results, we show the effectiveness of using the proposed consensus-based protocol to solve the spectrum sharing problems in CRAHNs and CRSNs.


Introduction
As a result of the development of cognitive radio (CR) technology, the concept of cognitive radio ad hoc networks (CRAHNs) has been proposed in 2009 [1]. A CRAHN is essentially an ad hoc network composed by CR nodes (or CRs) and primary users (PUs) applying the cognitive radio technology in CR transceivers. As such, the CRs in CRAHNs do not favor central coordination when performing spectrum sharing processes. Instead, CRs have to perform local observation most of the time. With the same concept, the cognitive radio sensor network (CRSN) [2] was coined out in 2009, where each sensor node in a CRSN can be considered as a CR with limited hardware and capability to obtain surrounding information.
As an important research topic in CRAHNs and CRSNs, spectrum sharing schemes have to perform spectrum allocation based on local observations, while ensuring fairness in these schemes. Without keeping fairness, the network may suffer from uneven spectrum allocation to the CRs, subject to the frequent link disconnections during data communications. As such, an important problem in spectrum sharing is how to ensure the fairness of spectrum allocation using local observation and local decision. successful data transmissions, spectrum resource needs to be properly shared. As such, with a spectrum sharing module, a CR is able to share spectrum resources among CRs [1]. As an example of a CRAHN shown in Figure 1(a), the CRs are colocated with PUs. PUs and CRs are able to move. In order to make CRs aware of the available spectrum bands, the spectrum sharing module in each CR is running so that changing spectrum resources in a region can be shared with CRs. Similarly, a CRSN needs the spectrum sharing module to ensure spectrum resources available to sensor nodes (SNs) as shown in Figure 1(b). Besides, if we consider a spectrum sharing scheme, we need to choose a spectrum sharing model. There are two competing models of spectrum sharing [3]: (1) sharing among equals and (2) sharing between licensed primary and secondary, where the former can be considered as the underlay technique and the latter can be considered as the overlay technique (i.e., a CR does not use the spectrum bands occupied by the PUs). We adopt the latter throughout the paper.

Spectrum Sharing Schemes Based on Local Control.
Because CRAHNs and CRSNs favor local observations, we assume that each CR performs a so-called local control scheme. A local control scheme allows a CR to use information from local observations in order to make spectrum sharing decisions. A local control scheme is expected to perform distributed operations for CRs in a control system model (which will be discussed later). Each CR in the CRAHN runs a local control scheme with sensing inputs and decision outputs for spectrum sharing. There are several schemes or algorithms related to local control schemes that have been proposed in the literature. A graph coloring-based scheme has been proposed in [4]. This scheme is essentially a global optimization algorithm, which is centralized in nature and is required to be recomputed whenever there is a change in the network. Compared to a centralized scheme, a distributed scheme is more suitable for a CRAHN and a CRSN due to its robustness in varying radio environments (e.g., topology and spectrum availability, etc.). A distributed spectrum allocation scheme, referred to as local bargaining, has been proposed in [5], where CRs can self-organize and form a local group to improve a system utility. Results in [5] show that the communication overhead using local bargaining can be significantly reduced compared to a greedy coloring algorithm. However, the local bargaining scheme relies on coordination, so frequent communication efforts to exchange coordination message are required. A device-centric spectrum access approach for the spectrum allocation problem is introduced in [6], where five different rules are applied to individual CRs. These rules are slightly inferior to local bargaining [5], but they have lower computational complexity and communication overhead.
Swarm intelligence algorithms have been proposed in the literature to solve spectrum sharing problems. In [7], a spectrum sharing problem is solved by an insect colonybased algorithm. In [8], an algorithm based on the schooling mechanism of fish is proposed to solve the spectrum sharing problem. However, both papers do not give a formal proof for the convergence condition, which is important when applying swarm intelligence algorithms to spectrum sharing issues.
Swarm intelligence algorithms belong to a more general class of protocols, called consensus protocols, which are inspired by observing the flocking or schooling phenomenon in nature. In fact, consensus protocols have been used for data fusion in sensor networks, robotic control, and multiagent systems (MASs). Li et al. [9] have applied the consensus protocol to spectrum sensing in order to control the fusion of sensing data.
The above references have given hints of how to use consensus protocols in CRNs, but they hardly address spectrum sharing fairness in CRAHNs and CRSNs. In this paper, we will formulate the convergence condition when applying a general consensus protocol, which is necessary to theoretically show the applicability of consensus protocols in spectrum sharing for CRAHNs and CRSNs. Moreover, we will discuss how to use the consensus protocol to address the spectrum sharing fairness.
International Journal of Distributed Sensor Networks 3

Applicability of a Local Control Scheme in CRAHNs,
CRSNs, and Sensor Networks for CRAHNs. We discuss how to apply a local control scheme in these types of networks due to the characteristics of the CRAHNs, CRSNs, and sensor networks for CRAHNs.
Compared to classical ad hoc networks, CRAHNs are able to deal with the problems caused by changing radio environment and to protect licensed user's transmissions. Compared to classical cognitive radio networks (CRNs), CRAHN inherits some important features from ad hoc networks, such as node mobility, hop-by-hop spectrum availability, and unidirectional links. Other features in CRAHNs include spectrum-dependent links, topology control, multichannel transmission, and spectrum mobility, implying more challenges than those in either classical CRNs or ad hoc networks. Due to the lack of central network entities in CRAHNs [10], each CR node necessitates that all spectrumrelated CR capabilities and distributed operations must be based mostly on local observations. In CRSNs, each cognitive sensor node has cognitive capability and the network is usually intensively deployed with colocated PUs. Therefore, this type of networks inherits the similar cognitive modules as those in CRAHNs. A CRSN can use similar local control schemes in the spectrum sharing module. A CRSN, which has limited coverage and power supply, can be considered as the extension of a CRAHN, so the local control schemes can be applied to CRSNs.
Moreover, a local control scheme is suitable for another network paradigm called sensor networks for CRAHNs, where sensor nodes are aided for cognitive actuation. With local observation and local knowledge, sensor nodes perform the collective behavior for spectrum sharing, monitoring, and decision. The enabling technology for this network, called sensor network-aided cognitive radio, is discussed in [11]. As the local control scheme on sensor nodes in this network is very similar to the CRs in a CRAHN, we will not give detailed discussion for this network in this paper.
Based on the aforementioned discussion, we see that CRAHN is a more general network prototype than the sensor network for CRAHNs or the CRSN, and a local control scheme for CRAHNs is applicable to CRSNs. Therefore, we will focus on how the local control scheme can be applied to CRAHNs.

Revisit of Spectrum Sharing in the Perspective of Local Control Schemes
3.1. Radio Environment. The radio environment in CRAHNs and CRSNs is subject to change from time to time, which is the major problem for the spectrum sharing function. Typically, a change of radio environment can be caused by (1) PU activities; (2) interference during communications; (3) spatial-temporal characteristics of radio signals.
In this paper, we only consider the first two factors.
As an example, Figure 2 shows that CRs are deployed in an area with a changing radio environment. Each CR senses  and observes the local radio environment. When CRs request the spectrum bands occupied by PUs, they need to invoke local control to share spectrum resources. A natural question one may raise is "how the local control for spectrum sharing can be performed by using local observation?" In order to answer the question, we introduce a block diagram to present a local control scheme, in which each CR will run for a spectrum sharing process. Figure 3, a local control scheme framework can be represented in a block diagram. In this block diagram, when a CR receives a sensing input from sensors (e.g., a spectrum sensor or a global positioning system device, etc.), together with feedback information, a CR will process the information and make a spectrum sharing decision. At the sensing input, due to the different sensing capabilities, a CR may have comprehensive, partial, or strictly limited sensing information. At the junction of sensing input and feedback, we can adopt arbitrary types of combinations, where we use the symbol "·" to represent any combination. In Figure 3, the feedback block is important for a decision-making process, which may contain a consensus feedback (i.e., feedback from consensus process of nodes in a CRAHN), a partial consensus feedback (i.e., feedback partially from consensus), or no feedback. In the spectrum sharing process block, a dynamic or a static process may be involved. A dynamic process occurs at an individual CR when the position or spectrum availability of PUs and CRs in CRAHNs changes. A static process occurs when the position or spectrum availability of PUs and CRs does not change. At the decision output, we can have different kinds of solutions, such as optimal solution, suboptimal solution, or intermediate solution. If an optimal solution, such as Pareto optimum, is not achievable, it is feasible to find a suboptimal solution. The intermediate solution may neither be optimal or suboptimal; however, this solution can achieve the optimal or suboptimal solution by iterations.

The Framework of Local Control Schemes. In
To give an example for the aforementioned framework, we can consider a local control scheme in each CR in a CRAHN where each CR only takes the local information as sensing inputs, such as the network-related information and spectrum information from neighbors. After running a process for spectrum sharing functions in the local control scheme, a CR will make a decision of what spectrum bands to use based on the available spectrum resources. We will show a more detailed example in Section 5.

Fairness in Spectrum Sharing
Definition 1 (fairness). The spectrum resource allocation is fair to each CR at time t if the available spectrum resources at time t are evenly distributed among CRs.
In this paper, we mainly consider the available spectrum bands as a spectrum resource requiring fairness. The fairness of spectrum sharing is important as (1) it can help ensure equal communication opportunity for each CR; (2) it best responds to the changing radio environment in terms of available spectrum bands.
In order to achieve fairness by local observation, each CR tries to achieve fairness by considering the number of available spectrum bands of surrounding neighbors. In order to achieve this goal, we propose to use a consensus feedback in the local control scheme, which can be mathematically formulated in the following.
Suppose the CRAHN or CRSN can be represented by a graph G = (V(t), E(t)), where V(t) is the set of vertices at time t and E(t) is the set of communication edges at time t. We can analyze the system performance using a local control scheme, executed by each CR node. In an ideal condition (without any time delay), the consensus feedback is defined asẋ where x i (t) indicates the number of spectrum bands available to a node i at time t, N i (t) is the set of neighbors of node i at time t, and a i j is the 0-1 element in adjacency matrix of the network G. Equation (1) shows that the spectrum allocation decision is made based on the feedback informationẋ i (t) calculated from neighbors' spectrum information x j (t) and x i (t).
With the aforementioned notations, in order to measure fairness, we use the following expression: where m is the fairness goal (e.g., m equals to the desired number of spectrum bands of a CR) and M is the total number of CR nodes.
From (1), the fairness can be ensured if we can make sure that the number of spectrum bands is evenly distributed among CRs. However, since the CRAHN performs hop-byhop communication, a one-hop time delay τ is inevitable when receiving the information of spectrum availability from immediate neighbors. Then, (1) can be transformed aṡ Note that (1) and (3) are inherited from the Vicsek model [12].
In fact, the challenge of using the consensus protocol is to make sure the domain of x i (t) is applicable to the domain of spectrum bands. Therefore, we must prove that the consensus feedback can be used in this spectrum sharing problem.
, ω j (t) ∈ R + , there exists a mapping γ : R + → K, with which this consensus feedback can ensure the fairness of spectrum sharing over the CRAHN.
Proof. The discrete consensus protocol can make sure to reach the average ω l = (1/n) ω i when ω i (t) ∈ R + . Therefore, when ω ∈ z + , z + ⊂ R + , the discrete-time consensus protocol holds. Now we have to prove that the consensus still holds in a mapping function γ, which is where |K | is the length of K, that is, the maximum number of spectrum bands available to a CR.
From the mapping function f (γ), we can see that x i (t) is essentially a periodic function with period |K |. To see stability of this transformed consensus protocol, first we take the Laplace transformation of (3) by assuming x(t) is not a periodic function, and thus we get Then, considering the n periods n|K| in (5), we can get the Laplace transform of Combining (5) and (6), we get the transfer function as a multiple-input multiple-output (MIMO) model where I n is the identity matrix and L is the graph Laplacian defined by  Now we have to prove the stable conditions of (7). From Gershgorin theorem, for the undirected graph, the graph Laplacian L is symmetric, and the eigenvalues of L can be ordered in a descending order as Since β m > β 1 = 0 and 1 − e −s|K | ∈ (0, 1) when s > 0, s + e −τij s λ m = 0. If we suppose the one-hop time delay is identical to all the CRs, that is, τ i j = τ, we get s + e −τs λ m = 0.
As there are some cases that not all the CRs have the same spectrum bands, that is, different groups of nodes have different degrees of fairness, while the degree of fairness needs to be defined to reflect the case.
Definition 3 (degree of fairness). We refer the value of consensus feedback as a degree of fairness for a node, which is defined as where X i j is the number of spectrum bands of the jth node in the ith group of nodes. We denote the degree of fairness for a node j in the ith group of nodes by DF j (i).
Definition 4 (fairness group). A set of CRs with the same degree of fairness is called a fairness group (FG), that is, group i and group j are in the same fairness group, if DF(i) = DF( j) = p, where p is a constant. The notation FG can be used to denote the number of fairness groups in CRAHNs. The concept of fairness group is useful when describing the heterogeneous nodes that require different spectrum bands. Moreover, the concept can be used to virtually divide a large-scale network into different groups with different degrees of fairness.
In order to show the stability shown in Proposition 2, we can see in Figure 4, by using Nyquist criterion, the two Nyquist plots on the top show the fairness solution for spectrum sharing is stable, as we can see that the point (−1, j0) is not encircled. However, the Nyquist plot at the bottom of Figure 4 shows the spectrum fairness solution for spectrum sharing is unstable. If the time delay of the links is beyond the maximum value, the system is unstable. In other words, if the hop-by-hop time delay in a CRAHN is over the maximum value, the fairness cannot be guaranteed.

System Model.
In this section, we will mainly perform computer simulations to show the convergence performance of the local control scheme without a consensus feedback and with a consensus feedback for spectrum sharing in CRAHNs. The general system model for computer simulations is based on Figures 2 and 3, where each CR performs a local control scheme in a CRAHN. CRs will use a common control channel to communicate with each other for the information of spectrum availability. Moreover, we will focus on the spectrum allocation performance and convergence performance of the local control scheme, while other analysis like throughput analysis is beyond the scope of this paper. In order to evaluate an open-loop local control scheme (i.e., the local control scheme without a consensus feedback), we use a grid topology in the CRAHN with the number of node, M, where each CR is denoted by the row number and column number in a grid network, that is, (i, j). We describe the proposed open-loop local control scheme for evaluation in the following. The sensing input is the spectrum bands chosen by the neighboring CRs. The initial spectrum bands are randomly allocated to each CR. The local information used here is the spectrum bands selected by a CR's immediate neighbors. The proposed process in this local control scheme is to randomly select the available bands of neighboring CRs, that is, the local information is the available spectrum bands chosen by eight immediate neighboring nodes (where in this case the average number of |N i | equals to 8). To make the local control scheme configurable, we set a control parameter λ in the process to represent the probability parameter with which a CR randomly selects a portion of spectrum bands from a neighbor. This parameter can be considered as the feedback information shown in Figure 3. Figure 5 shows the results of the abovementioned openloop local control scheme in different scenarios, where the spectrum utilization results can reflect the convergence performance of the scheme and the results are smoothed every 20 iterations. The spectrum utilization is defined as the ratio of already allocated spectrum bands to a CR and the total available spectrum bands to a CR. From Figure 5, we can see that, although the spectrum bands are randomly selected based on the neighbor's spectrum availability and the parameter λ, the spectrum utilization can show a certain pattern. By changing the value of λ from 1.0 to 1.2, a phase transition happens. When λ > 1.0, the spectrum utilizations are fluctuating among the available spectrum bands; however, when λ = 1.0, the spectrum utilization over the network is bifurcated into two groups-one is increasing and the other is declining. To show whether the phase transition is applicable to the case with more spectrum bands (i.e., |K | > 3), we plot the Figure 5(d), where the phase transition still happens when |K | = 8. We also found when |K | > 1 the results are similar. In fact, we found the phase transition is only dependent on the control parameter λ.
From this example, we can conclude that the overall performance in terms of spectrum utilization is to some extent controllable by using the limited local information. However, as the convergence cannot be achieved, this controllability may not be sufficient to some applications as more variables should be considered. Furthermore, we can see the possible structure of a local control scheme with local information, where the local control scheme described above is an openloop local control scheme without any feedback. Therefore, the local information may be helpful to spectrum sharing if we employ it in a closed-loop local control scheme with a feedback.
We will use the spectrum information to calculate the consensus feedback in the closed-loop local control scheme in the following simulations.

Protocol Design.
Before doing a further simulation using the consensus feedback, we propose a communication protocol based on the theory in Section 4. The protocol is expected to show the applicability of using a consensus feedback to solve the fairness problem for spectrum sharing fairness. The protocol is briefly described in Algorithm 1, where Step (1) aims to process the proposed consensus-based feedback from neighboring nodes, while Step (2) performs standard data communications in the RTS/CTS MAC protocol. For example, after a CR receives the handshaking frames with spectrum information from neighboring CRs, it will update its local cache with available spectrum band indexes and the fairness group it belongs to from the value p. Then, a CR can know the available spectrum bands from the neighbors' feedbacks and then inform the other CRs in the similar way.
In addition, in order to determine which spectrum bands the neighboring CRs are using, we assume that a CR node can acquire this information by overhearing the neighboring CRs' communications. A feasible and economic way of overhearing that information is by encapsulating a data field containing that information and piggybacking it in a frame sent by a neighboring CR. For example, the consensus feedback is derived from the spectrum information piggybacked in protocol-specific frames or packets, such as request-to-send (RTS) or clear-to-send (CTS) frames in an IEEE 802.11based MAC protocol. The slotted time characteristic in the 802.11-like MAC protocol can also meet the requirements of the proposed protocol. Therefore, the proposed protocol can be readily integrated in the IEEE 802.11-based CRAHN.
More importantly, the proposed consensus-based protocol will not result in extra communication efforts or cause delays affecting throughputs. Now we analyze the complexity of the proposed protocol. We denote by M the number of CRs and denote by d the average degree of a CR. The spectrum sensing takes s 1 time units; Step (1) and Step (2) take s 2 and s 3 time units, respectively.
Step (1) will repeat at maximum dM times, so the average time spent on each CR is dM(cs 2 +(1−c)s 3 )+s 1 , where c is a constant denoting the fraction of times that the protocol will go to Step (1). As CRs in different FGs can individually perform the protocol and in each group we have approximately M/FG nodes, the total number of times is therefore (M/FG)(dM(s 2 + s 3 ) + s 1 ). Therefore, we can obtain the time complexity as O((M/FG) 2 ), and we can see that more FGs result in less complexity. Now we analyze the power consumption of the proposed protocol based on RTS/CTS handshaking procedure. We take the typical value of the RTS frame length and CTS frame length as 20 bytes and 14 bytes, respectively, and we consider the power consumption model for 802.11 transmissions with 2 Mbps speed in [14]. The power consumption of sending an RTS frame and receiving a CTS, E A , is 1.9 × 20 + 454 + 0.5×14+356 = 855 μW; similarly, the power consumption of receiving an RTS and sending a CTS frame, E B , is 846.6 μW; the power consumption of only receiving an RTS, E C , is 0.5 × 20 + 356 = 366 μW; the power of only receiving a CTS, E D , is 0.5 × 14 + 356 = 363 μW. With this profile, if we have one fairness group (FG = 1), considering the 4-way RTS and CTS handshaking procedure, the energy consumption of the protocol, E, has the form as where 2d · c is the total number of the surrounding CRs of the two CRs which involve in the RTS/CTS procedure, and c is the ratio parameter (≤1) because the two CRs may share some neighbors.

Computer Simulation Results.
In this section, we show the results based on the proposed consensus-based communication protocol, implemented using the simulator NetLogo 4.1 [15]. We will compare the proposed protocol with a classical CR scheme, called the device centric Rule-A [6], where a so-called property line measure, calculated from the available spectrum bands of neighboring CRs, is used for spectrum sharing. We choose Rule-A for comparison because it is the most similar scheme to our proposed protocol with basic local information (i.e., connectivity and spectrum availability of neighboring CRs) without extra communication efforts; other schemes like the local bargaining scheme or graph coloring scheme are centralized and require extra information through extra communication efforts. Moreover, the max-min fairness based schemes, which have a different spectrum sharing objective from the proposed Definition 1, will not be considered in this paper.
Suppose the number of spectrum bands at a CR at the beginning is randomly allocated. Each CR performs the proposed consensus-based protocol to ensure the number of spectrum bands is decided by the consensus feedback from its immediate neighbors. The consensus-based communication protocol will be executed once in an iteration; and therefore a successful run needs several iterations. Considering PU activities, the spectrum band availability varies at the beginning of each run. Moreover, we keep the total number of available spectrum bands in the network as 1900 for the following simulations.
Next, we describe the system model for this computer simulation. In Figure 6, a dense CRAHN with 350 CR nodes (i.e., M = 350) is shown and each link has a negligible data transmission delay. The darkness of the node color indicates the available spectrum bands on each CR. The darker the node color, the greater number of available spectrums on CR nodes.
We compare the convergence performance using the metric of unallocated spectrum bands after running the proposed consensus-based protocol and device centric Rule-A. The results are shown in Figures 7 and 8.
The convergence performance of Rule-A and the proposed consensus-based protocol is shown in Figure 7, where  we can see that the proposed consensus protocol converges very quickly, whereas Rule-A has stable convergence performance in one iteration. At the end of each iteration, all the CRs are allocated with spectrum bands. The reason that the consensus protocol is better is the consensus spectrum availability information is accurate during the spectrum sharing process, while the device centric Rule-A uses the poverty line as a feedback, which does not accurately estimate the spectrum availability of CR nodes.
In Figure 8, we can see how the consensus-based protocol converges over multiple iterations, where at the end of each iteration (i.e., each run of the protocol) all the nodes can be successfully assigned with desired spectrum bands. We use a randomly generated topology for the CRAHN in each iteration epoch, during which the consensus protocol will converge as expected, that is, it can make all the spectrum bands be shared among all the CRs. Moreover, the convergence time is quite stable even if we change the network topology before each iteration. In addition, the spectrum information mentioned in Step (1)  In order to see the fairness performance in different network sizes, we plot Figure 9, where the fairness measure is calculated by (2). From Figure 9, we can see that the fairness measure of Rule-A is larger than that of the proposed consensus-based protocol in all four network sizes. This is because the Rule-A cannot converge and thus the spectrum bands can hardly share among the CRs. As such, the proposed consensus protocol has better fairness performance than Rule-A. Furthermore, we can see how the spectrum sharing goal is achieved by these two algorithms, where we count the number of CRs with distributed spectrum bands in Figure 9. Figures 9(a)-9(d) show that the proposed consensus-based protocol can fairly distribute and meet the spectrum sharing goal better than Rule-A.
Next we discuss the fairness group in the spectrum sharing process. First, we show the intermediate results of using the consensus protocol for spectrum allocation. In Figure 10, different leading nodes in FGs are indicated with arrows, and, in the initial stage, only the leading nodes have been allocated with spectrum bands. From Figure 10(a), we can see the CRs running the consensus protocol can adjust the spectrum availability based on a leading node, which responds to the spectrum changes, and thus result in spectrum reallocation on neighboring CRs. The neighboring CRs will run the proposed consensus-based protocol to spontaneously change their spectrum bands. In other words, the leading node can share the spectrum bands to the rest of the CRs in this case. Similarly, in Figures 10(b) and 10(c), the leading nodes can share the spectrum bands with the other CRs. Therefore, we can see that the nodes following the spectrum information of the leading node belong to the same FG. Furthermore, if the leading nodes are considered as cluster heads reflecting the accurate changing radio environment, all the CRs in a cluster can instantly be informed of the spectrum change accordingly. If we consider the extreme case that the number of FGs equals one, we can actually convert this case to the one shown in Figure 6.
In order to see the convergence performance of the proposed consensus-based protocol versus different FGs, we compare the convergence performance in three networks with one FG, two FGs, and three FGs, respectively. The experimental results are shown in Figure 11, where all the nodes can be shared with spectrum bands at the end of each run. Moreover, we can see that the convergence time per iteration when FG = 1 is in general longer than the convergence time when FG = 2 or FG = 3. This makes sense because the more FGs in a network, the fewer nodes in each FG, and therefore the quicker decision can be made by a consensus protocol. This phenomenon can also be explained by the aforementioned complexity expression. If we experiment with a larger number of FGs, similar results can be obtained.
In addition, as we have evaluated the fairness performance when FG = 1 (as shown in Figure 9), here we evaluate the fairness performance when FG = 2 and FG = 3. In Figure 12(a), we evenly divide the network into two fairness groups with two separate spectrum sharing goals, where each group will run the proposed protocol in the same way as the network with only one fairness group. One group wants to get three spectrum bands (m = 3) and the other group wants to get six spectrum bands (m = 6). From the results shown in Figure 12(a), we can see that after running the two schemes, the proposed consensus-based protocol can fairly distribute the spectrum bands and meet the desired spectrum sharing goal. Similarly, in Figure 12(b), we evenly divide the network into three fairness groups and the spectrum sharing goals are m = 2, m = 4, and m = 6, respectively. From Figure 12(b), the proposed consensus-based protocol can meet the spectrum sharing goal while obtaining much better fairness performance than Rule-A. In conclusion, the proposed consensus-based protocol can meet the spectrum sharing goals in different FGs compared to Rule-A.

Conclusion
In this paper, we mainly explore the effectiveness of using a consensus-based protocol to solve the fairness problem in spectrum sharing. In order to analyze the convergence condition using a consensus protocol, we introduce the local control scheme as we can consider the consensus procedure as the consensus feedback in the system block diagram of the local control scheme. In this way, the convergence condition is identical to the system stability of the local control scheme. Furthermore, we have proven and shown the applicability of using a proposed consensus-based protocol for spectrum sharing problems in CRAHNs or CRSNs. We show the effectiveness of applying the proposed consensus-based protocol to a randomly deployed network, by which the desired convergence and fairness can be achieved. When we show the cases of applying the concept of FG in the spectrum sharing for CRAHNs or CRSNs, the CR nodes that lead to spectrum changes are subject to being affected by PU activities, which result in spectrum availability. In addition, although in a small-scale network, a centralized spectrum sharing scheme may be more efficient than the proposed consensus-based protocol, the proposed consensus-based protocol is economic, robust, and efficient for keeping spectrum sharing fairness in a large-scale network.
In the future work, we will elaborate a more sophisticated consensus-based protocol taking advantage of more kinds of spectrum information by local observations.