Optimizing the Spectrum and Power Allocation for D2D-Enabled Communication Systems Using DC Programming

Device to device (D2D) communication has recently attracted a lot of attentions since it can signiﬁcantly improve the system throughput and reduce the energy consumption. Indeed, the devices can communicate with each other in a D2D system, and the base station (BS) can share the spectrum with D2D users, which can eﬃciently improve the spectrum and energy eﬃciency. Nevertheless, spectrum sharing also raises the diﬃculty of resource allocation owing to the serious cochannel interference. To reduce the interference, the transmit power of the D2D pairs and BS to cellular users should be further optimized. In this paper, we consider the resource allocation problem of D2D networks involving the power allocation and subcarrier assignment. The resource allocation problem is formulated as a mixed integer programming problem which is diﬃcult to solve. To reduce the computational complexity, the original problem is decomposed as two subproblems in terms of the subcarrier assignment and power allocation. For the subcarrier assignment problem, the particle swarm optimization (PSO) is adopted to solve it since the subcarrier assignment is an integer optimization problem, and it is diﬃcult to be tackled using the traditional optimization approach. When the subcarrier assignment is ﬁxed, there are only the power allocation variables in the original resource allocation problem. The diﬀerence of convex functions (DC) programming is adopted to solve the power allocation problem. Simulation results demonstrate the eﬀectiveness of the proposed resource allocation scheme of D2D networks.


