1 Introduction

In recent years, cooperative cognitive radio network (CCRN) [6, 11, 18,19,20] has emerged as a novel communication paradigm that allows SUs to act as cooperative relays to assist PU transmissions in exchange for accessing the spectrum opportunities. Thus, a win–win situation can be achieved where the PUs can increase their transmission rates, whereas the SUs can gain the spectrum usage opportunities for transmitting their own traffic. In a CCRN, PUs can achieve larger transmission rates by selecting some preferred SUs as their relays. However, it is challenging for PUs to select appropriate SUs as relays, particularly in a multi-channel environment with multiple PUs and SUs. Also, the consideration of one channel and one PU in previous works [9, 10] presents a simplification for practical scenarios where there are typically multiple channels and multiple PUs that coexist in the coverage area of a base station in the cellular network.

In this paper, we investigate the cooperative spectrum sharing strategies between multiple PUs and multiple SUs in a multi-channel CCRN. We apply the stable matching theory [5, 13, 21, 26, 27] to determine the cooperative relays for PUs in a two-layered hierarchical spectrum sharing environment, such that stable and effective cooperation between PUs and SUs can be achieved and conflicting interests between them can be resolved.

Stable matching theory proposed by Gale–Shapley [27] has been applied recently to solve resource allocation problems in cloud and wireless networks [12, 16, 17, 22, 24]. The basic concept of stable matching theory is to introduce how the players form stable matched pairings with their preferences [2, 4, 5, 14, 23, 26]. The basic concept of stable matching theory is to introduce how the players form stable matched pairings with their preferences [3]. Although the matching theory was applied to wireless networks, it is simplified for practical wireless networks, in which many-to-many matching of nodes was considered. In addition, the stable matching results will be affected by externalities, which include peer effects and complementary [1].

Also, in the conventional matching market, only one-to-one matching is considered, in which the players do not have any incentives to change the matched results when they are matched. However, it is simplified for practical matching markets. In practice, the scenario of many-to-many matching should be considered. Besides, the stable matching results will also be affected due to the externalities, which include peer effects and complementary [15]. For instance, in the work of National Resident Matching Program (NRMP) [29], the problem of assigning houses to college students is considered. In the work, each house is assumed to have two quotas for accommodating students; thus, it is a many-to-one matching market. In such a market, the preferences of students will be easily affected by the peer effects caused by social relationships. This means that the students who are friends may want to live in the same house; thus, the formed stable matching results between houses and students may be changed. Therefore, the factors of peer effects in the matching market should be considered.

In this paper, we first propose a novel two-layered hierarchical spectrum sharing framework between multiple PUs and multiple SUs. In the first layer, a cooperative spectrum sharing model between PUs and SUs is proposed. At the same time, the matched pairings between them are determined by the proposed stable matching algorithms. In the second layer, the cooperation model among SUs is proposed, in which the SUs who use the subchannel leased from the same PU will form a cooperative group. In the group, one SU can select other SUs as its relays to achieve higher capacities. However, the problem of peer effects among SUs may exist due to their underlying social relations (or networks) [15, 25, 28], such that the stable matching results between PUs and SUs obtained from the first layer will be affected by peer effects. Thus, we then propose the swap matching algorithm to solve the peer effects problem. Finally, the benefits of the stable matching, and the swap matching approaches in comparison with the random matching and optimal allocation approaches are verified by simulation results. The main contributions of this paper are summarized as follows:

  1. 1.

    We propose a matching game-based framework to analyze the cooperation behavior between multiple PUs and multiple SUs in a multi-channel CCRN. The proposed spectrum sharing framework takes advantages of the concepts of the stable matching to determine the matched pairings between PUs and SUs, such that an appropriate spectrum allocation strategy is also determined.

  2. 2.

    We investigate the peer effects problem resulted from the social connections among SUs, via the proposed swap matching algorithms. The matched pairings are shown to be stable with the existence of two stability conditions, which are the one-sided exchange stability (1ES) and the two-sided exchange stability (2ES), respectively.

  3. 3.

    We apply the matching theory to devise the power control mechanism for determining the optimal relay strategy for SUs and for achieving the stable matchings between PUs and SUs. Also, we devise an algorithm of limited-divorce stable matching with constrained peer effects and power adjustment to solve the peer effects problem. With the proposed approach, the power of PUs and SUs can be saved, such that their average capacity of power increases.

  4. 4.

    We present numerical analyses to verify the benefits of stable matching and swap matching approaches for all PUs and SUs in the multi-channel CCRN.

The rest of this paper is organized as follows. Section 2 presents the system model and the utility functions of PUs and SUs. In Sect. 3, the stable matching and the swap matching algorithms are proposed. In Sect. 4, the power control approach is also proposed. Simulation results are given in Sect. 5. Finally, we conclude the paper in Sect. 6.

2 System model

2.1 System setup

