D2D Assisted Cellular Networks in Licensed and Unlicensed Spectrum: Matching-Iteration-Based Joint User Access and Resource Allocation

: Device-to-Device (D2D) communications, which enable direct communication between nearby user devices over the licensed spectrum, have been considered a key technique to improve spectral efﬁciency and system throughput in cellular networks (CNs). However, the limited spectrum resources cannot be sufﬁcient to support more cellular users (CUs) and D2D users to meet the growth of the trafﬁc data in future wireless networks. Therefore, Long-Term Evolution-Unlicensed (LTE-U) and D2D-Unlicensed (D2D-U) technologies have been proposed to further enhance system capacity by extending the CUs and D2D users on the unlicensed spectrum for communications. In this paper, we consider an LTE network where the CUs and D2D users are allowed to share the unlicensed spectrum with Wi-Fi users. To maximize the sum rate of all users while guaranteeing each user’s quality of service (QoS), we jointly consider user access and resource allocation. To tackle the formulated problem, we propose a matching-iteration-based joint user access and resource allocation algorithm. Simulation results show that the proposed algorithm can signiﬁcantly improve system throughput compared to the other benchmark algorithms.


Introduction
With the development of communication technologies and the growth of smart devices (such as smart phones, wearable devices and smart unmanned aerial vehicle, etc.), mobile traffic data has increased dramatically in the last decade [1]. However, the spectrum resources in traditional cellular networks (CNs) cannot satisfy these demands. Deviceto-Device (D2D) communications have been considered to be a promising technology to improve spectral efficiency and network capacity by allowing two proximal devices sharing the licensed spectrum with cellular users (CUs) to communicate directly bypassing the base station (BS) [2][3][4][5]. However, the spectrum resource in the licensed spectrum is limited and easily congested due to the spectrum reusing by many users, especially in hot spots with plenty of data links. To tackle this challenge, the deployment of 5 GHz unlicensed spectrum in CNs may be an excellent solution. Recently, many researchers have operated the CUs in the unlicensed spectrum to further improve network capacity and spectral efficiency, which is referred as Long-Term Evolution-unlicensed (LTE-U) [6]. As LTE-U technology achieves better network performance, D2D communications in unlicensed spectrum (D2D-U) technology [7] has attracted more and more attention for its great potential capacity in enhancing network capacity.
However, the unlicensed spectrum is primarily occupied by the Wi-Fi users and the users access to the spectrum in a distributed coordination function (DCF) based on Carrier Sense Multiple Access with Collision Avoidance(CSMA/CA) in which the nodes listen to the subchannel before the data transmission [8]. As opposed to the Wi-Fi users, LTE and D2D communications are both controlled by the BS, with no need for sensing before transmission [9]. The LTE users and D2D users sharing the same unlicensed band with the Wi-Fi users will bring about the huge performance degeneration of this system. Therefore, it is challenging to maintain a fair and harmonious coexistence [10,11]. A great number of access mechanism of unlicensed spectrum has been proposed in light of this situation, namely Listen-Before-Talk (LBT) which allows LTE users and D2D users operate similar to the cognitive radio (CR) technique [12], and duty-cycle method, also known as Carrier Sense Adaptive Transmission (CSAT) in which each user occupies different time slot for data transmission [13].
There have been numerous works studying the resource allocation in LTE-U network or D2D communications underlaying CN in unlicensed spectrum [14][15][16][17]. In these works, spectrum resources are not fully used, thereby resulting in the waste of communication resources. However, few works have investigated D2D communications underlaying CN over licensed and unlicensed spectrum due to the complicated interference. In contrast to the previous works, we propose a hybrid network where D2D users reuse the licensed channels with the existing CUs, and both CUs and D2D users can transmit in the unlicensed spectrum. There are two difficult problem to tackle. First, the joint user access and resource allocation over licensed and unlicensed spectrum is difficult to be studied. Secondly, the interference management should be investigated since the interference among all the users is complicated. The main contributions of this paper are summarized as follows: • We consider a cellular network with cellular users, D2D users and Wi-Fi users, where the CUs and D2D users can access to the licensed and unlicensed spectrum. • We formulate an optimization problem to maximize system rate by jointly optimizing user access and resource allocation. To tackle the formulated problem, we propose a matching-iteration-based joint user access and resource allocation algorithm to obtain the optimal solution. • The properties of the proposed algorithm including convergence, stability, optimality, complexity are analyzed. Simulation results show that the proposed algorithm can achieve a higher performance compared to the other benchmark algorithms in terms of improving system rate.
The rest of this paper is organized as follows. In Section 2, we introduce the related works. The system model is presented in Section 3. In Section 4, we formulate the joint user access and resource allocation problem, and then propose a matching-iterationbased algorithm in Section 5. In Section 6, we analyze the properties of the proposed algorithm including convergence, stability, optimality and complexity. Simulation results are provided in Section 7. Finally, we conclude the paper in Section 8.

