A Full Duplex D2D Clustering Resource Allocation Scheme Based on a 𝐾 -Means Algorithm

Although the Device-to-Device (D2D) technology in cellular networks can improve the performance of cellular systems, it creates a large amount of interference in traditional communications. In this paper, the problem of resource allocation and control in a single-cell scene is studied. First, the concept of a restricted D2D communication area and a restricted D2D user-reusage area is put forward to reduce the complexity and interference intensity of resource allocation. Second, under the premise of satisfying the QoS (Quality of Service) demands of every system user, the resource allocation algorithm is improved, the optimal allocation of resources is carried out, and the algorithm’s processes are given in detail. Our simulated experiments show that the proposed method greatly improves the spectrum efficiency and the system fairness.


Introduction
In recent years, the rise and rapid development of smart phones have profoundly changed the way we communicate and enjoy digital entertainment.The wide use of wireless applications, such as cloud computing, surfing the Internet, and downloading and watching digital multimedia, has created a large demand for high-speed and efficient wireless communication technology.5G is the next-generation mobile communication system that is being developed for the expected demand of information and communication after 2020.It will have higher spectrum utilization and transmission rate, significantly improved transmission delay and QoS (Quality of Service) perception, and an increased number of access links and security [1].
Device-to-Device (D2D) technology [2,3] is a hot topic in the field of mobile communication.Using D2D technology, adjacent terminals can transmit data within a close range through a direct link without a central node.In this case, the base station sends only some control information, which greatly reduces the load of the base station [2,4,5].D2D users can effectively reuse the wireless resources authorized by the network to enhance the reusage rate of the wireless spectrum and expand the throughput and coverage of heterogeneous cellular networks [6,7].In full duplex mode, the spectrum benefit is doubled as a result of allowing users to synchronize and send and receive signals simultaneously [8,9].This technology can greatly improve the wireless transmission rate, and it has great technical advantages and application prospects.As such, it is a promising option for future 5G communication.
However, under the same cell, channel resources are reused by D2D communication and cellular users simultaneously.So, while D2D communication technology brings convenience, it also results in frequency interference [10].As the number of users increases, the interference between them also rises.The problem of network capacity optimization and power allocation also arises, which leads to an increase in the power consumption of the entire system.In heterogeneous networks, there are two resource allocation schemes: one is local resource allocation (fixed-cell user resource and adaptive resource allocation for a D2D pair) and the other is global resource allocation (the cell service user and the D2D pair are allocated resources jointly) [11].Because D2D communications can compete and cooperate with each other to share resources, their individual or group behaviors conform to the inherent nature of game theory, which allows them to be effectively modeled and analyzed [12].

Wireless Communications and Mobile Computing
The combination of D2D communication technology and a cognitive radio (CR) can effectively reduce interference [13].CR technology, through interactions with the external environment in terms of multidimensional spectrum detection, as well as real-time and interactive environments, is able to perceive any interference and make subsequent judgments so that cognitive users can choose the most appropriate communication frequency to avoid interference to primary users under the condition of the spectrum with the primary users sharing [14].How to manage the spectrum resources of the community as a whole, reasonably determine the communication power of each device, and minimize the interference between devices have become the main bottleneck for D2D communication to enter the practical stage.It is worthwhile to try to achieve power stability [15,16] or learn from software reliability prediction through context sensitive rate Boolean control network [17].
Considering the strengths and weaknesses of current D2D communication research, we have studied resource allocation and power control in the single-cell scenario based on the work of [18].First, the concept of a restricted D2D communication area and a restricted D2D usage area is put forward to reduce the complexity and interference intensity of resource allocation.Second, under the premise of satisfying the QoS of all users in the system, the resource allocation algorithm is improved, the optimal allocation of resources is carried out, and a detailed description of the algorithm's processes is given.Our simulated experiments show that the proposed method greatly improves the spectrum efficiency and system fairness.