We consider the uplink transmission of a single-cell FDMA-based cognitive radio network coexisted with a primary licensed network, comprising of \(N_p\) PUs, a primary receiver called the primary base station (PBS), \(N_s\) SUs, and a cognitive receiver called the secondary access point (SAP). Let the set of PUs and SUs be \(\mathcal{N}_p=\{1,\ldots ,N_p\}\) and \(\mathcal{N}_s=\{1,\ldots ,N_s\}\), respectively. Each PU attempts to grant spectrum access to a SU, as determined by the various matching algorithms, in exchange for the SU to cooperatively relay the PU’s data to the destination PBS. If the \(\mathrm{SU}_j\) cooperatively relays the \(\mathrm{PU}_i\)’s data, we define that \(\mathrm{PU}_i\) and \(\mathrm{SU}_j\) are matched, which is denoted by (\(\mathrm{PU}_i\), \(\mathrm{SU}_j\)), for \(1\le i\le N_p\) and \(1\le j\le N_s\). For simplicity, we make the following assumptions regarding the cooperative transmission model:

  1. 1.

    We assume that each PU has only one available subchannel which can be leased to the matched SUs, but the PU can select only one SU each time. Also, we assume that one subchannel can be leased to two SUs simultaneously.

  2. 2.

    We assume that each PU has available spectrum opportunities for SUs, which are denoted by \(q_\mathrm{pu}\).

  3. 3.

    The set of all PUs’ subchannels in the primary network is assumed to be \(\mathcal{S}_m=\{1,\ldots ,N_p\}\).

  4. 4.

    We assume that each SU experiences different channel conditions of all paths when they are using channels leased by different PUs.

  5. 5.

    Amplify-and-forward (AF) protocol is adopted at SUs for relaying PUs’ traffic, and equal power allocation is employed for all PUs and SUs. Additionally, we assume that flat Rayleigh-faded channel for each link that is invariant within each slot. At the PBS, the receiver employs maximal ratio combining (MRC) to combine signals from the direct link and the relay links. The channel state information (CSI) is assumed available at the PBS.

In this work, we propose a novel hierarchical spectrum sharing framework, in which there are two layers. In the first layer, each PU selects multiple SUs as relay nodes to transmit its own traffic, while the selected SUs gain opportunities for spectrum access. We assume that each PU will select the same number of SUs, which is denoted by \(\delta _q\), \(\delta _q = \{2,\ldots ,q_\mathrm{pu}\}\), to form the matched pairs. For instance, the formed matching pairings between two PUs and four SUs are exemplified as shown in Fig. 1. In the second layer, the cooperation model among SUs is proposed, as shown in Fig. 2. In this layer, SUs which use the same subchannel leased from one of the PUs form a cooperative group, where one SU can select other SUs as its relay nodes for achieving higher capacities. Also, the peer effects among SUs are considered, so that SUs will exchange their matched PUs for achieving higher capacities.

Fig. 1
figure 1

The matched pairings are formed between PUs and SUs

Fig. 2
figure 2

The SUs’ cooperation model

2.2 Utility functions of PUs and SUs

With the cooperation mechanism described in the previous section, we are now ready to define each players utility based on their respective achievable capacity. First, the achievable capacity of PU\(_i\) with the help of SU\(_j\) is given by the following formula:

$$\begin{aligned} \begin{aligned} C^{(m)}_{\mathrm{PU}_i, \mathrm{SU}_j}=&\log _2\left( 1 +\frac{\gamma _\mathrm{PU}|h^{(m)}_{\mathrm{PU}_i,\mathrm{PBS}}|^2}{d^\alpha _{\mathrm{PU}_i,\mathrm{PBS}}}+\frac{\frac{\gamma _\mathrm{PU}\gamma _\mathrm{SU}|h^{(m)}_{\mathrm{PU}_i, \mathrm{SU}_j}|^2|h^{(m)}_{\mathrm{SU}_j,\mathrm{PBS}}|^2}{d^\alpha _{\mathrm{PU}_i, \mathrm{SU}_j}d^\alpha _{\mathrm{SU}_j,\mathrm{PBS}}}}{\frac{\gamma _\mathrm{PU}|h^{(m)}_{\mathrm{PU}_i, \mathrm{SU}_j}|^2}{d^\alpha _{\mathrm{PU}_i, \mathrm{SU}_j}}+\frac{\gamma _\mathrm{SU}|h^{(m)}_{\mathrm{SU}_j,\mathrm{PBS}}|^2}{d^\alpha _{\mathrm{SU}_j,\mathrm{PBS}}}+1}\right) , \end{aligned} \end{aligned}$$
(1)