Related Works
To improve spectral efficiency and network throughput, many recent studies have investigated resource allocation in D2D communications underlying cellular network. Based on a social-aware D2D system, Y. Zhao et al. in [18] proposed a joint optimization algorithm to allocate the communication resources to improve the system performance. The authors in [19] considered an LTE network where the D2D users reuse the downlink subchannel, and investigated the resource allocation to improve network throughput.
However, system performance improvement is limited due to the limited licensed spectrum resources. Therefore, there have been numerous works investigating D2D communications underlaying LTE-U networks to improve system throughput and spectrum efficiency. The main problem in LTE-U networks is how to make the users accessing the unlicensed spectrum coexist with the Wi-Fi users in an appropriate manner. Thus, several mechanisms of coexistence have been proposed in the previous works, i.e., LBT method [20,21] and duty-cycle method [13]. The LBT method uses carrier sensing and backoff rules which is similar to CSMA/CA [22]. Two schemes based on LBT named Frame-based-equipment (FBE) and Load-based-equipment (LBE) have been proposed in [23], where the Clear Channel Assessment (CCA) is executed in a uniform subframe in per period or before per data transmission. Some studies use the duty-cycle method where the LTE-U and Wi-Fi users are controlled by the BS, and the LTE-U users transmit data in on-time, but in off-time they vacate the spectrum for the Wi-Fi users to guarantee the orthogonality [24]. More studies on LTE-U technology based on these two mechanisms can be carried out. In [25], Rastegardoost et al. proposed an algorithm based on Q-Learning, which can maximize the use rate of the white spaces for the LTE-U user transmissions, while decreasing the latency of data transmissions for the Wi-Fi network by adjusting the LTE-U duty-cycle to Wi-Fi activity. Gao et al. in [16] proposed a matching-based algorithm to maximize the utility of all the CUs while guaranteeing the throughput requirements of the Wi-Fi users, and optimized the resource allocation of the licensed and the unlicensed spectrum.
Facilitated by the LTE-U technology, the subchannel allocation and mode selection in D2D-U networks are investigated in recent years. A joint mode selection and resource allocation algorithm for D2D-U network has been proposed in [26] to maximize the total throughput of all the CUs and Wi-Fi users. Moreover, R. Liu et al. in [26] proved that the duty cycle can achieve better performance than the LBT method. However, one subchannel in licensed spectrum only can be reused at most by one D2D pair in [26], which caused a waste of spectrum resources. The authors in [27] adopted particle swarm optimization to solve a joint mode selection, subchannel allocation and power control optimization problem to improve the total throughput of CUs and D2D users in licensed spectrum. Few works on spectrum access and resource allocation of D2D underlaying both licensed and unlicensed since the interference among LTE/D2D, LTE-U/D2D-U, and Wi-Fi users is difficult to manage. In [28], a subchannel allocation problem of system in which D2D communications operate as an underlay in LTE network over licensed and unlicensed spectrum, they propose a user-subchannel swap matching algorithm. However, they do not consider the required minimum rate of the Wi-Fi users. In [29], the authors leveraged stochastic geometry in a unified network including LTE, D2D and Wi-Fi users in licensed and unlicensed spectrum to investigate resource allocation problem. They modeled the deployment of users as PPPs, and then proposed an SQP-based algorithm to obtain a sub-optimal solution. In [30], the authors investigated the content placement problem to maximize the cache hit ratio in D2D communications overlaying CNs. Simulation results show that interference can easily be solved in overlaying D2D communications of CN. In this paper, different form the aforementioned works, we mainly investigate joint user access and resource allocation in both licensed and unlicensed spectrum.