Problem Description
For a single-cell model, it is assumed that the cell includes  cellular users and  D2D user pairs, and the number of subchannels in this cell is .The set of cellular users is  = { 1 ,  2 , . . .,   }, while the set of D2D user pairs is  = { 1 ,  2 , . . .,   }.D2D user pairs can reuse the cellular users' uplink resources.Compared with a user device, the base station has stronger anti-interference ability and processing power, and the amount of data in the cellular network is asymmetric, where the uplink resources are not fully utilized [19,20].Therefore, the D2D communication discussed in this paper chooses to reuse the uplink resources of the cellular system.
Assuming that the location coordinates of each user device are known to the base station, the channel gain between any users and between the users and the base stations can be calculated.In a cellular system model, BS is the base station, and the th D2D user pair D2D  reuses the uplink resource of the th cellular user.See Figure 1.
As shown in Figure 1, CU  send signals to the BS, where the channel gain is  , .The transmitter D2D , of the th D2D pairs D2D  sends signals to the receiver D2D , , where the channel gain is   .When CU  transmits a signal, there is interference to D2D , , where the channel gain is ℎ , .Additionally, there are interferences to the base station when D2D , transmits a signal, where the channel gain is ℎ , and the Gaussian white noise is  0 .Regarding the road-loss model, the slow fading caused by the multipath effect and the fast fading caused by the shadow effect should also be considered.As such, the channel gains of the D2D pairs' transmitter D2D , to the base station and CU  to D2D , can be expressed as ℎ , =  ⋅  , ⋅  , ⋅  − , . (2) Among them,  is the road-loss constant and  is the road loss index, which are both determined by the cellular system environment. , is the distance from D2D , to the base station, and  , is the distance from CU  to D2D , . , is the fast fading gain from D2D , to the base station, which has an exponential distribution,  , is the fast fading gain from CU  to D2D , , which also has an exponential distribution,  , is the slow fading gain from D2D , to the base station, which has a logarithmic distribution, and  , is the slow fading gain from CU  to D2D , , which also has a logarithmic distribution.
The foregoing description shows that there are three kinds of interference in the considered scenario: (1) interference from the D2D transmitter to the cellular system; (2) interference from the cellular users to the D2D receiver; and (3) interference between D2D pairs sharing the same spectrum resources.The problem to be solved in this paper is to establish a cellular resource reuse state system model under the consideration of all three kinds of interference and use it to determine the best resource allocation plan.

Resource Allocation Scheme Satisfying
System QoS

D2D User Pairs Delimit Communication Restricted Areas.
As a D2D user reuses the upstream resource of a cellular user, the closer the D2D user is to the base station, the greater the amount of interference is imparted to the BS receiving the CU (cellular user) signals.Therefore, to reduce the interference, we propose an improvement to the total throughput of the system while also reducing the computation complexity; we suggest restricting the size of the D2D communication area.In this area, D2D is considered to contribute a large amount of interference to the base station.Out of this area, any interference from D2D to the base station can be ignored.
Assuming that   max is the maximum transmission power of all D2D users,  , indicates the interference threshold value of all D2D users to the base station, which must satisfy The interference of all D2D users to the base station must be less than this threshold value; otherwise, it will cause more serious interference to the base station, so that cellular users cannot communicate effectively.Among them,  , is obtained via long-term observations of a cellular cell.By combining ( 1) and ( 3), we can solve for the radius  1 , which is the radius of D2D communication limited area: Therefore, the limited D2D communication area is a circular area of radius  1 with the BS at the center (see Figure 2).When the base station receives a request to establish a D2D link, the base station first determines whether the D2D transmitter is in the D2D communication area, and if it is, then this prohibits the establishment of D2D link.