Introduction
In the past decade, the wireless communication technology has made considerable progress and significantly changed the way of living. Meanwhile, the energy consumption and the scarcity of the spectrum are the main challenges of the 5G due to the high data traffic. In this context, device to device (D2D), which allows the mobile users to communicate with each other directly instead of through a base station (BS), is proposed which becomes one of the most promising technologies in 5G wireless networks ( [1][2][3][4]). Indeed, the cellular users can share the spectrum with the D2D users which can improve the spectrum efficiency. On the other hand, D2D technology is able to save lots of energy since it is not necessary to transmit information through the relaying of the BS.
Although the spectrum sharing between the cellular users and D2D users can improve the spectrum efficiency, it also causes significant cochannel interference which limits the performance of the system. erefore, there are a lot of work focusing on the resource allocation problem to mitigate the interference between D2D and cellular users.
Reference [5] investigates the resource allocation for D2D-enabled cellular networks in which the spectrum is shared by the cellular users with the D2D users. In [5], a reverse iterative combinatorial auction is proposed to optimize the subcarrier allocation. In [6], the joint resource allocation and power control D2D links and conventional cellular links are considered to maximize the overall system survival time. en, the joint optimization problem is formulated as a mixed integer nonlinear programming problem, which is solved by a game theory-based distributed approach. Reference [7] formulates the resource allocation problem of a D2D system as a noncooperation game to achieve a good trade-off between the energy efficiency and spectrum efficiency. In [1], the authors investigate cooperative D2D communication in an uplink cellular network where D2D users act as relays for cellular users. Also, the outage probability of a cellular user and the average achievable rate of D2D pairs in an analytic form are derived to obtain the optimal spectrum and power allocation to maximize the total average achievable rate. Reference [8] considers a mixed-mode D2D communication in which D2D links can operate in multiple modes through resource multiplexing. In [8], the mixed-mode allocation and resource allocation in terms of transmit power and subchannel assignment are optimized to maximize the weighted D2D sum rate. Reference [9] considers the resource allocation problem for D2D enabled large-scale cellular networks to maximize the energy efficiency and spectrum efficiency. In [9], an energy efficiency and spectrum efficiency evaluation framework for large-scale D2D-enabled cellular networks is developed by appropriately exploiting the D2D-based mobile-traffic offloading mechanism, the users' behaviors, and the specific network operating conditions. Reference [10] studies an energy-efficient power control design for resource sharing between cellular and D2D users, and a multiobjective optimization problem is formulated to maximize the energy efficiency. en, the method based on the weighting coefficients is adopted to solve the multiobjective problem. Reference [11] considers the problem of an energy-efficient uplink resource sharing scheme over mobile D2D multimedia communications underlaying cellular networks with multiple potential D2D pairs and cellular users. In [11], a novel analytical model of energy efficiency for different sharing modes is constructed. en, the authors formulate the energy-efficient resource sharing problem as a nontransferable coalition formation game, and a distributed coalition formation algorithm based on the merge-and-split rule and the Pareto order is proposed to solve the problem. Reference [12] investigates the joint optimization problem involving the mode selection, channel assignment, and power control for a D2D system. To reduce the computational complexity, the original optimization problem is decomposed into two subproblems.
Massive MIMO is also one of the key scenarios in 5G wireless networks which can dramatically enhance the spectrum efficiency. e resource allocation problem in D2D-underlain massive MIMO cellular networks has attracted a lot of attentions. Reference [13] proposes a spatially dynamic power control solution to mitigate the cellular-to-D2D and D2D-to-cellular interference. Under the considered power control, an analytical approach is developed to evaluate the spectral efficiency and energy efficiency in such networks. e multiuser transmission in massive MIMO may lead to increased cellular-to-D2D interference. Reference [14] studies the interplay between massive MIMO and underlaid D2D networking in a multicell setting. e authors in [14] investigate cellular and D2D spectral efficiencies under both perfect and imperfect channel state information (CSI) at the receivers. Reference [15] considers a cooperative user scheduling scheme in D2D-enabled massive MIMO systems. e problem of huge feedback in massive MIMO systems is solved through reducing the number of users which feedback their channel state information (CSI) to the base station. Reference [16] considers a FDD massive MIMO system in which the CSI feedback would cause significant pilot pollution. In [16], the authors study a cooperative feedback scheme, where the users first exchange their CSI with each other through device-to-device (D2D) communications, then compute the precoder by themselves, and feedback the precoder to the base station (BS). A relay cooperation system has further coverage and higher throughput with the assistance of relay. Reference [17] considers energy harvesting relay-aided D2D networks. In [17], there is an intermediate relay between two D2D users to achieve reliable and flexible communication.
In order to motivate the cooperative relays to participate, the relays can harvest energy from radio frequency (RF) signals based on the power splitting (PS) protocol, as well as renewable energy (RE) sources. Reference [18] studies the resource allocation problem for relay-based D2D networks. In order to maximize the sum rate, [18] the optimal power allocation is characterized when a D2D link operates in the direct or relay mode first. en, the joint mode selection and RG assignment are formulated as a job assignment problem whose optimal solution can be obtained in polynomial time. Reference [19] proposes a system with network coding enabled to assist D2D communication. In [19], a system with intersession network coding enabled to assist D2D transmissions is proposed. In [19], the joint optimization problem of relay selection and resource allocation is formulated, and a two level approach is proposed to solve it, in which a coalition formation game associates relays with D2D pairs to enable network codingaided transmissions, and a greedy algorithm-based game allocates limited cellular resources to D2D pairs and relays in network coding D2D. Reference [20] investigates the performance of relay-assisted D2D communication with multiusers and multirelays. In [19], a distributed solution for resource allocation with a view to maximizing network sum rate is proposed.
In this paper, we consider the joint resource allocation problem for D2D-enabled cellular networks involving the power allocation and subcarrier allocation to minimize the interference between the cellular users and D2D users. e joint resource allocation is formulated as a mixed integer programming problem which is difficult to solve in general. To reduce the computational complexity, the original optimization problem is decomposed into two subproblems, namely, the subcarrier allocation subproblem and power allocation problem, respectively. For the subcarrier assignment problem, the particle swarm optimization (PSO) is adopted to solve it since the subcarrier assignment is an integer optimization problem, and it is difficult to be tackled using the traditional optimization approach. When the subcarrier assignment is fixed, there are only the power allocation variables in the original resource allocation problem. e difference of convex functions (DC) programming is adopted to solve the power allocation problem.
e main contributions of this paper are summarized as follows: 2 Journal of Electrical and Computer Engineering (1) We study the joint resource allocation problem for D2D-enabled cellular networks to minimize the interference between the cellular users and D2D users and maximize the system throughput. e joint resource allocation is formulated as a mixed integer programming problem. (2) In order to optimize the formulated optimization problem, the original problem is decomposed into two subproblems, namely, the subcarrier allocation subproblem and power allocation subproblem, to reduce the computational complexity. (3) e PSO is adopted to optimize the subcarrier allocation subproblem that is formulated as an integer programming problem. en, the power allocation subproblem is optimized by the DC programming method.
e rest of the paper is organized as follows. In Section 2, the system model is presented. In Section 3, the subcarrier allocation is optimized by PSO. e power allocation is optimized by the DC programming method in Section 4. In Section 5, simulation results are provided to evaluate the performance of the proposed algorithm. Finally, we conclude this paper in Section 5.