where \(\gamma _\mathrm{PU}=\frac{P_{\mathrm{PU}_i}}{\sigma ^2}\) and \(\gamma _\mathrm{SU}=\frac{P_{\mathrm{SU}_j}}{\sigma ^2}\), \(\sigma ^2\) is the noise variance, and \(\alpha \) is the path loss. \(P_{\mathrm{PU}_i}\) and \(P_{\mathrm{SU}_j}\) are the transmission power of PU\(_i\) and SU\(_j\), respectively. In particular, m represents the mth subchannel which is leased to SU\(_j\) by PU\(_i\). The notations of \(d_{\mathrm{PU}_i, \mathrm{SU}_j}\) and \(d_{\mathrm{SU}_j,\mathrm{PBS}}\) represent the distances from PU\(_i\) to SU\(_j\) and the ones from SU\(_j\) to the PBS, respectively.

Also, we use the following notations to denote the channel gain between different transmitter–receiver pairs: \(h^{(m)}_{\mathrm{PU}_i,\mathrm{PBS}}\) denotes the channel gain of the subchannel m from PU\(_i\) to the PBS; \(h^{(m)}_{\mathrm{PU}_i, \mathrm{SU}_j}\) denotes the channel gain of the subchannel m between PU\(_i\) and SU\(_j\); \(h^{(m)}_{\mathrm{SU}_j,\mathrm{PBS}}\) denotes the channel gain of the subchannel m from SU\(_j\) to the PBS.

Second, the capacity of the direct transmission from PU\(_i\) to the PBS is given by

$$\begin{aligned} C^{(\mathrm{direct})}_{\mathrm{PU}_i,\mathrm{PBS}}=\log _2\left( 1+\frac{\gamma _\mathrm{PU}|h^{(m)}_{\mathrm{PU}_i,\mathrm{PBS}}|^2}{d^\alpha _{\mathrm{PU}_i,\mathrm{PBS}}}\right) , \end{aligned}$$
(2)

where \(h^{(m)}_{\mathrm{PU}_i,\mathrm{PBS}}\) denotes the channel gain of the subchannel m from PU\(_i\) to the PBS. In addition, \(d_{\mathrm{PU}_i,\mathrm{PBS}}\) denotes the distances between PU\(_i\) and the PBS.

Next, let us look at the utility function of SUs. First, in the direct transmission, since the SUs who act as cognitive relays have opportunities to use the available subchannels for transmitting their traffic, the capacity of SU\(_j\) is given by

$$\begin{aligned} C^{(\mathrm{direct})}_{\mathrm{SU}_j,\mathrm{SAP}}=\log _2\left( 1+\frac{\gamma _\mathrm{SU}|h^{(m)}_{\mathrm{SU}_j,\mathrm{SAP}}|^2}{d^\alpha _{\mathrm{SU}_j,\mathrm{SAP}}}\right) , \end{aligned}$$
(3)

where \(h^{(m)}_{\mathrm{SU}_j,\mathrm{SAP}}\) and \(d_{\mathrm{SU}_j,\mathrm{SAP}}\) denote the channel gain of the subchannel m from SU\(_j\) to the SAP and the distances from \(\mathrm{SU}_j\) to the SAP, respectively.

Second, due to the proposed cooperation model among SUs, the SU will select other SUs using the same subchannel as relay nodes. Thus, the capacity of SU\(_j\) achieved from the SU\(_j\) to the PBS with the relay helped by SU\(_k\) is represented by

$$\begin{aligned} \begin{aligned} C^{(m)}_{\mathrm{SU}_j,k,\mathrm{SAP}}=&\log _2\left( 1 +\frac{\gamma _{\mathrm{SU}_j}|h^{(m)}_{\mathrm{SU}_j,\mathrm{SAP}}|^2}{d^\alpha _{\mathrm{SU}_j,\mathrm{SAP}}}+\frac{\frac{\gamma _{\mathrm{SU}_j}\gamma _{\mathrm{SU}_k}|h^{(m)}_{\mathrm{SU}_j,\mathrm{SU}_k}|^2|h^{(m)}_{SU_k,\mathrm{SAP}}|^2}{d^\alpha _{\mathrm{SU}_j,\mathrm{SU}_k}d^\alpha _{SU_k,\mathrm{SAP}}}}{\frac{\gamma _{\mathrm{SU}_j}|h^{(m)}_{\mathrm{SU}_j,\mathrm{SU}_k}|^2}{d^\alpha _{\mathrm{SU}_j,\mathrm{SU}_k}}+\frac{\gamma _\mathrm{SU}|h^{(m)}_{SU_k,\mathrm{SAP}}|^2}{d^\alpha _{SU_k,\mathrm{SAP}}}+1}\right) , \end{aligned} \end{aligned}$$
(4)

where \(\gamma _{\mathrm{SU}_j}=\frac{P_{\mathrm{SU}_j}}{\sigma ^2}\) and \(\gamma _{\mathrm{SU}_k}=\frac{P_{\mathrm{SU}_k}}{\sigma ^2}\), \(P_{\mathrm{SU}_j}\) and \(P_{\mathrm{SU}_k}\) denote the transmission power of \(\mathrm{SU}_j\) and \(\mathrm{SU}_k\), respectively. Also, \(h_{\mathrm{SU}_j,\mathrm{SU}_k}\) and \(h_{\mathrm{SU}_k,\mathrm{SAP}}\) are the channel gain between \(\mathrm{SU}_j\) and \(\mathrm{SU}_k\) and from \(\mathrm{SU}_k\) to the SAP, respectively. In addition, \(d_{\mathrm{SU}_j,\mathrm{SU}_k}\) and \(d_{\mathrm{SU}_k,\mathrm{SAP}}\) denote the distances between \(\mathrm{SU}_j\) and \(\mathrm{SU}_k\) and the ones from \(\mathrm{SU}_k\) to the SAP, respectively.