System Model
As shown in Figure 1, we consider an uplink cellular network with one BS, M CUs and N D2D pairs. The m-th CU is denoted by C m where m ∈ M = {1, 2, · · · , M}. The n-th D2D pairs is denoted by D n = (D t n , D r n ) where n ∈ N = {1, 2, · · · , N}, D t n represents the n-th D2D transmitter and D t n is the n-th D2D receiver. Furthermore, there exist L orthogonal subchannels denoted by L = {1, 2, . . . , L} in the system and the bandwidth of each subchannel is B l . The Wi-Fi network has W users operating on 5 GHz unlicensed band, and the set of the Wi-Fi users is denoted by W = {1, 2, · · · , W}. Moreover, there exist L u subchannels with bandwidth B u to support each Wi-Fi user to communicate with the access point (AP), and the set of the subchannels is denoted by U = {1, 2, . . . , U}.

Spectrum Sharing Schemes
In this paper, we assume that the CUs and the D2D users can transmit data in both licensed spectrum and unlicensed spectrum, and the BS will select the subchannel to support LTE, D2D, LTE-U and D2D-U users. The spectrum sharing of these users is based on the following spectrum access mechanisms.

A: Licensed spectrum
In the licensed spectrum, each D2D user is allowed to reuse one subchannel of the CUs such as prior works [18]. Furthermore, we mainly consider resource sharing on the uplink channel due to the interference can be easier to resolve on the uplink than that on the downlink. To avoid severe co-channel interference between the CUs and the D2D users, we assume that each subchannel can be occupied by at most M T D2D users. Moreover, we assume that the number of CUs is larger than the number of the licensed subchannels, and the number of D2D user does not exceed twice the number of subchannels, i.e., M > L, N > 2M [26]. Therefore, the system is heavy-loaded, i.e., there is no unused channels in the licensed spectrum. The CUs and D2D users which failed to match with channels in the licensed spectrum will access to the unlicensed spectrum by using duty-cycle method while ensuring the quality of service (QoS) of Wi-Fi system [7].

B: Unlicensed spectrum
The Wi-Fi system adopts CSMA/CA protocol to operate in the unlicensed spectrum, and the Wi-Fi AP first listens to the target channel before transmission. If the channel is sensed idle for an amount of time, a backoff procedure begins to avoid collision; otherwise, the Wi-Fi AP will keep monitoring the intended channel until the channel is unused. Moreover, the Wi-Fi system operates in the whole unlicensed spectrum, where the user is only allowed to access to the unlicensed spectrum in a period of time.
When LTE-U or D2D-U users access to the unlicensed spectrum, the Wi-Fi users will experience severe interference. To avoid the performance degradation of the Wi-Fi system and realize a fair and harmonious system, we assume that both D2D-U and LTE-U adopt duty-cycle mechanism as shown in Figure 2 [27]. The LTE-U or D2D-U users transmit data in the LTE-U/D2D-U on-time, and Wi-Fi users are allowed to transmit data in the LTE-U/D2D-U off-time to avoid collision. In this mode, LTE-U/D2D-U and Wi-Fi time division multiplexing channels are employed to achieve the purpose of fair channel occupation. The duty-cycle mechanism can be used in the areas where there is no listen-before-talk (LBT) requirement. The structure of the existing LTE BS is slightly changed, but to achieve better performance, Wi-Fi signal monitoring needs to be added to the BS. Moreover, we treat the CUs and D2D users as one type of the user on account of the CUs and D2D users have the same grade of service in unlicensed spectrum.