System Model
In this paper, a downlink cellular network consisting of a base station (BS) and multiple users is considered as shown Figure 1. When the distance between two users is close enough, the D2D communication is performed without the assistance of the BS to reduce the energy consumption. It is assumed that the number of cellular users and D2D users are C and D, respectively. All the cellular users and D2D users are randomly distributed in the cell. We further assume that the cellular users can share the spectrum with the D2D pairs to improve the energy efficiency. In addition, all the D2D pairs are divided into N packages, and the members of the k th D2D user package (denoted by D k ) share the same cellular user's spectrum resource. en, we give the received signals at cellular user c and D2D receiver d as follows: where u ck is the spectrum allocation variables. If the D2D package k uses the c th cellular user's spectrum, u ck � 1; otherwise, u ck � 0. p b,c and p d are the transmit power of BS on the c th cellular user's spectrum and D2D user d, respectively. h bc and h cd denote the channel coefficient between BS and cellular user c and between D2D user d and cellular user c, respectively. h bd , h dd , and h dd′ are the channel coefficients between the BS and D2D user d, between D2D user d and its corresponding D2D receiver, and between D2D user d and D2D user d ′ . n c and n d denote the Gaussian noise.
In the following, we give the signal to interference plus noise ratio (SINR) at the side of the cellular users and D2D users in the D2D-enabled cellular network. For cellular user c, it suffers interference from D2D users sharing the same spectrum resource. e SINR of cellular user c (c � 1,2·, C) can be given as e D2D receiver d suffers the interference from the BS and other D2D users that are assigned the same spectrum resource. We can give the SINR of receiver d as follows: en, the transmission rate of the cellular user c and the D2D receiver d (d ∈ D k ) can be given as follows: e system sum rate can be obtained as follows: In this paper, we consider the joint resource allocation for the D2D-enabled cellular networks. e spectrum allocation and power allocation are optimized to mitigate the interference between D2D users and cellular users and further maximize the system overall throughput. e problem of D2D-enabled cellular network resource allocation can be formulated as follows: where p � [p b,1 , ·, p b,C , p 1 , ·, p D ] and U � [u ck ] C×N ; constraint (9) is imposed to guarantee that each cellular user's spectrum resource can only be allocated to at most one D2D user package. Constraint (10) is imposed to guarantee that each D2D user package can only share at most one cellular user's spectrum resource. Constraints (11) and (12) mean the peak power constraints of the BS and D2D transmitter, respectively. P b and P d are the maximum transmit power of the BS and D2D user d (d � 1,2 ·, D), respectively. It can be seen that problem P1 is a mixed integer programming problem which is difficult to solve using the traditional method. In order to reduce the computational complexity, we decompose the original problem as the spectrum allocation subproblem and power allocation subproblem. In the next section, the spectrum allocation subproblem will be optimized using PSO which is one of the most popular evolutionary algorithms. en, the power allocation subproblem will be solved by the DC programming method, and the details will be described in Section 5.

Spectrum Allocation Using PSO
As aforementioned, problem P1 is a mixed integer programming problem, and its computational complexity is extremely high. To reduce the computational complexity, we divided problem P1 as two subproblems in terms of the spectrum allocation and power allocation. In this section, we adopt PSO to optimize the spectrum allocation subproblem due to its combinatorial nature. Indeed, the spectrum allocation is an integer programming problem which is difficult to tackle using the traditional method. PSO is a kind of population optimization algorithm, and it is of great advantage to solve the integer programming problem. erefore, PSO has been widely used in the engineering problem ( [21][22][23][24]). In particular, the NR-PSO is applied in this paper since it has an excellent local search ability. e details of NR-PSO can be referred to [21].