Finally, the PBS combines the signals of two SUs by employing the maximal ratio combining (MRC) to calculate the capacity achieved from SU\(_j\) to the PBS, which is given by

$$\begin{aligned} \begin{aligned} C^{(m)}_{\mathrm{SU}j,k,\mathrm{PBS}}&= \log _2\left( 1 +\frac{\gamma _\mathrm{PU}|h^{(m)}_{\mathrm{PU}_i,\mathrm{PBS}}|^2}{d^\alpha _{\mathrm{PU}_i,\mathrm{PBS}}}\right. \\&\quad \left. +\frac{\frac{\gamma _\mathrm{PU}\gamma _\mathrm{SU}|h^{(m)}_{\mathrm{PU}_i,\mathrm{SU}_j}|^2|h^{(m)}_{\mathrm{SU}_j,\mathrm{PBS}}|^2}{d^\alpha _{\mathrm{PU}_i,\mathrm{SU}_j}d^\alpha _{\mathrm{SU}_j,\mathrm{PBS}}}}{\frac{\gamma _\mathrm{PU}|h^{(m)}_{\mathrm{PU}_i,\mathrm{SU}_j}|^2}{d^\alpha _{\mathrm{PU}_i,\mathrm{SU}_j}}+\frac{\gamma _\mathrm{SU}|h^{(m)}_{\mathrm{SU}_j,\mathrm{PBS}}|^2}{d^\alpha _{\mathrm{SU}_j,\mathrm{PBS}}}+1}\right. \\&\quad \left. +\frac{\frac{\gamma _\mathrm{PU}\gamma _\mathrm{SU}|h^{(m)}_{\mathrm{PU}_i,\mathrm{SU}_k}|^2|h^{(m)}_{\mathrm{SU}_k,\mathrm{PBS}}|^2}{d^\alpha _{\mathrm{PU}_i,\mathrm{SU}_k}d^\alpha _{\mathrm{SU}_k,\mathrm{PBS}}}}{\frac{\gamma _\mathrm{PU}|h^{(m)}_{\mathrm{PU}_i,\mathrm{SU}_k}|^2}{d^\alpha _{\mathrm{PU}_i,\mathrm{SU}_k}}+\frac{\gamma _\mathrm{SU}|h^{(m)}_{\mathrm{SU}_k,\mathrm{PBS}}|^2}{d^\alpha _{\mathrm{SU}_k,\mathrm{PBS}}}+1}\right) . \end{aligned} \end{aligned}$$
(5)

Note that PUs and SUs are selfish entities interested in maximizing their own utility. They will have incentives to form the matched pairings only when this will increase their own individual utility. In the following section, we will adopt the stable matching theory to analyze the behavior of the proposed cooperative network.

3 Stable matching theoretic formulation

3.1 Preference lists of PUs and SUs

Each PU has a preference list of SUs which is constructed by the following criterion:

$$\begin{aligned} C^{(m)}_{\mathrm{PU}_i,\mathrm{SU}_j}>C^{(m)}_{\mathrm{PU}_i,\mathrm{SU}_k} \end{aligned}$$
(6)

In (6), if the PU\(_i\)’s achieved capacity with the SU\(_j\) as the relay node is greater than the one with the SU\(_k\), then the SU\(_j\) will be selected as one of the candidate matching partners in the preference list of PU\(_i\).

Similarly, each SU has a preference list of PUs which is formed mainly by the following criterion:

$$\begin{aligned} C^{(m)}_{\mathrm{SU}_j,\mathrm{SAP}}>C^{(n)}_{\mathrm{SU}_j,\mathrm{SAP}}, \end{aligned}$$
(7)

where the notation \(C^{(m)}_{\mathrm{SU}_j,\mathrm{SAP}}\) means that SU\(_j\)’s capacity is achieved by accessing PU m’s subchannel. If the achieved capacity by using the subchannel of PU m is greater than the one by using the subchannel of PU n, then the PU m will be selected as the candidate partner in SU\(_j\)’s preference list.

3.2 The proposed algorithms

Next, the stable matching algorithm and the swap matching algorithm will be proposed, which are introduced as follows:

3.2.1 The stable matching algorithm