Cellular Users Are
Restricted to the Reusage Area.We can see from Figure 1 that when D2D users and cellular users use the same uplink resources, there will be interference from CU  to D2D , , where the closer the distance between them is, the greater the interference will become.Therefore, we propose to delineate a restricted reusage area for the cellular users to reduce this kind of interference.Assuming that   max represents the maximum transmit power of the cellular users,  , represents the threshold value of the cellular users' interference to the D2D users.Hence, the total imparted interference from all cellular users to the D2D users must be less than this threshold value; otherwise the D2D users cannot communicate normally.That is to say, the following formula should be satisfied: Among them,  , is determined by long-term observations of cellular cells.If we combine ( 2) and ( 5), we can calculate the restricted area radius  2 of the cellular users: So, the limited, reusage area for a cellular user is a circle with radius  2 , where D2D , is located at the center (Figure 2).Any cellular users in this area are not selected as potential reusage objects by any D2D pairs.

System Model Establishment.
To satisfy all users QoS requests, we must ensure that the D2D users and cellular users reach their respective minimum SINR (signal-tointerference-plus-noise ratio).For device  in the cellular , the SINR of the device when communicating is SINR (, ) =   (, )  (, ) +   , ∀, 1 ≤  ≤ .(7) Among them,   (, ) =   (, ) ⋅   (, ) indicates the valid signal strength that device  receives from cellular ,   (, ) is the transmission power of each base station RB (resource block),   (, ) is the channel gain between the BS and the device, and (, ) is the summed interference from all other devices.The goal is to maximize the system's throughput: Wireless Communications and Mobile Computing Among them,  CU  represents the actual SINR of the cellular users, and  DU  represents the actual SINR of the D2D users.   and    , respectively, represent the actual transmission power of the cellular users  and the D2D users , while ℎ , indicates the channel gain between the cellular users  and the base station.The model is 128.1 + 37.6 ⋅ lg , where  is the distance between the cellular users and the BS in units of Km. ℎ , , ℎ , , ℎ , , and ℎ , , respectively, represent the channel gain between users, where the model is 10 ⋅ lg 4 and  is the distance between two users in units of m.  , is a binary value: if users  and  share the same resources,  , = 1; otherwise  , = 0. Finally,   max and   max , respectively, represent the minimum SINR of a cellular user and a D2D pair when they communicate normally.
The foregoing objective function represents the maximum throughput of the complete system.The first two restricted conditions (see (8a) and (8b)) ensure that cellular users and D2D users meet their QoS needs.Only those D2D users that satisfy these two conditions can be connected to the network at the same time.The last two restricted conditions (see (8c) and (8d)) indicate that the transmission power of the cellular and D2D users should not exceed the maximum transmission power.

D2D Pair Clustering to Solve the Problem of Interference between D2D Pairs and Each
Other.In cellular communication systems, there is interference between D2D pairs and each other.To effectively use the available system resources, it is necessary to reduce this kind of interference by grouping D2D pairs into clusters.It is considered that, in the same cluster, the interference between D2D pairs and each other can be ignored, and it is possible to reuse resources for the same CU.As their location coordinates are known, the distance between the D2D pairs can be calculated.The closer the distance between D2D pairs is, the greater the interference becomes; that is, the distance between D2D pairs is inversely proportional to the interference value.The reciprocal of the distance value is used to represent of the interference, where a matrix of interference values between the D2D pairs can be formed.Then, the -means clustering method is used to divide the D2D clusters according to their interference value in the matrix.Assuming that the total number of D2D pairs is , all D2D devices are grouped as  = {(),  = 1, 2, . . ., }.After clustering,   clusters are formed and recorded as  = {(),  = 1, 2, . . .,   }.The specific algorithm process is as follows: (1) Randomly select the initial cluster centers of   as  = {(),  = 1, 2, . . .,   }.
(2) The distance between samples is calculated, and their interference value in the matrix is formed from the reciprocal of the distance value, and the sample is added to the cluster with the smallest interference value.
(3) Calculate the summed square distance between points in cluster () and the cluster center (), as well as the total summed square distance: According to the least-square method and the Lagrange principle, the cluster center () takes the average of each sample point within the corresponding cluster ().( 4) According to these steps, we iterate and update the cluster until () converges to a minimum value, whereby the iteration is complete.
After iteration, we output the centers of the   clusters { 1 ,  2 , . . .,    } and decide which D2D devices are included in each cluster.