NR-PSO Algorithm.
In NR-PSO, particle i is represented by the velocity v i,d and the position x i,m . ese two features are updated as follows: where v k+1 i,m and v k i,m are the current and previous velocities in the m th dimension of particle i, respectively; x k+1 i,m and x k i,m is the current and previous positions of particle i, respectively; p k i,m and p k g,m represent the best position found by the particle so far and the best position found by the whole swarm so far, respectively; ω is the inertia weight used to control global exploration and local exploration of the particle; c 1 and c 2 are acceleration coefficients; r 1 and r 2 are the randomly generated numbers in the range of [0, 1]. e upper boundary and the lower boundary of each particle can be written as X up � (x 1 , ·, x M ) and X low � (x 1 ′ , ·, x M ′ ), respectively. en, the width of the solution space can be defined as follows: In NR-PSO, the convergence judgement space is defined as follows: where s is convergence factor in the range of [0, 1]. Similarly, the neighborhood research space can be defined as follows: where e is neighborhood factor in the range of [0, 1] and e > s. In the i th iteration search, positions of the i th particle and global optimum are x k i � (x k i,1 , ·, x k i,M ) and p k g � (x k g,1 , ·, x k g,M ), respectively. e distance between them can be expressed as follows: 4 Journal of Electrical and Computer Engineering If d i−distance ≤ W conv , the i th particle can be regarded as congesting at the current global optimum. To improve the local search performance, the particles with d i−distance ≤ W conv are updated to the neighborhood research space: where R is a random number in the range of [−1, 1].

Encoding and Coding for Spectrum Allocation.
In PSO, the encoding and coding of the solution is important since a suitable encoding and coding method can efficiently degrade the search space of PSO algorithm. In this paper, the integer encoding is adopted to replace the 0-1 encoding method. e position code for particle i is given as follows: where x i c represents the spectrum allocation variable, and it is an integer in the range of [0, N]. If x i c ≠ 0, it means that the cellular user c's spectrum resource is assigned to the D2D package x i c . Otherwise, the cellular user c's spectrum resource is not assigned to any D2D package.