The algorithm is proposed to determine the matched pairings between PUs and SUs, such that SU will relay its paired PUs data in exchange for spectrum access. The matching process is given by Algorithm 1. In Algorithm 1, we first assume that each PU has two quotas of subchannel which can be leased to SUs. Each PU will send an offer request to the SU that is first in its preference list. This SU will either (1) accept the offer if the PU is in the SUs preference list, in which case the PU and SU are matched, or (2) reject the offer if the PU is not in the SUs preference list. Note that if the SU is already matched, but the PU can provide a better capacity than the SUs current matching, then the SU will reject its current matching in favor of the new matching. The process details of the algorithm are as follows:

figure a

3.2.2 The swap matching algorithm

The stable matching pairings between PUs and SUs are formed in the first phase via the processes presented in Algorithm 1. Next, let us see the cooperation strategy among SUs in the second phase. In this phase, SUs use the same subchannel form a cooperative group, in which one SU selects other SUs as relay nodes for increasing capacity. However, due to the underlying social connections among SUs, some SUs may propose the swap requests using other subchannels from other SUs. For instance, SUs may be good friends, in which case they want to use the same subchannel. Thus, peer effects may occur during the SUs cooperation period.

If one SU proposes the swap request to another SU, the other SU will either (1) accept the swap request if its achieved capacity after swapping is larger than that of its current matching, or (2) reject the swap request if its achieved capacity after swapping is not larger than that of its current matching. We also discuss the one-sided and the two-sided swap matching approaches. In the one-sided swap matching, only the PUs capacity is considered. On the contrary, in the two-sided swap matching, both the capacities of PUs and SUs should be simultaneously considered when the SUs decide whether to swap or not. This means that if the achieved capacities after swapping for both PUs and SUs are larger than the ones of their respective current matching, then the SUs will swap. The algorithms of the one-sided swap matching and the two-sided swap matching are presented in Algorithms 2 and 3, respectively.

figure b
figure c

4 The power control approach

In this section, we employ the power control approach to improve power consumption. After peer effects, we add the power control which obtain better performance.

4.1 Utility functions for constructing the initial matching

First, we define the followings:

  1. 1.

    \(\gamma _{i,j}^{(\ell ),S}\) is the SNR between secondary station i and j when the primary station \(\ell \) leases the channel.

  2. 2.

    \(\gamma _{i,\mathrm{SAP}}^{(\ell ),S}\) is the SNR between secondary station i and the secondary access point when the primary station \(\ell \) leases the channel.

  3. 3.

    \(\gamma _{\varOmega ,\mathrm{PSA}}^{(\ell ),P}\) is the end-to-end SNR between primary station \(\ell \) and the primary access point when secondary stations in \(\varOmega \) cooperate.

  4. 4.

    \(\gamma _{i,\mathrm{PSA}}^{(\ell ),P}\) is the end-to-end SNR between primary station \(\ell \) and the primary access point when secondary stations in i cooperate.

Criterions for construction of the preference list of primary station i: Secondary station \(\kappa \) is more preferable than secondary station \(\ell \) if

$$\begin{aligned} \gamma _{\kappa ,\mathrm{PSA}}^{(\ell ),P}>\gamma _{\ell ,\mathrm{PSA}}^{(\ell ),P}. \end{aligned}$$
(8)

Criterions for construction of the preference list of secondary station i: Primary station \(\kappa \) is more preferable than primary station \(\ell \) if

$$\begin{aligned} \gamma _{i,\mathrm{SAP}}^{(\kappa ),S}>\gamma _{i,\mathrm{SAP}}^{(\ell ),S}. \end{aligned}$$
(9)

These two preference lists can help derive the initial matching by using the Gale–Shapley algorithm.

4.2 Utility functions for swapping

The utility of secondary station i can be

$$\begin{aligned} U_{i}^{S}(\mu ) = \gamma _{i,\mathrm{SAP}}^{(\mu _s(i)),S} + \gamma _\mathrm{add}^{\mu _s(i)}(\mu _s^{2}(i)), \end{aligned}$$
(10)

where \(\mu \) is the current allocation, \(\mu _s(i)\) is the current leasing primary station of secondary station i under matching \(\mu \), and \(\gamma _\mathrm{add}^{\mu _s(i)}(\mu _s^{2}(i))\) is the additional SNR gain when secondary stations in \(\mu _s^{2}(i)\) help and the channel is leased by \(\mu _s(i)\).

The utility of primary station i can be

$$\begin{aligned} U_{i}^{P}(\mu ) = \gamma _{\mu _p(i),\mathrm{PSA}}^{(i),P}, \end{aligned}$$
(11)

where \(\mu _p(i)\) is the set of the leased secondary stations under matching \(\mu \).

4.3 Integrating power control into peer effects

Let \(P_i^{(1)}\) be the transmission power that the secondary station i uses to help primary station transmit signals and \(P_i^{(2)}\) be the total transmission power that the secondary station uses to transmit signals including its own when forming a cooperative transmission group with the other stationary station. The secondary station spend \(P_i^{(2)}/{\mathcal {K}}\) to transmit signals in each slot during the cooperation phase among the secondary users, where \({\mathcal {K}}=\mid {\mu _s^2(i)}\mid \). \(P_i^{(1)}+P_i^{(2)}=P_i\). In addition, let \(\delta _i\) be the power step of the secondary station i.