Sum Rate
In this section, we analyze the rate of the users including CUs, D2D users and Wi-Fi users over licensed and unlicensed spectrum.

Subchannel Allocation Matrix
We denote A (M+N)×(L+U) as the subchannel assignment matrix, i.e., where X M×(L+U) = [x l m ] represents the subchannel allocation matrix for the CUs in the licensed spectrum, and Y N×(L+U) = [y l n ] is subchannel allocation matrix for the D2D users in the licensed spectrum. The values of x l m and y l n can be respectively defined as and y l n = 1, the subchannel l is assigned to D2D user D n , 0, otherwise.
In addition, we also denote s u m ∈ {0, 1} and s u n ∈ {0, 1} as the subchannel assignment for CUs and D2D users in the unlicensed spectrum, respectively. Specifically, s u m = 1 represents that CU C m shares unlicensed spectrum u; otherwise, s u m = 0. In addition, it is the same for D2D users.

Data Rate in the Licensed Spectrum
In the licensed spectrum, each CU can one of the orthogonal subchannels to communicate. The D2D users will share the subchannel of the CU, which results in co-subchannel interference. As we mentioned above, all the licensed subchannels in the licensed spectrum of the system are used, and only two kinds of rates are required to calculate, i.e., the rate of the CUs on subchannel l and the rate of the D2D users reusing subchannel l.
The signal-to-interference-plus-noise-ratio (SINR) of CU C m over licensed spectrum l can be expressed as: where h l m,b = d −α m,b h 2 0,mb is the channel gain between CU C m and the BS on subchannel l, d m,b is the distance between the BS and CU C m , α is the path-loss exponent corresponding to the large-scale fading of the transmission channel [31], and h 0,mb is the Rayleigh fading channel coefficient, which obeys the standard normal distribution. p c is the transmit power of CU C m . h l n,b represent the channel gain between D2D transmitter D t n and the BS on subchannel l. p n is the transmit power of D2D transmitter n. σ 2 N represents the noise power density. The data rate of CU C m over licensed subchannel l is given by Correspondingly, the SINR of D2D receiver D r n over licensed subchannel l can be expressed as where h l n is the channel gains between D2D transmitter D t n and receiver D r n on licensed subchannel l, h l m,n represents the channel gains from CU C m to D2D receiver D r n on licensed subchannel l, and h l n represents the channel gains between D2D transmitter D t n and receiver D r n on licensed subchannel l. p n is the transmit power of D2D transmitter D t n . Thus, the rate of D2D user D n is given by:

Data Rate in the Unlicensed Spectrum
In the unlicensed spectrum, the service level of the Wi-Fi users is the highest and cannot be ignored. To guarantee the QoS of the Wi-Fi users, D2D-U and LTE-U technologies adopt duty-cycle mechanism. We use P tr to represent the probability that at least one user is in the transmitting state, i.e., where w is the number of the competing Wi-Fi users, τ is the probability of a user transmitting in a slot time. Denote P s as the successful probability that a transmission occurring on the subchannel, i.e., According to [32], the saturation rate of the whole Wi-Fi network can be expressed as where E[P] is average packet size, T σ is the duration of an empty slot time, T s is the average time that the subchannel is sensed busy on account of a successful transmission, and T c represents the average time that the subchannel is sensed busy by each station during a collision.
In this mode, the CUs, D2D users and Wi-Fi users transmit on different time slots on unlicensed subchannel, and the SINR of CU C m and D2D receiver D r n on unlicensed subchannel u can be expressed as: and γ u n = s u n p n h u respectively. Furthermore, let ρ c and ρ d represent the proportions of CU C m and D2D user D n in all time slots, respectively. Thus, we can calculate their data rates by and Moreover, the rate degradation of the Wi-Fi network caused by the CUs and the D2D users occupying the unlicensed spectrum can be expressed as And the rate of Wi-Fi user w is given by To guarantee the minimum transmission rate of the Wi-Fi users, we denote the minimum rate of Wi-Fi user w as R t w . Thereupon, there is a threshold U s for the number of the users which can access to the unlicensed spectrum, i.e., when the number of users accessing to the unlicensed spectrum reaches U s , the BS will reject access-request of the other users.