Resource Allocation of the D2D User Cluster under a QoS
Guarantee.Through the aforementioned steps, all D2D pairs are divided into  clusters, each of which is called   .Because the interference arising from the D2D network is different for each TTI (Transmission Time Interval), the number and the size of the clusters are not fixed, which makes full use of the instantaneous channel state information of the D2D network.The main task of this section is to determine which subchannel is assigned to which cluster.
Let us consider the following model for resource sharing: the cellular users are allocated resources as a prior, and each user occupies a cellular RB.A single D2D cluster can reuse most of the cellular users' spectrum resources; otherwise, a cellular spectrum resource is only reused by a single D2D cluster.The channel allocation is represented by the matrix  = [  ].Element   = 1 indicates that channel  is assigned to the D2D cluster ; otherwise, it is equal to 0. The goal of this article is to find an allocation method  opt to maximize the throughput of the whole system; that is, among which   represents the data rate of the cluster  to the RB  .To ensure normal communication throughout the original cellular network, in the actual resource allocation stage, it is necessary to screen any D2D users not only meeting the D2D QoS request from each cluster and to also ensure the normal communication of all cellular users and grant them access to the network.Therefore, the D2D pairs in the same cluster   are different, which shared different resource blocks of the same cellular user.Cluster  Share is used to represent a D2D set that can share RB  in cluster   .For a particular RB, the screening process for the D2D users that can eventually access the network is as follows: (1) Initialization: consider the case of a particular cluster  Step (2) filters the D2D pairs in cluster   by considering the interference between the D2D pairs and the base station and from the cellular users to the D2D users.If a QoS request cannot be fulfilled, we then obtain cluster   .Step (3) calculates the interference value of each D2D pair in cluster   and, according to the interference value sorts the corresponding D2D users.Step (4) starts with the D2D pair that has the minimum value of interference from cellular users in cluster   and then calculates the SINR of the cellular user when this D2D pair is shared RB  .If the SINR is less than the minimum SINR of the cellular user, the system does not allow the D2D pair to share RB  ; otherwise, it puts the D2D pair into cluster  Share .The system then considers the D2D user with the second smallest interference value and calculates these cellular users' SINR.The entire process is repeated until every D2D pair in   has been calculated.Finally, all D2D users in cluster   which can share RB  are obtained and are represented by the cluster  Share .
In this paper, we use throughput  to characterize the throughput achieved by each cluster to each RB.Finally, we construct a two-dimensional throughput  matrix based on the cluster number and the RB number and allocate resources for each cluster according to the constructed matrix.
The throughput  value of the cluster   sharing RB  is defined as Among them,  DU  is the D2D users' SINR in cluster  share in RB  and  CU indicates the cellular users' SINR in RB  when there is interference from the D2D users in cluster  share .The specific resource allocation process is as follows: (1) Initialize: according to (11), calculate the throughput  of each cluster in each RB, and then construct the throughput  matrix.Assuming  is the set of RBs that have not yet been allocated,  shows a single RB,  ∈ .
(2) while ( ̸ = 0): In the throughput  matrix, find the maximum throughput  value, and its corresponding RB  and cluster  share ; Allocate RB  to cluster  share ; Set all RB  corresponding to throughput  to −1,000.

𝑆 = 𝑆 − {𝑗};
End while (3) Power distribution: the final transmission power of each D2D pair  is (the number of RB that been allocated to D2D  ) , where the transmission power of cellular users is   =   max .