Let \(\varOmega _\ell ^p\) be the preference list of the \(\ell \)th primary station and \(\varOmega _i^s\) be the preference list of the ith secondary station. The preference list, \(\varOmega _\ell ^p(P_1^{(1)},P_2^{(1)},\ldots ,P_{N_s}^{(1)})\) is constructed according to

$$\begin{aligned} \gamma _{i,PSA}^{(\ell ),P}(P_i^{(1)}), \end{aligned}$$
(12)

which is the end-to-end SNR when the secondary station i transmits with power \(P_i^{(1)}\) for \(i=1,2,\ldots ,N_s\). The preference list of the secondary station i, \(\varOmega _i^s\) is constructed according to

$$\begin{aligned} \gamma _{i,\mathrm{SAP}}^{(\kappa ),S} \end{aligned}$$
(13)

Before we present the proposed algorithm, we first define the following variables.

  • Let \(P_i^{(1),\kappa }\) be the transmission power that the secondary station i uses to help primary station transmit signals at the \(\kappa \)th iteration.

  • Let \(\varUpsilon _\ell \) be the maximum number of times that the primary station \(\ell \) breaks the tie with a secondary station.

  • Let \(\upsilon _\ell \) be the number of times that the primary station \(\ell \) breaks the tie with a secondary station.

  • Let \(\varXi _\ell \) be the maximum number of the leased secondary station of the primary station \(\ell \).

  • Let \(\mu _p^{\kappa ,ST}(\ell )\) be the set of the leased secondary station of the primary station \(\ell \) at the \(\kappa \) iteration in the limited-divorce stable matching phase.

  • Let \(\mu _p^{\kappa ,SW}(\ell )\) be the set of the leased secondary station of the primary station \(\ell \) at the \(\kappa \) iteration in the constrained-peer-effects phase.

  • Let \(\zeta _i^{\max }\) be the maximum number of times that the secondary station i is willing to raise its transmission power to forward the signal for the primary station.

  • Let \(\zeta _i^{\kappa }\) be the number of times that the secondary station i has raised its transmission power to forward the signal for the primary station up to the \(\kappa \)th iteration.

  • Let \(\varTheta \) be the set of the secondary stations who can propose to the primary station.

In Algorithm 4, we propose limited-divorce stable matching with constrained peer effects and power adjustment. We first initialize the transmission power the secondary station uses to help the primary station transmit signals and then perform Algorithm 5. In Algorithm 5, each secondary station proposes the first primary station in its preference list. The primary station accepts the best secondary station in its preference list. The primary station accepts the secondary station proposal if the primary station quota has not been met and the secondary station is in the secondary stations preference list. If the primary station quota has been met and the break times have not been met, the primary station will accept the best secondary station proposal in its preference and remove the worst secondary station in its current matches. The primary station sends the closure message to all secondary stations to indicate the end of its matching process if the primary station quota and the break times are met. In Algorithm 6, we switch two secondary stations with the goal to maintain the utilities of affected primary stations while achieving minimal transmission power. After peer effect, we perform power control. If a primary station accepting the secondary station is not in the first preferred primary stations of the secondary station, the secondary station raises its power.

figure d
figure e
figure f

5 Simulation results

In this section, simulation results are presented to illustrate the cooperative actions among PUs and SUs and their individual benefits gained from cooperation in this considered network. We simulate one scenario, in which each PU has two quotas which can be offered to SUs when forming the matched pairings. This means that one PU can be matched with two SUs sequentially.

  • Scenario 1: Each PU has two quotas which can be offered to SUs when forming the matched pairings. This means that one PU can be matched with two SUs sequentially.

  • Scenario 2: Each PU has three quotas which can be offered to SUs when forming the matched pairings.

We assume that the number of subchannel of each PU for lease is assumed to be one for simplifying the protocol design. The PBS and the PUs are assumed to be located on a squared network of length four, and the SAP and the SUs are assumed to be located in an internal squared network of length two which is located within the square network of length four. Furthermore, the PBS and the SAP are assumed to be located on side of the center of the network. In addition, the distance between each SU and the SAP is assumed to be the same and its value is set to be one. The channel gains of link pairs among PUs, SUs, the PBS, and the SAP are independently generated from complex Gaussian distribution with zero mean and unit variance. With respect to each of the following performance analysis parameters, the execution number of times is over 50,000 averagely.

In our simulation, we assume that each PU has two and three quotas. The PBS and the PUs are located on a squared network of length four. The SAP and the SUs are located in an internal squared network of length two located within the square of length four. The PBS and the SAP are located on side of the center. All PUs are randomly located in a squared network of length four, and all SUs are randomly located on a squared network of length two, in which the distance between each SU and the SAP is the same and its value is one. We assume that all channels experience Rayleigh fading, distributed as \(CN (0,1)\) and the generation of all results based on averaging over 50,000 results of the algorithms.