Problem Formulation
According to the above analysis, the sum rate of all users in the licensed spectrum and the unlicensed spectrum can be given by Our goal is to maximize the sum rate of all users by jointly optimizing user access and resource allocation. The optimization problem can be formulated as follows: where p max m and p max n denote the maximal transmit power of the CUs and the D2D users in licensed spectrum, respectively. R m min , R n min and R t w are the required minimal rate of the CUs and D2D users, Wi-Fi users, respectively. Constraint (18b) guarantees that the user access variables are binary. Constraints (18c) and (18d) ensure that the transmit power of the CUs and the D2D users in the licensed spectrum does not exceed the maximum value. Constraint (18e) indicates that the minimum throughput of the users on the licensed spectrum. Constraints (18f) and (18g) imply that each CU or D2D user only occupies one subchannel in the licensed or the unlicensed spectrum. Constraint (18h) ensures that one subchannel can be reused by at most q D2D users. Constraint (18i) guarantees the minimum rate of the Wi-Fi users. Constraints (18j) and (18k) represent the throughput requirements of the D2D user and the CUs in the unlicensed spectrum.

Matching-Iteration-Based Joint User Access and Resource Allocation Algorithm
The formulated problem (18) is a mixed-integer nonlinear programming (MINLP) problem, which is NP-hard. Thus, we design a matching-iteration-based joint user access and resource allocation algorithm to obtain a sub-optimal solution of the problem.

Matching-Based User Access and Resource Allocation Algorithm
Gale-Shapley (GS) algorithm was first proposed by David Gale and Lloyd Shapley to solve two types of problems, i.e., college admissions and marriage stability. The principle of GS algorithm is elaborated as follows. Members of either side have a preference list for the other members. Based on the preference lists, the active member in the one side will choose the best object to match while the chosen object can either accept the proposal or reject until it get the best proposal according to its preference list. These processes will continue until all members of the two sides reach a stable matching [31]. As thus, a stable matching will always exist in the GS algorithm.
According to the matching theory, we given some definitions as follows:

Definition 1.
A matching ϕ is a one-to-many correspondence from the set C ∪ D, if ϕ(c i ) = (d k , d l ) and ϕ(d k ) = (c i ), ϕ(d l ) = (c i ), which means the D2D users d k and d l reuse the channel with the CU c i .
, which means CU c i or D2D user d k is unpaired. The user can make a request to preferred user according to the preference list then form a matching.