Simulation Parameters.
A single-cell scenario with a radius of 500 m is considered, where all CUs and DUs are randomly distributed uniformly in the cell.The D2D pairs and CU are static, and each receiver and each transmitter have a single antenna.In the simulation, it is assumed that the amount of self-interference cancellation of the full duplex D2D node is 110 dB [24], the antenna gain is 14.0 dBi [25], the uplink bandwidth is set to 1.4 MHz, and the resource block RB is six.All parameters are shown in Table 1.The  simulation was performed using Matlab, where the goal of our proposed scheme is to determine the optimized total system throughput and average SINR, which are then compared with the full duplex random resource allocation scheme of [18,26] to verify its validity.From Figure 3, we can see that as the D2D communication area radius increases from 0 to 150 m, the average SINR increase is not very obvious.However, when the radius exceeds 150 m, the average SINR of the system increases with an increase of the radius of the D2D communication area.It can be seen that, to reduce the interference from the D2D users to base station, it is necessary for the cell to delimit a restricted D2D communication area.Under the experimental conditions set in this paper, the radius of the restricted D2D communication area is ∼150 m.At the same time, it can be seen from Figure 4 that the proposed algorithm is obviously better than the resource block random allocation algorithm used by other authors [18,26].

Influence of the Number of D2D Pairs to the Total
System Throughput Verification.Figure 4 shows the total system throughput of the two resource allocation schemes as the number of D2D pairs increases.From this figure, we can see that when the number of D2D pairs is <20, the throughput of the proposed resource allocation scheme is similar to that of the random allocation scheme.As the number of D2D pairs increases, the total throughput of the two schemes gradually increases, but the throughput of our proposed scheme is significantly higher than that of the random resource allocation scheme.

Comparison of the Cumulative Distribution of the
Total System Throughput. Figure 5 shows the cumulative distribution functions (CDFs) of the total throughput of the system for the two schemes.Since our method uses a means algorithm to cluster the D2D pairs, where interference can be ignored for each pair, and then allocates the optimal RB to the D2D cluster, we are able to fully utilize the system's available and reusable RBs, and the number of D2D links established in the cellular system is maximized.Therefore, compared with the reference algorithm, the total throughput of the system has been significantly improved.

Conclusions
We analyzed the status of D2D pairs that reuse the resources of cellular users in the same 5G channel in a cellular communication system to eliminate the interference of D2D pairs to the base station, CU users to D2D receivers, and D2D pairs with each other.We proposed several countermeasures and solutions, where a function model was constructed to maximize the system's efficiency.To eliminate the interference of D2D users to the base station, the concept of a limited D2D communication area is proposed.The interference of D2D users to the base station outside of the restricted area is negligible.The concept of a limited reusage area to combat the interference of CU users to D2D users is proposed.It is possible for the D2D users to reuse the CU resource outside of the restricted area.To address the interference between D2D pairs, we suggest using the interference intensity value to the cluster D2D pairs based on a -means algorithm, where the larger the interference value is between D2D pairs, the smaller the probability of being placed into a cluster is.In the same cluster, the interference can be neglected between D2D pairs; that is to say, they can reuse the same CU resources.Then, we described the resource allocation algorithm, where we allocated CU resource blocks to the clustered D2D pairs and allocated the best RBs to D2D pairs.As demonstrated with a simulation performed with Matlab, our method is able to eliminate interference and improve the system's overall performance.

Figure 2 :
Figure 2: Cellular users in relation to the limited D2D communication area and the reusage area.

( 3 )
for  = 1 :  ( ∈   ) do calculate the interference value of D2D  to the cellular user in RB  end for Ascendingly sort the interference values of all D2D users in   (4) for D2D users after sorting do calculate the SINR of the cellular user after added the D2D pairs if the SINR of the cellular user satisfies SINR ≥ SINR

Figure 3 :
Figure 3: Influence of the radius of the D2D communication area versus the average SINR of the system.

4. 2 . 1 .
D2D Communication Restricted Area Verification.Figure 3 is a chart of the average SINR change of the system for increasing radii of the D2D communication area.

Figure 4 :
Figure 4: Influence of the number of D2D pairs on the total capacity of the system.

Figure 5 :
Figure 5: CDFs of the system capacity for the two considered schemes.
, between CU  and D2D  on RB  calculate the distance  , between D2D  and the base station BS calculating the SINR  of D2D  if D2D  satisfies SINR  ≥ SINR  min and  , ≥  1 and  , ≥  2 put D2D  into cluster sharing RB  , and create two new clusters of   and  Share (2) for  = 1 :  (, GK) do calculate the distance