5.1 Analysis of swap percentage

Figure 3 shows the comparison results of swap percentage with different numbers of PUs between the swap matching approach and the random matching approach, in which PUs and SUs transmit with \(SNR=10dB\) and \(SNR=25dB\), respectively. As can be seen clearly, the swap percentages increase when the number of PU increases. Also, we see that the swap percentages in the one-sided swap matching approach are larger than the ones in the two-sided approach. This results from that in the one-sided swap matching approach, only the capacity of PUs is considered, while in the two-sided swap matching approach, not only the capacity of PUs is considered, but the capacity of SUs is considered. Thus, the swap percentages in the one-sided swap matching approach are greater than the ones in the two-sided approach (Fig. 4).

Fig. 3
figure 3

The comparison results of swap percentages between the stable matching approach and the random matching approach. PU’s \(SNR=10\) dB and SU’s \(SNR=25\) dB

Fig. 4
figure 4

The comparison results of swap percentages between the stable matching approach and the random matching approach. PU’s \(SNR=10\) dB and SU’s \(SNR=10\) dB

5.2 The average time of program

Figure 5 illustrates the average time of program with different matching approaches. As can be seen, the average time of program increases significantly when the number of PU increases. When the number of PU equals to three, the average time of program in the swap matching and the random matching approaches are larger than the ones in other approaches. In addition, we find that the average time of program in the one-sided approach is less than the one in the two-sided approach due to that in the one-sided approach, only PU’s capacity is needed to be considered.

Fig. 5
figure 5

The average time of program with different matching approaches

5.3 Analysis of PU’s average capacity

Figure 6 illustrates the comparison results with respect to the PU’s average capacity by using different approaches. As can be seen clearly, when \(\gamma _\mathrm{PU} = 10\) dB and \(\gamma _\mathrm{SU} = 25\) dB, the PU’s average capacity achieved by the optimal allocation approach is larger than the one achieved by other approaches. This is because that this approach is performed by the exhausting search to solve the optimization problem. But, the time complexity of this approach is high. Thus, we propose to use the stable matching and the swap matching approaches to make the PU’s capacity achieve closer to the one of using the optimal allocation approach, but the time complexity of these approaches is relatively lower than the one in the optimal allocation.

Figure 6 also illustrates the PU’s average capacity by using the swap matching approach is larger than the ones by using the stable and the random matching approaches. Also, we find that the PU’s average capacity with the one-sided swap matching approach is larger than the one in the two-sided approach. This is because that in the one-sided swap matching approach, only the PU’s capacity is considered, without considering the SU’s one. In addition, as can be clearly seen, the PU’s capacity increases significantly with the stable matching and the swap matching as compared to the case of random matching. Therefore, our proposed approaches are more suitable for PUs in the cooperative cognitive radio networks.

Fig. 6
figure 6

The average capacity of PU when \(\gamma _\mathrm{PU} = 10\) dB and \(\gamma _\mathrm{SU} = 25\) dB

Figure 7 illustrates the PU’s average capacity when \(\gamma _\mathrm{PU} = 10\) dB and \(\gamma _\mathrm{SU} = 10\) dB. From this figure, we see that from the comparison results between Figs. 6 and 7, we realize that the PU’s average capacity increases when the value of \(\gamma _\mathrm{SU}\) increases. In addition, Fig. 7 also illustrates that with the increasing number of PU, the average capacity of PU increases.

Fig. 7
figure 7

The average capacity of PU when \(\gamma _\mathrm{PU} = 10\) dB and \(\gamma _\mathrm{SU} = 10\) dB

Next, let us look at the simulation results generated when the scenario 2 is considered. Figures 8 and 9 show the comparison results of the PU’s average capacity achieved by different approaches. As can be seen clearly, we find that the PU’s average capacity achieved by the one-sided swap matching approach is larger than the one achieved by the two-sided approach. The results are the same with the ones in the scenario 1. Therefore, we realize that whether the quotas of PU are two or three, the PU’s average capacity in the one-sided swap matching approach is larger than the one in the two-sided approach; meanwhile, the PU’s average capacity in the swap matching approach is larger than the one in the no swapping approach. In addition, we compare the simulation results of Figs. 6 and 8, and we find that the PU’s capacity achieved in the scenario 2 is larger than the one in the scenario 1. This is because that in the scenario 2, more SUs are matched with the PUs, such that more SUs can be served as the relay nodes for PUs. Thus, PU’s average capacity increases.

Figure 8 depicts the average capacity of PU when \(\gamma _\mathrm{PU}=10\) dB and \(\gamma _\mathrm{SU}=25\) dB. We compare the simulation results between Figs. 8 and 6 and we see that the average capacity of PU when the PU’s position is three is larger than the one when the PU’s position is two. In addition, we see that the PU’s capacity approaches the optimal average capacity in the one-sided approach.

Fig. 8
figure 8