Definition 2.
A matching ϕ will remain stable when there does not exist blocking pair.
Intuitively speaking, for matching pair ϕ(c i ) = (d k , d l ), there is CU c m or D2D user d n , in which c i prefers d n more than d k and d l , or d k prefers c m rather than its match c i , then ϕ(c i ) = (d k , d l ) is a blocking pair. If c i prefers d n or d k prefers c m , the matching ϕ is unstable due to the CU c i or D2D user d k would like to match with each other than to intermingle the matching.
To solve the proposed problem, we regard the CUs and the D2D users as the two sides to maximize their data rates. Preference lists in GS algorithm will determine the matching project among all members. In our method, preference list for each member is created by sorting the SINR value in descending order which derived from (4) and (6). Graphical expressions of the full-scale preference list establishment and a two-dimension matching derived from the matching-based user access and resource allocation algorithm are shown in Figure 3.   The matching-based algorithm is shown in Algorithm 1 which mainly includes the following steps: Step 1. The data set of the CUs and D2D users are used for input. The data set of the CUs including the transmit power and the distance between D2D users and the BS, and the data set of the D2D users consists of the transmit power, the distance between the D2D transmitter and the BS, the distance between the D2D receiver and the CUs and the distance between the transmitter and receiver of each D2D pair.
Step 2. Line 1 to 4: Calculate the SINR of each CU and each D2D user, and create the preference lists by sorting the SINR in descending order. The preference lists are the basis of the proposed iterative algorithm.
Step 3. Line 5 to 22: Each D2D user proposes to the most preferred CU. Some CUs may not get any proposal; some CUs may get a proposal from a D2D user; and the others may get several proposals from different D2D users. The CUs which do not get any proposals will maintain unpaired. The CUs which get a proposal from a D2D user will match with the D2D user. On the other hand, the CUs that get multiple proposals from multiple D2D users will be assigned to the most two D2D users with higher precedence in their preference lists.
The D2D users which are rejected by their most preferred CU will propose to their sub-preferred CUs. If a D2D user D i propose to the CU C k which has paired with a D2D user D j or unpaired, in this case, the CU C k will match with the new D2D user In addition, if a D2D user D i proposes to a CU C k who has paired with two D2D users, i.e., we assume ϕ(C k ) = {D j , D l } at a certain time and C k prefers D j compared with D l , if C k prefers D i to D j , the form D2D user D l will be moved, then the CU will match with D i as a new assignment, i.e., ϕ(C k ) = {D j , D i }. The matching pair is also obtained when C k prefers D i to D l but prefers D j to D i . The last one, if C k prefers D l to D i , the matching pair ϕ(C k ) = {D j , D l } will keep unchanged.
Step 4. Steps 1-3 are repeated until the round times exceeds the number of the D2D users and all the licensed subchannel are altogether reused by the D2D users. In the end, a stable matching ϕ will be output.

Iteration-Based User Access and Resource Allocation Algorithm
A stable matching between the CUs and the D2D users in the licensed spectrum has been derived by Algorithm 1. Then, the unpaired D2D users and CUs can access to the unlicensed spectrum for communications by using the duty-cycle method. However, many users occupying the unlicensed spectrum to communicate will cause huge interference to the Wi-Fi users. To guarantee the minimum data rate of the Wi-Fi users and avoid severe interference, the maximal value of time slots for D2D users and CUs, i.e., ρ max , can be obtained by: The iteration-based user access and resource allocation algorithm are summarized in Algorithm 2. According to the duty-cycle mechanism, we found that the QoS of Wi-Fi users in the simulated system model will not be guaranteed in the simulated system model, "20" represents the maximum number of cellular users and D2D users accessing the unlicensed spectrum, which can guarantee the QoS of Wi-Fi users and make LTE-U and D2D-U be good neighbors for Wi-Fi users. Moreover, "R new − R < 0.5 * eps" means that in the extreme problem, "R new − R becomes 0". We first swap the CUs in licensed spectrum and the CUs in unlicensed spectrum orderly, and then swap the D2D users in licensed spectrum and the D2D users in unlicensed spectrum sequentially. The data rate of all users is needed to recalculate after each exchange operation according to (17). If the system rate increases after the exchange operation, we will exchange the accessing modes for these two users. The above steps repeat until the increase of the sum rate is less than a setting value.

Properties Analyses
In this section, we analyze the properties of the proposed algorithm including convergence, stability, optimality and complexity.

Proposition 1. The proposed algorithm is guaranteed to converge after a limited number of iterations.
Proof. In Algorithm 2, the swap operation only occurs between the D2D users in the licensed and the unlicensed spectrum and the access modes of other users remain unchanged if R new > R. The matching result will be updated after each swap operation. Hence, the system rate increases strictly. On the other hand, due to the limited number of users which can access the unlicensed spectrum, the system rate has an upper bound. Moreover, the exchange operation is performed when R new > R. Thus, the proposed iterative algorithm is guaranteed to converge.