Power Allocation Using DC Programming
In the previous section, the spectrum allocation of the D2Denabled cellular network is optimized by the PSO. When the spectrum allocation is fixed, there is only the power allocation in original optimization problem P1. Problem P1 can be rewritten as follows: s.t. equations (11) and (12). Obviously, problem P2 is a nonconvex optimization problem. According to the property of logarithmic function, (22) can be rewritten as follows: Let H( p → D ) � log 2 ( N k�1 d∈D k p d h 2 bd + N 0 ) and H( p Using the first order Taylor expansion, Substituting (24) and (25) into (23), (23) can be rewritten as follows: Journal of Electrical and Computer Engineering 5 erefore, Problem P2 can be reformulated as follows: s.t. equations (11) and (12). At this point, problem P3 is transformed as convex optimization problem, and it can be optimized by the Lagrangian dual method.
e Lagrangian function of P3 can be written as follows: where λ and μ d (d � 1, . . . , D) are the Lagrangian multipliers with respect to constraints (11) and (12), respectively. en, the dual function of Lagrangian function can be given as follows: Setting the partial derivation of equation (28) with respect to p of equation (28) to zero, Solving the abovementioned equations, the optimal power allocation p * can be easily obtained.
e iterative formula of p v can be written as follows: e dual problem of problem P3 can be obtained as follows: In this paper, the subgradient method is used to solve the abovementioned dual problem. e subgradient can be written as follows: e Lagrangian multipliers can be updated by where θ is the iteration stepsize; Algorithm 1.

Simulation Results
In this section, we intend to evaluate the performance of the proposed spectrum allocation and power allocation algorithm for a D2D underlay communication system. In simulation, a square service area is considered, and a BS is distributed in the center of the region. e cellular users and D2D users are randomly allocated in the cell. e large-scale path loss model adopts the Okumura-Hata, and the smallscale fading is modeled as Raleigh fading, that is, the channel coefficients follow exponential distribution. e number of cellular users is set to C � 5, and the number of D2D pairs is changed from 2 to 10. In order to evaluate the proposed algorithm, we compare the performance of the proposed spectrum allocation and power allocation algorithm with some benchmarks. Next, we will describe these benchmarks.
No spectrum allocation: in this benchmark, the spectrum is allocated randomly, and there is only power allocation that is optimized No power allocation: the power is allocated randomly, and there is only spectrum allocation that is optimized No spectrum allocation and power allocation: both the spectrum and power allocation are allocated randomly Figure 2 shows different sum rates obtained by the proposed spectrum allocation and power allocation algorithm and these benchmarks with different number of D2D users. It can be observed from Figure 2 that the sum rate of the network increases with the increase in the number of D2D users. e result illustrates that the multiuser diversity can efficiently improve the system performance. Meanwhile, it can also be seen that the performance of the proposed spectrum allocation and power allocation algorithm outperforms that of these benchmarks which demonstrates the effectiveness of the proposed scheme. Figure 3 compares the sum rate with a different SNR of the proposed algorithm with that of these benchmarks. From Figure 3, it can be seen that the sum rate of the network increases with the increase of the transmission SNR, and the slope of the curve becomes smaller and smaller with the increase of the transmission SNR. It can also be seen that the proposed spectrum allocation and power allocation algorithm have more excellent performance comparing with these benchmarks.
is result shows that the system performance will be effectively increased when the spectrum, and power allocation are carefully optimized. Figure 4 shows the total achievable rate of all D2D users with the increase of the maximum transmission power of each D2D pair. It can be seen that the total achievable rate of D2D users increases with the increase of the maximum transmission power of each D2D pair. It can also be observed that the performance gap between the proposed algorithm and the aforementioned benchmarks becomes bigger and bigger. is result comes from the fact that the spectrum and power allocation has better performance when the transmission SNR is large enough. Figure 5 depicts the achievable rate of the worst D2D pair with the increase of the transmission SNR. In fact, the performance of the worst D2D pair can reflect the overall (1) Initialization (2) set i � 0.
(8) Compute the optimal power allocation of P3 p b and p d according to equations 30 and (31). (9) Updating power allocation p i r,n,j according to equation (32); (10) Solve the dual problem and updating Lagrangian multiplier λ and μ d (d �1, 2 · · ·, D)according to equations (37) and (38) respectively. (11) end while ALGORITHM 1: e power allocation optimization using DC programming. system performance. From Figure 5, it can be seen that the proposed spectrum and power allocation algorithm can effectively enhance the performance of the worst D2D pair, which furthermore improves the system performance.
In the following, we intend to evaluate the convergence performance of the proposed spectrum allocation and power allocation algorithm. Figure 6 shows the different multipliers with the increase of the iteration indices. e result illustrates the convergence of the proposed algorithm. It can also be observed from Figure 6 that the proposed algorithm converges within 50 iterations.

Conclusions
In this paper, the joint spectrum and power allocation optimization problem for D2D underlay cellular networks is investigated to maximize the system throughput. Due to the spectrum sharing, there is a significant interference between cellular users and D2D users. In order to mitigate the       interference, we intend to jointly optimize the spectrum allocation and power allocation. e joint resource allocation problem is formulated as a mixed integer programming problem which is difficult to tackle. To reduce the computational complexity, the original optimization problem is divided as two subproblems in terms of the spectrum allocation and power allocation. We adopt the PSO to solve the spectrum allocation subproblem due to its combinatorial nature. e power allocation subproblem is a nonconvex optimization problem. In the first, we transfer it as a convex optimization problem using DC programming, and the Lagrangian dual method is applied to solve it.

Data Availability
e data used to support the findings of this study are available from the corresponding author upon request.

Conflicts of Interest
e authors declare that they have no conflicts of interest.