The average capacity of PU when \(\gamma _\mathrm{PU} = 10\) dB and \(\gamma _\mathrm{SU} = 25\) dB

Figure 9 shows the average capacity of PU when \(\gamma _\mathrm{PU}=10\) dB and \(\gamma _\mathrm{SU}=10\) dB. From this figure, we see that the average capacity of PU increases in high transmitting SNR. Moreover, when the number of PU increases, the average capacity of PU also increases correspondingly.

Fig. 9
figure 9

The average capacity of PU when \(\gamma _\mathrm{PU} = 10\) dB and \(\gamma _\mathrm{SU} = 10\) dB

5.4 Analysis of SU’s average capacity

Figure 10 shows the comparison results of the average capacity of SU achieved by different approaches, which include the optimal allocation, random matching, stable matching, swap matching and random matching with swap. We see that the SU’s average capacity achieved by the swap matching approach is larger than the ones achieved by the stable and the random matching approaches. In addition, we observe that when the number of PU increases, the PU’s achieved average capacity is getting better, while the SU’s one is getting worse.

Note that the simulation results are generated when the scenario 1 is considered. As can be clearly seen, when \(\gamma _\mathrm{PU} = 10\) dB and \(\gamma _\mathrm{SU} = 25\) dB, the average capacity of SU with the swap matching approach is greater than the one with the stable matching approach. Also, we see that the average capacity of SU in the swap matching and in the random matching swap are larger than the ones in other approaches.

Fig. 10
figure 10

The average capacity of SU when PU’s position is two and \(\gamma _\mathrm{PU} = 10\) dB and \(\gamma _\mathrm{SU} = 25\) dB

From Fig. 11, we see that when \(\gamma _\mathrm{PU} = 10\) dB and \(\gamma _\mathrm{SU} = 10\) dB, the average capacity of SU in the swap matching and in the random matching swap are also larger than the ones in other approaches.

Fig. 11
figure 11

The average capacity of SU when PU’s position is two and \(\gamma _\mathrm{PU} = 10\) dB and \(\gamma _\mathrm{SU} = 10\) dB

In Fig. 12, the PU’s position is assumed to be three. We compare the average capacity of SU between Figs. 8 and 12, and we see that when \(\gamma _\mathrm{PU} = 10\) dB and \(\gamma _\mathrm{SU} = 25\) dB, the average capacity of SU when the PU’s position is three is larger than the one when the PU’s position is two. In addition, we see that the random matching is the worst. Two-sided swap matching is better than one-sided one. In Fig. 13, we also compare the average capacity of SU when \(\gamma _\mathrm{PU} = 10\) dB and \(\gamma _\mathrm{SU} = 10\) dB. The simulation results of Figs. 12 and 13 are compared, and then, we find that the average capacity of SU significantly increases with the increasing number of SUs.

Fig. 12
figure 12

The average capacity of SU when PU’s position is three and \(\gamma _\mathrm{PU} = 10\) dB and \(\gamma _\mathrm{SU} = 25\) dB

Fig. 13
figure 13

The average capacity of SU when PU’s position is three and \(\gamma _\mathrm{PU} = 10\) dB and \(\gamma _\mathrm{SU} = 10\) dB

5.5 The simulation results of power control analysis

In this subsection, we discussed the simulation results of power control. Figure 14 illustrates the average capacity of SU. In Fig. 14, we set the SNR of the primary station which is 10dB and the initializing SNR is also 10 dB of the secondary station. We compare the simulation results of performing the algorithms 4, 5, and 6 with the ones without power control. We see that the PU’s capacity with the power control is larger than the one without the power control. In Fig. 15, we see that the average power of SU increases with the increasing number of PU. This means that the power control is employed to save power and to obtain better capacity.

Fig. 14
figure 14

The comparison results with respect to the average capacity of PU of with the power control and without the power control

Fig. 15
figure 15

The average power of SU

6 Conclusion

In this paper, we proposed a stable matching with peer effects approach to studying the hierarchical spectrum sharing strategies between multiple PUs and multiple SUs in a multi-channel CCRN. The proposed spectrum sharing framework takes advantages of the concepts of the stable matching to determine the matched pairings between PUs and SUs, such that an appropriate spectrum allocation strategy is also determined. We also investigated the problem of peer effects resulted from the social connections among SUs, via the proposed swap matching algorithm. The analytical arguments were verified by simulation. First, in the analysis of swap percentage, we found that the swap percentages increased when the number of PU increased. Also, we realized that the swap percentages in the one-sided swap matching approach were larger than the ones in the two-sided approach. Second, in the analysis of PU’s average capacity, we found that the PU’s average capacity achieved by the optimal allocation approach was larger than the one achieved by other approaches. Finally, in the analysis of SU’s average capacity, the SU’s average capacity achieved by the swap matching approach was larger than the ones achieved by the stable and the random matching approaches. Thus, the benefits of the stable matching and the swap matching approaches were visually presented for all PUs and SUs in the multi-channel CCRN.