Stability
Proposition 2. The matching result ϕ obtained from the proposed algorithm is stable.
Proof. It is no doubt that we need to prove is that the system rate will decrease when the matching ϕ is disrupted. First, the exchange operation only performs when the system rate increases. Second, for each user in matching ϕ, it cannot find the other users to form a matching pair that increases the system rate due to the convergence of the proposed iterative algorithm. Each pair is the best choice for the optimization of the system rate. Thus, the final matching ϕ obtained from the proposed iterative algorithm is stable.

Algorithm 1 Matching-Based User Access and Resource Allocation Algorithm
Require: Set of LTE users C, set of D2D users D.

Ensure: A matching ϕ
Let n c be the number of CUs, n d be the number of D2D users, and let ϕ = ∅. initialize all c ∈ C and d ∈ D to free. 8: while ∃ d propose to c do 9: if c is free then 10: ϕ: = ϕ ∪ (c,d) 11: else if ∃ D2D pair d 1 such as (c,d 1 )∈ ϕ then 12: ϕ: = ϕ ∪ (c,d) 13: else if ∃ D2D pair d 1 such as (c,d 1 )∈ ϕ and D2D pair d 2 such as (c,d 2 )∈ ϕ,the D2D user prefer d 1 to d 2 then 14: if c prefers d to d 2 then 15: ϕ: = ϕ ∪ (c,d) 16: while ρ c /ρ d < ρ max do 5: Exchange CU or D2D users between licensed and unlicensed spectrum randomly. 6: calculate R new 7: if R new > R then 8: move the CU(D2D) in licensed to the unlicensed spectrum and the CU(D2D) in unlicensed spectrum are forced to access to the licensed spectrum. 9: if R new − R < 0.5 * eps then 10:

R=R new
11: temp = temp + 1 12: else if R new − R 0 then 13: continue. 14: end if 15: else if R new ≤ R then 16: len = len + 1 17: maintain preceding state. Proof. This proof is based on the Pareto improvement [33]. We assume ϕ(C m ) = {D n , D n }, if the improvement for CU C m in the licensed spectrum is {D n , D n }, i.e., {D n , D n } > C m ϕ(C m ), D2D pair D n accesses to the unlicensed spectrum. The swap iteration p occurs between D n and D n which can increase the sum rates of all users under matching pair ϕ(C m ) = {D n , D n } which is defined as H i ; however the Wi-Fi users do not permit this swap operation since the rate of the Wi-Fi users will decrease seriously, i.e., H d + H i < 0. It is obvious that the system rate will decrease after the swap iteration p. From the above analysis, we can conclude that the iteration-based joint user access and resource allocation algorithm can achieve the optimal system rate.

Complexity
All the procedures of the matching-iteration-based joint user access and resource allocation algorithm are summarized in Algorithms 1 and 2. The computational complexity of Algorithm 1 is O(M 3 ) based on GS matching algorithm. The computational complexity of Algorithm 2 is O(t + l). The results show the algorithm in this paper can get better performance with low computational cost.

Simulation Results
In this section, we evaluate the performance of our proposed interation-based joint user access and resource allocation algorithm by simulation results. In Table 1, we summarize the simulation parameters, which are set based on the prior works [27,28]. As shown in Figure 4, we consider a single cell network with one BS and multiple CUs, D2D users and Wi-Fi users. The CUs and the D2D users are distributed randomly in the circle area with radius of 250 m. In addition, the distance between the transmitter and the receiver of each D2D pair is no more than the required value d max . A Wi-Fi network is also co-located in the cellular network. We adopt the send/clear to send (RTS/CTS) mechanism working at unlicensed 5 GHz in the simulation.  For simplicity, we denote our proposed algorithm as JUARA. We consider several benchmark algorithms for comparison, i.e., JUARA-CUs only algorithm, matching algorithm, and random allocation scheme. JUARA-CUs only algorithm represent that we only exchange CUs after many-to-one matching. Matching algorithm refers that we only use many-to-one matching to obtain the subchannel allocation of the D2D users reusing the licensed spectrum. Random allocation scheme indicates that the BS randomly determines the access modes of the CUs and D2D users. Figure 5 shows the system rate versus the number of iterations. From this figure, we can see that the system rate increases with the number of iterations ascending. Furthermore, after a certain number of iterations, the system rate tends to stabilize. Specifically, we can find that the proposed algorithm needs about 153 iterations to converge when CU = 6, C = 3, D = 8, while it takes about 141 iterations to converge when CU = 5, C = 3, D = 7. It can also be found that the number of required iterations increases with the number of users increasing. In addition, we can find that the convergence speed of the proposed algorithm is relatively low.  Figure 6 plots the system rate versus the distance between the D2D transmitter and the D2D receiver. In this figure, it can be seen that JUARA algorithm performs better than other algorithms in improving system rate. We can also find that the system rate decreases with the increase of the distance between the D2D pairs. This is because the increase of the distance will degrade the communication quality between the D2D transmitter and the D2D receiver. (m) Figure 6. System rate vs. distance between D2D pairs. In Figure 7, we evaluate the system rate versus the number of CUs when N = 8. As shown in this figure, we can find that system rate increases with the number of CUs ascending for different algorithms. Specifically, the proposed algorithm can achieve the highest system rate than the other algorithms. Moreover, the proposed algorithm outperforms JUARA-CUs only algorithm, matching algorithm, and random allocation scheme by 3.1%, 8.2%, 14.5%. Figure 8 shows the system rate versus the number of D2D users when M = 4. In this figure, it can be seen that the system rate ascends as the number of D2D pairs increases. Furthermore, the proposed algorithm can achieve higher performance compared to the other algorithms. Specifically, the system rate by the proposed algorithm increases by 5.3%, 9.4%, 13.7% than JUARA-CUs only algorithm, matching algorithm, and random allocation scheme, respectively. The reason is that the other algorithms only consider the access modes of some users rather than all the users in the system. Combining Figures 7 and 8, we can observe that the system rate rises with the numbers of D2D users and CUs increasing. There are two main reasons leading to this increase. First, the increase number of the CU/D2D users would lead to a higher system rate. Secondly, with the number of CUs (D2D users) increasing, the D2D users (CUs) can have more choices to choose the more preferred CU (D2D user) to be matched. From Figures 7 and 8, we can also find that the system rate would be decreasing when the number of CUs (D2D users) exceeds a value which system can provide since the required minimum rate of the users must be guaranteed.    Figure 9 shows the maximum number of all users versus the number of the Wi-Fi users. The system with the least number of users is "D2D assisted CN in LS", which is because the D2D users and CUs cannot access the unlicensed spectrum. The system "D2D assisted CN in LS and ULS" is the system proposed in this paper. This is because the CUs and the D2D users can access the unlicensed spectrum by JUARA algorithm. Simulation results demonstrate that the proposed iterative algorithm can significantly improve the network capacity and the system rate.

Conclusions
In this paper, we considered a cellular network where the D2D users can reuse the licensed and the unlicensed spectrum. Furthermore, the CUs and D2D users can access the unlicensed spectrum using the duty-cycle mechanism to achieve high system throughput. We formulated an optimization problem to maximize the system rate by jointly considering user access and resource allocation while guaranteeing the QoS of each user. To tackle the formulated problem, we proposed an iteration-based joint user access and resource allocation algorithm. We first obtained a two-dimensional stable matching between the CUs and the D2D users based on the GS algorithm, and then iteratively exchanged D2D users in the licensed and the unlicensed spectrum to maximize the system rate. The properties of the proposed algorithm involving convergence, stability, optimality, and complexity were analyzed in detail. Simulation results demonstrated that the proposed algorithm can achieve high system rate with the excellent QoS of each user. Moreover, the proposed algorithm has a lower complexity as compared to the exhaustive search. Data Availability Statement: Not Applicable, the study does not report any data.