A Two-Layer, Energy-Efficient Approach for Joint Power Control and Uplink–Downlink Channel Allocation in D2D Communication

Energy efficiency (EE) is a critical performance indicator for the device-to-device (D2D) communication underlaying cellular networks due to limited battery capacity and serious interference between user equipment. In this study, we proposed a power control and channel allocation scheme for the EE maximization of the D2D pairs, while jointly reusing uplink–downlink resources and guaranteeing the cellular users’ (CUs) quality of service (QoS). The formulated problem was a mixed-integer nonlinear programming (MINLP) problem, which is generally an unsolved non-deterministic polynomial-time hardness (NP-hard) problem within polynomial time. To make it tractable to solve, the original problem was divided into two sub-problems: power control and channel allocation. A power control algorithm based on the Lambert W function was proposed to maximize the EE of the individual D2D pair. Assigning either an uplink or downlink resource to reuse, the EE of each D2D pair was calculated using the power control results. A channel allocation scheme based on the Kuhn–Munkres algorithm utilized the EE weights to optimize the overall EE of the D2D pairs. The simulation results verified the theoretical analysis and proved that the proposed algorithm could remarkably improve the EE of D2D pairs while guaranteeing the QoS of the CUs.

growing demand from applications, which in turn leads to a rapid increase in energy consumption and more interference between equipment [13]. Additionally, due to the slow improvement in battery technology, the gap between the required energy consumption and the available battery capacity has grown exponentially. Therefore, the design of D2D communication systems with energy efficiency (EE) [14] as a performance indicator has recently attracted widespread attention in various fields.
The energy consumption of a whole communication process includes computing [15], storage [16], and transmission [17]. We pay more attention to the last one, namely the extensive transmission energy consumption. An energy-efficient content transmission system was proposed in Zhou et al. [18] to realize the large-scale content transmission among mobile devices. Considering the D2D pairs as bidders and the cellular network as the auctioneer, an auction-based power allocation, channel selection, and cooperative relay selection algorithm for EE optimization was proposed in Wang et al. [19]. Under the constraints of the minimum user data rate and the fixed bandwidth allocated to the D2D link, the network throughput was maximized in Chen et al. [20]. By transforming fractional programming into a solvable problem, Jiang et al. [21] combined the iterative resource allocation and power control to maximize the EE. Wei et al. [22] demonstrated the tradeoff between EE and SE through theoretical analysis. Aiming at reducing energy consumption and interference, Li et al. [23] proposed a novel socially aware, energy-efficient relay selection scheme based on game theory. Most of the above works consider the matching problem between the D2D pairs and the CUs. However, the performance of the CUs is seldom considered during the optimization process.
With channel gain information, a greedy heuristic algorithm was proposed in Zulhasnine et al. [24] to control the interference between user equipment. Li et al. [25] addressed an alliance formation game theory method that converges to a Nash-stable equilibrium, archiving maximization of the sum rate. Compared with direct D2D communication and traditional cellular communication via base stations (BSs), Wei al. [22] researched the multi-hop D2D communication scenario. Combining the channel characterization of optimal power and a graph-based channel allocation algorithm, Hoang et al. [26] maximized the weighted system sum rate. Most of the above works aimed to optimize the overall performance, with good results. However, the performance improvement of D2D pairs is seldom considered.
In recent years, there have also been some effective solutions to D2D resource allocation problems. Kaufman et al. [27] developed a distributed dynamic spectrum protocol that achieved valid power savings through a single-hop or multi-hop route establishment. Wang et al. [28] studied a novel distributed game source selection and power control scheme, which improved transmission quality with latency constraints. While meeting the requirements of the D2D pairs and CUs, Rahman et al. [29] optimized a power allocation solution for D2D sources and D2D relays in terms of maximizing the EE. Most of the above works mainly focused on the power control for reducing interference in the resource allocation of D2D communication. However, joint channel allocation and power control for the maximization of system performance have seldom been considered.
The D2D communication network architecture should meet the quality of service (QoS) requirements of the CUs as well as solve EE optimization problems [14]. Liu et al. [30] focused on the EE maximization problem with the QoS constraints of both the CUs and D2D pairs in mind. After the transmission power is allocated, game theory is utilized to establish the preferences of each user's equipment and obtains a stable matching result. Kai et al. [13] designed a joint uplink subcarrier assignment and power allocation to minimize power consumption. An iterative non-cooperative power game with the Gale-Shapley algorithm was proposed to optimize EE in Zhou et al. [31], which was extended to a context-aware partner selection of D2D pairs in Zhou et al. [32]. A joint resource allocation scheme was investigated in Zhang et al. [33] for downlink systems, which could obtain a near-optimal solution with low computational complexity. However, the above works were mainly based on the assumption that only uplink or downlink spectrum resources could be shared. Hence, the performance could be further improved as the spectrum resources have not been fully utilized.
Motivated by the aforementioned review, we formulated a power control and channel allocation problem for the EE maximization of D2D pairs, while jointly reusing uplink-downlink resources and guaranteeing the QoS of the CUs.
The main contributions of this paper are summarized as follows: 1. This study derived a problem formulation for optimizing the achievable EE of D2D pairs under uplink-downlink resources reuse, transmission power, and QoS constraints. The formulation obtained was a mixed-integer nonlinear programming (MINLP) problem, which is generally an unsolved non-deterministic polynomial-time hardness (NP-hard) problem within polynomial time [31,34]. To make it tractable to solve, the original problem was transformed into two sub-problems. 2.
One main focus of this study was to derive a closed-form expression of power allocation for maximizing the EE of an individual D2D pair while satisfying the QoS of the CUs and D2D pairs. Taking into account reusing uplink-downlink resources, we modeled the power allocation problem as an equivalent convex optimization. The optimal transmission power was further obtained based on the Lambert W function [35].

3.
Finally, based on the Kuhn-Munkres [36] algorithm, a channel allocation scheme was designed to optimize the overall EE of D2D pairs through the power control results. The simulation results verified the theoretical analysis and demonstrated that the proposed algorithm obtained remarkable EE performance gains and performed better than existing algorithms.
The remaining parts of this paper are outlined as follows. Section 2 provides the system model and a detailed description of the objective function. Section 3 develops the power allocation algorithm based on the Lambert W function and the channel-matching algorithm based on the Kuhn-Munkres algorithm. Simulation results and future research directions are presented and discussed in Section 4. The conclusion is summarized in Section 5.

System Model and Problem Formulation
In this section, we first provide a detailed description of a one-to-one system model of the D2D communications underlaying cellular networks. Then, the formulation of the energy-efficient resource allocation problem is presented. The notation list in Appendix A summarizes the following main variables and parameters used in this study. Figure 1 shows a single-cell network model for frequency division duplex (FDD) communication, which jointly reuses uplink-downlink resources.

System Model
There are N CUs represented by set C = {C 1 , . . . , C n , . . . , C N }, and M D2D pairs represented by set D = {D 1 , . . . , D m , . . . , D M }. There are two kinds of communication in this scenario: (1) the traditional communication between the BS and the CUs, and (2) D2D direct communication. Each CU is assigned one orthogonal uplink channel and one orthogonal downlink channel. The D2D pairs reuse the CU's resources in an underlaying mode. Each D2D pair can only reuse at most one CU's resource, and each CU's resource can only be reused by at most one D2D pair. To reduce the complexity of the modulation and demodulation, each D2D pair can either reuse an uplink resource or downlink resource.
We denote f u n as the uplink resource and f d n as the downlink resource of the C n . The CUs do not interfere with each other since the uplink resources f u 1 , f u 2 , . . . , f u N and downlink resources f d 1 , f d 2 , . . . , f d N are orthogonal. As illustrated in Figure 1, the D2D user D 1 _Tx selects the uplink resource f u 1 and D 2 _Tx selects the downlink resource f d 2 , which aims at improving the overall EE of the D2D pairs. Therefore, the D2D user D 1 _Rx is interfered by the CUs, and the D2D user D 2 _Rx is interfered by the BS. Similarly, the CUs and BS also suffer from interferences, which are shown in Figure 1.
D2_Rx Figure 1. Device-to-device (D2D) communication in a one-to-one reusing scenario diagram.
Considering the effects of multipath fading and shadow fading, this study utilized the path loss model in Kaufman et al. [27], and the interference channel gain from n C to the D2D receiver of m D can be expressed as: where K represents the pathloss constant, β , n m represents the multipath fading parameter from n C to receiver of m D with an exponential distribution, λ , n m represents the shadow gain from n C to the receiver of m D with a log-normal distribution, , This study assumed that the four kinds of link information in the network can be obtained by the BS, including the link information between the CU and the BS, the link information between the D2D pair and the BS, the link information between the D2D pair and the other D2D pair, and the link information from the CU to the D2D pair. That is, the BS has the perception function of all link channel information. How the BS obtains the link information between users is not the focus of this study.

Problem Formulation
After formulating a one-to-one system model of the D2D communications, the problem to be solved is described as follows: when the admissible D2D pairs reuse uplink resources or downlink resources of the CUs in an underlaying mode, the problem involves maximizing the achievable EE of the D2D pairs while satisfying the transmission power and QoS constraints of the D2D pairs and CUs.
Based on the system model of Figure 1, we assumed that each admissible D2D pair can only reuse at most one CU's resource, and each CU's resource can only be reused by at most one D2D pair. First, we considered the scenario where D2D pairs reuse the uplink channel resources of the CUs. Considering the effects of multipath fading and shadow fading, this study utilized the path loss model in Kaufman et al. [27], and the interference channel gain from C n to the D2D receiver of D m can be expressed as: where K represents the pathloss constant, β n,m represents the multipath fading parameter from C n to receiver of D m with an exponential distribution, λ n,m represents the shadow gain from C n to the receiver of D m with a log-normal distribution, d n,m indicates the distance from C n to the receiver of D m , and α indicates the pathloss factor. Similarly, the channel gain of D m is expressed as g D m,m . The channel gain between C n and the BS is expressed as g C n,B . The interference channel gain from the D2D transmitter of D m to the BS is expressed as g D m,B . The interference channel gain from the BS to the D2D receiver of D m is expressed as g C B,m . The interference channel gain from the D2D transmitter of D m to C n is expressed as g D m,n .
This study assumed that the four kinds of link information in the network can be obtained by the BS, including the link information between the CU and the BS, the link information between the D2D pair and the BS, the link information between the D2D pair and the other D2D pair, and the link information from the CU to the D2D pair. That is, the BS has the perception function of all link channel information. How the BS obtains the link information between users is not the focus of this study.

Problem Formulation
After formulating a one-to-one system model of the D2D communications, the problem to be solved is described as follows: when the admissible D2D pairs reuse uplink resources or downlink resources of the CUs in an underlaying mode, the problem involves maximizing the achievable EE of the D2D pairs while satisfying the transmission power and QoS constraints of the D2D pairs and CUs.
Based on the system model of Figure 1, we assumed that each admissible D2D pair can only reuse at most one CU's resource, and each CU's resource can only be reused by at most one D2D pair. First, we considered the scenario where D2D pairs reuse the uplink channel resources of the CUs. The signal received by the BS includes not only the communication signal from CUs but also the interference signal from the D2D pairs. The received signal at the BS is expressed as: where p n and p u m represent the transmission power of C n and the transmission power of the D m reusing uplink channel, respectively. x n and y m represent the transmission signal of C n and the transmission signal of D m , respectively. ζ n represents the noise in each channel, which was assumed to be Gaussian white noise with a mean of zero and a power of δ 2 .
We defined binary variables χ u m,n that represent the scenario where the uplink channel resource f u n of C n is allocated to D m , and then we set χ u m,n = 1, otherwise χ u m,n = 0. When χ u m,n = 1, there is signal interference between two users' equipment and the expression of the signal-to-interference-plus-noise ratio (SINR) at the BS is as follows: When the D2D pair D m does not reuse the uplink channel resource f u n of C n , then χ u m,n = 0. Hence, the SINR at the BS reaches the maximum value, which is expressed as γ u n = p n g C n,B δ 2 . The received signal at the D2D pair D m contains three parts, which are the D2D communication signal, the interference signal from the CU, and the channel noise. Therefore, the received signal at the D2D pair D m is: y rx m = √ p n g C n,m x n + p u m g D m,m y m + ζ m .
Consequently, when the D2D pair D m reuses the uplink channel resource f u n of C n , the SINR at the receiver of the D2D pair is: Similarly, when the D2D pair D m reuses the downlink channel resource f d n of C n , we obtain that the SINR of the receiver of C n is γ d n and the SINR at the receiver of the D2D pair is γ d m . The expressions are respectively expressed as: where p B and p d m represent the transmission power of BS and the transmission power of the D m reusing downlink channel, respectively. χ d m,n represents the scenario where the downlink resource f d n of C n is allocated to D m , and then we set χ d m,n = 1, otherwise χ d m,n = 0. From Equations (5) and (7), the SE (defined as bits/s/Hz) of the D m reusing uplink channel of C n is: The SE of the D m reusing the downlink channel of C n is: Generally, the definition of EE (bits/J/Hz) is the ratio of total SE (bits/s/Hz) to the total energy consumption (W) [37], where the total SE of the D2D pairs is equal to the total SE of all the D2D pairs accessing the network. We set P 0 to represent the circuit power consumption of a single device. Therefore, the total energy consumption of the D2D pairs is equal to the total energy consumption of the devices, which is expressed as 2P 0 . The total EE of the D2D pairs can be expressed as: To maximize the EE of the D2D pairs while meeting the QoS requirements of the D2D pairs and CUs, the objective function of the optimization problem can be formulated as: where p max d , p max c , and p max B represent the maximum transmission power of the D2D pairs, CUs, and BS, respectively. ξ CUs min and ξ D2D min are the minimum SINR thresholds for the CUs and D2D pairs, respectively. In Equation (11), the transmission power (p n , p B , p d m , p u m ) and the binary variables of the channel allocation (χ u m,n , χ d m,n ) are the optimization variables. Meanwhile, the EE of the D2D pairs is the optimization goal. Inequalities (12) to (18) are the constraint conditions of this optimization problem, which specifies the QoS requirements of the D2D pairs and CUs. D A (D A ⊆ D) represents a set of admissible D2D pairs, which satisfies the QoS constraint conditions of the D2D pairs and CUs.
Constraints (12) and (13) indicate the constraints stating that at most one channel resource can be reused simultaneously by one admissible D2D pair and one CU. Furthermore, each D2D pair can either reuse a CU's uplink resource or downlink resource. Hence, each D2D pair will choose its reusing mode according to the EE of its different reusing mode. Constraints (14), (15), and (16) ensure that the power allocations of the CU, D2D pairs, and BS do not exceed their respective maximum allowed transmission power. Constraint (17) specifies the QoS requirement stating that the SINR of the CUs does not fall below minimum SINR thresholds. Similarly, Constraint (18) represents the minimum SINR requirement of the D2D pairs.
By observing the objective Equation (11), we found that the formulation can be considered an MINLP problem, which contains integer variables (χ u m,n , χ d m,n ). Thus, the formulation obtained is generally an unsolved NP-hard problem within polynomial time. To solve the MINLP problem, we converted the original problem into two sub-problems and solved it in a tractable manner. Sub-problem 1 aimed to maximize the EE of an individual D2D pair while jointly reusing uplink-downlink resources and guaranteeing the QoS requirements. Sub-problem 2 aimed at further optimizing the overall EE of the D2D pairs through channel allocation.

Resource Allocation Algorithm for Maximizing EE
In this section, we introduce the proposed two-layer energy-efficient approach. Taking into account reusing uplink-downlink resources, we decompose the original MINLP problem into two sub-problems: optimal power control and channel allocation. First, under the QoS constraints of the CUs and D2D pairs, the transmission power of each D2D pair and CU is derived based on the Lambert W function in Section 3.1. Then, taking advantage of the optimized power control results, the channel allocation scheme of the D2D pairs and CUs based on the Kuhn-Munkres algorithm is presented in Section 3.2.

Power Control
This subsection mainly focuses on the sub-problem of transmission power control, which aimed to maximize the EE of an individual D2D pair. When a single D2D pair reuses uplink or downlink channel resources, according to whether user equipment satisfies QoS requirements, the access state of the D2D pair is controlled. Based on the closed-form expression of the derived transmission power, the optimal transmission power of admissible D2D pairs for the reuse of uplink or downlink channel resources can be obtained.
First, we consider the scenario where D2D pairs reuse the uplink channel resources of the CUs in this subsection.
Combining Inequalities (17) and (18), we obtained the minimum power limit values of p u m and p n as follows: where p d th is the minimum power limit of p u m , and p c th is the minimum power limit of p n . By observing Equations (11) and (20), it can be concluded that the smaller the value of p n , the higher the EE. Therefore, when the maximum value of η ee is obtained, p n must be its minimum value * p n , which is expressed as: In the above equation, p c th < 0 states that the obtained minimum transmission power limit of the C n is less than 0, which is meaningless. Hence, * p n = 0 and the corresponding D2D pair D m is forbidden to be included in the uplink channel resource admissible set of C n . Similarly, p c th > p max c states that the minimum transmission power limit of the C n is higher than the maximum limit, which is also meaningless. Hence, * p n = 0 and the corresponding D2D pair D m is also forbidden to be included in the uplink channel resource admissible set of C n . Maximizing the EE of the D2D pairs must satisfy the QoS requirements of the CUs under the constraint conditions mentioned above. Otherwise, the solved * p n will be meaningless. When p n is obtained from Equation (21), it is a known constant. Therefore, the optimization variables of the problem are simplified to contain only p u m and χ u m,n . In this scenario, the D2D pairs do not interfere with each other since each CU's resource can only be reused by at most one D2D pair. Hence, the optimal transmission power for each D2D pair can be obtained first. Then, the channel allocation scheme of the D2D pairs and CUs can be further solved. Assuming that the D2D pair D m reuses the uplink channel resource of C n , the objective function of the optimization problem can be transformed into: Then, we set a variable Y as follows: Therefore, Equation (22) can be expressed as: The optimization variable of the above formula only includes p u m . We transformed the above formula as the function g(p u m ), which is given as: Proposition 1. The Lambert W function can be utilized to obtain the maximum value of the functiong(p u m ) at * p u m = θ 0 −1 Y . We give the value of θ 0 using Equation (26), where W indicates the Lambert W function: Proof. See Appendix B.
Combining Equation (26) and the maximum and minimum Constraints (15) and (19) of p u m , we obtain the optimal solution * p u m of the D2D pair transmission power, which is shown as follows in three different situations: 1.
When 0 < p d th ≤ p max d is established, we express the optimal solution of p u m as: 2.
When p d th ≤ 0 is established, we express the optimal solution of p u m as: 3.
When p d th > p max d is established, we prohibit the uplink channel resource admissible set of C n from including the corresponding D2D pair D m .
Consequently, according to Equations (21), (27), and (28), we obtained a solution to the transmission power control sub-problem when the D2D pairs reuse the uplink channel resources of the CUs. That is, the transmission power of C n is * p u m and the transmission power of the D2D pair D m is * p m u . Similarly, when the D2D pairs reuse the downlink channel resources of the CUs, we obtained the minimum power limit of p d m and p B as follows through combining Inequalities (17) and (18): where p d0 th is the minimum power limit of p d m , and p B th is the minimum power limit of p B . By observing Equations (11) and (30), it can be concluded that the smaller the value of p B , the higher the EE. Therefore, when the maximum value of η ee is obtained, p B must be its minimum value * p B , which is expressed by: Then, we set the variables Z and θ 1 as follows: Combining Equation (33) and the maximum and minimum Constraints (15) and (29) of p d m , we obtained the optimal solution * P d m of the D2D pair transmission power, which is shown as follows in three different situations: 1.
When 0 < p d0 th ≤ p max d is established, we express the optimal solution of p d m as: 2.
When p d0 th ≤ 0 is established, we express the optimal solution of p d m as: 3. When p d0 th > p max d is established, we prohibit the downlink channel resource admissible set of C n from including the corresponding D2D pair D m .
As a consequence, according to Equations (31), (34), and (35), we obtained a solution to the transmission power control sub-problem when the D2D pairs reuse the downlink channel resources of the CUs. That is, the transmission power of the BS corresponding to the D2D pair D m is * p B , and the transmission power of the D2D pair D m is * p d m . As mentioned above, to maximize the EE of the D2D pairs while satisfying the QoS, it is forbidden to include unqualified D2D pairs into the set of admissible channel resources. According to the transmission power allocation process of the CUs and D2D pairs in the network, D2D pairs that do not meet the requirements are composed of the following six categories: 1.
If p c th < 0, i.e., the minimum transmission power limit of C n is less than 0, this cannot meet the minimum SINR requirements of the CUs. The corresponding D2D pair D m is prevented from reusing the uplink channel resource of C n .

2.
If p B th < 0, i.e., the minimum transmission power limit of BS is less than 0, this cannot meet the minimum SINR requirement of the CUs. Similar to the previous category, the corresponding D2D pair D m is prevented from reusing the downlink channel resource of C n .

3.
If p c th > p max c , i.e., the minimum transmission power limit of C n is higher than the maximum limit, to meet the QoS requirements of the CUs within the maximum transmission power, the corresponding D2D pair D m is prevented from reusing the uplink channel resource of C n . 4.
If p B th > p max B , i.e., the minimum transmission power limit of BS is higher than the maximum limit, the corresponding D2D pair D m is prevented from reusing the downlink channel resource of C n , similar to the last category. 5.
If p d th > p max d , i.e., the minimum transmission power limit of D2D pair D m reusing uplink channel is higher than the maximum limit, the optimization process must be performed under the requirements of the minimum SINR and the maximum transmission power of the D2D pair D m . Otherwise, the optimization results will be meaningless. Therefore, the corresponding D2D pair D m is prevented from reusing the uplink channel resource of C n . 6.
If p d0 th > p max d , i.e., the minimum transmission power limit of D2D pair D m reusing downlink channel is higher than the maximum limit, the corresponding D2D pair D m is prevented from reusing the downlink channel resource of C n , similar to the previous category.

Channel Allocation
This section focuses on the second sub-problem. To maximize the overall EE of the D2D pairs, we utilized the Kuhn-Munkres algorithm to allocate channel resources to the D2D pairs that have been allocated power reasonably. Each D2D pair will choose its reusing mode according to the EE of its different reusing mode.
Combining the transmission power ( * p n , * p B , * p d m , * p u m ) obtained as the solution to sub-problem 1, the channel allocation problem can be expressed as Equations (36) and (37). The optimization objective was to maximize the achievable EE of the D2D pairs with the optimal value of the reusing mode (χ u m,n , χ d m,n ): In Equation (36), * R u m,n is the SE of the D2D pair D m reusing the uplink channel resource of C n : * R u m,n = log 2 (1 + * p u m g D m,m δ 2 + * p n g C n,m ), ∀D m ∈ D A , ∀C n ∈ C, while * R d m,n is the SE of the D2D pair D m reusing the downlink channel resource of C n : * R d m,n = log 2 (1 + * p d m g D m,m where D A represents a set of admissible D2D pairs and C represents a set of CUs. Based on either an uplink or downlink resource being assigned for reuse, the EE of the D2D pairs are calculated using the power control results, which are shown as follows: * η u m,n = log 2 ( * p u m Y + 1) where * η u m,n is the EE of the D2D pair D m reusing the uplink channel resource of C n and * η d m,n is the EE of the D2D pair D m reusing the downlink channel resource of C n . Therefore, * η u m,n and * η d m,n are used to represent the EE weights of the D2D pairs reusing the uplink and downlink channel resources, respectively. Based on Equation (36), we considered the channel allocation problem through a graph model and formulated it as a weighted bipartite-graph-matching problem in graph theory. The goal of optimizing the overall EE of the D2D pairs was transformed into maximizing the total weight of the constructed graph, namely the maximum weight-matching of the bipartite graph. The vertices in the graph denoted the CU's uplink-downlink resources and the D2D pairs, and the edge weights represented the EE weights of the D2D pairs when the CUs share their channels with D2D pairs. We built the D2D pair's EE matrix H based on the above graph model: When the D2D pair D m is allowed to reuse the resource of C n , they establish a connection and use * η u m,n or * η d m,n as the weight. The above matching problem can be solved using the Kuhn-Munkres algorithm in Edmonds and Karp [36], where the details are beyond the scope of this study. The computational complexity of the Kuhn-Munkres algorithm is o(N 3 ), which can solve the matching result of the entire network in polynomial time.
In summary, the resource allocation problem of the cellular and D2D hybrid network was decomposed into two sub-problems, namely optimal power control and channel allocation for the D2D pairs. First, to maximize the EE of each D2D pair while meeting the QoS requirements, the optimal transmission power of the D2D pairs reusing the uplink and downlink channel resources were respectively derived based on the Lambert W function. Then, to maximize the overall EE of the D2D pairs, a bipartite graph was constructed for the set of admissible D2D pairs and the corresponding CUs. The Kuhn-Munkres algorithm was used to obtain the channel-matching result.
Compared with existing algorithms, we provide a simple analysis of the tradeoff between the EE performance and computational complexity. In terms of power control, although the fixed transmission power allocation method used in Zulhasnine et al. [24] has lower computational complexity, it has lower flexibility and ignores the QoS requirements of the D2D pairs and CUs. The computational complexity of the power control method proposed in this study depends on the closed-form expression of the transmission power. While guaranteeing the SINR of the CUs, it effectively improves the EE performance of the D2D pairs.
In terms of channel allocation, the computational complexity of the heuristic channel allocation scheme in Zulhasnine et al. [24] is o(N 2 ). However, it was considered from the perspective of local optimization. Furthermore, it only briefly discusses the interference information between users and ignores the power collaboration between the D2D pairs and CUs. Based on game theory, the computational complexity of the channel allocation in References [30,31] is related to the number of iterations and the suboptimal solution or the optimal solution is ultimately obtained. The channel allocation proposed in this study can obtain the optimal channel-matching scheme through the Kuhn-Munkres algorithm with complexity o(N 3 ).
The resource allocation algorithm that combines the uplink-downlink channel resources is summarized in Algorithm 1.

Algorithm 1: Resource Allocation Algorithm That Combines the Uplink-Downlink Resources to Maximize Energy Efficiency
Step 1: Initialize 1: D A ⇐ D ; Step 2: Power Control 2: for C n ∈ C, D m ∈ D A do 3: Calculate the minimum transmission power limit of the CUs, D2D pairs, and BS according to Constraints (19), (20), (29), and (30); 4: Calculate the transmission power of the CUs and BS based on Equations (21) and (31); 5: Calculate the optimal transmission power of the D2D pairs reusing the uplink or downlink channel resources based on Equations (27) Prevent the D2D pair D m in the admissible set D A from reusing the downlink channel resource of C n ; 11: end if 12: end for Step 3: Channel Allocation 13: Obtain the channel allocation set X = χ u m,n , χ d m,n based on the Kuhn-Munkres algorithm.

Simulation Design
In this section, the EE of the system and the EE of the D2D pairs are selected as the algorithm performance evaluation indicators. The system EE refers to the sum of the EE, including all the D2D pairs' EEs and the CUs' EEs in the network. Since the power consumption of the BS, which is powered by external power, it is not considered in this study. The EE of the system is given by: where p n and p B indicate the transmission power of C n and the BS, respectively. N is the number of CUs. p u m and p d m indicate the transmission power of the D2D pair D m reusing the uplink channel and downlink channel, respectively. M is the number of D2D pairs. χ u m,n and χ d m,n are the identifiers of the resource reuse. R sum refers to the total sum of all CUs and D2D pairs accessing the network.
The algorithm proposed in this paper, labeled as "proposed" below, is compared with the following three algorithms.

1.
Heuristic algorithm reusing the uplink spectrum resources [24]: The basic principle of this algorithm is that the BS preferentially selects the cellular link with a high channel gain and the D2D communication link with the least interference to reuse the same channel. The algorithm consists of access control based on interference control, fixed power allocation, and heuristic channel allocation. This algorithm is feasible and straightforward, and the interference caused by the D2D link to the cellular link is small. However, the power between the D2D pairs and CUs are not considered for coordination; meanwhile, the algorithm is based on the assumption that only uplink resources can be shared. Therefore, the performance of D2D communication is not sufficiently improved. The algorithm is labeled "HeuristicOU."

2.
Heuristic algorithm reusing the downlink spectrum resources [24]: The principle of this algorithm is similar to the "HeuristicOU" algorithm, where the difference lies in the assumption that only downlink resources can be shared. The algorithm is labeled "HeuristicOD." 3.
Stable matching algorithm reusing the uplink spectrum resources [30]: This algorithm allocates optimal transmission power to the D2D pairs. Then, the channel gain ratio of the communication link and the interference link is defined as the sequence value of the user-matching preference. The Gale-Shapley algorithm is utilized to establish the preferences of each user equipment and complete the matching of the D2D pairs and CUs. This algorithm effectively improves the EE of the D2D pairs. However, it does not jointly reuse the uplink and downlink spectrum resources, and its channel-matching algorithm only obtains stable matching results. Therefore, the EE of the D2D pairs in the network could still be further improved. The algorithm is labeled "GaSaBa." Using the MATLAB platform (R2019b, developed by MathWorks), we assumed a single cell with a radius of 250 m, and the CUs and D2D pairs were distributed randomly in the cell. The average simulation result is based on 1000 iterations. The values of the simulation parameters were based on References [8,33] and are summarized in Table 1.  Figure 2 plots the total EE of the system versus L d and Figure 3 plots the EE of the D2D pairs versus L d , where M = 6 D2D pairs and N = 10 CUs. Although the EE of the four algorithms decreased with the increase of the communication distance, the system EE and the D2D pair's EE of the proposed algorithm were higher than those of the other three algorithms in the whole regime.
As L d increased, compared to the short-distance scenario, a higher transmission power was required to meet the same QoS requirements. However, increasing the transmission power brought about more interference and power consumption, resulting in an EE loss that could not be compensated for by the corresponding SE gain. Therefore, the EE decreased as the communication distance increased. The proposed algorithm and the GaSaBa algorithm allocated optimal transmission power to the D2D pairs based on maximizing EE, with the QoS constraints of both the CUs and D2D pairs in mind. Furthermore, the proposed algorithm jointly reused the uplink-downlink spectrum resources, and its channel allocation further maximized the EE of the D2D pairs. Hence, the EE performance was better than the other three algorithms. The HeuristicOU and HeuristicOD algorithms only reused the uplink or downlink spectrum resources with constant transmission power. Furthermore, since their channel matching algorithms were performed based on the channel gains, the SE losses increased when the channel gains decreased. For these reasons, the EE performance of the HeuristicOD algorithm, which was assigned the fixed transmission power of the BS, always performed the worst among the four algorithms.    As d L increased, compared to the short-distance scenario, a higher transmission power was required to meet the same QoS requirements. However, increasing the transmission power brought about more interference and power consumption, resulting in an EE loss that could not be compensated for by the corresponding SE gain. Therefore, the EE decreased as the communication distance increased. The proposed algorithm and the GaSaBa algorithm allocated optimal transmission power to the D2D pairs based on maximizing EE, with the QoS constraints of both the CUs and D2D pairs in mind. Furthermore, the proposed algorithm jointly reused the uplinkdownlink spectrum resources, and its channel allocation further maximized the EE of the D2D pairs. Hence, the EE performance was better than the other three algorithms. The HeuristicOU and HeuristicOD algorithms only reused the uplink or downlink spectrum resources with constant transmission power. Furthermore, since their channel matching algorithms were performed based on the channel gains, the SE losses increased when the channel gains decreased. For these reasons, the EE performance of the HeuristicOD algorithm, which was assigned the fixed transmission power of the BS, always performed the worst among the four algorithms.   Figure 4 plots the total EE of the system versus the number of D2D links and Figure 5 plots the EE of the D2D pairs versus the number of D2D links, where L d = 25 m and N = 10 CUs. The simulation results demonstrate that the system EE and D2D pair's EE of the proposed algorithm were higher than the other three algorithms. Figure 4 shows that the system EE using the four algorithms increased at different rates. As the number of D2D pairs increased, the number of reused CUs also increased. Hence, the EE of the CUs became higher, which in turn increased the EE of the system. The HeuristicOD algorithm had the slowest EE growth rate, and the HeuristicOU algorithm was slightly better. The reason for this was that the two algorithms transmitted data in a fixed power allocation mode, which limited the improvement of EE. The GaSaBa algorithm, which reused the uplink resources with a stable channel-matching approach, significantly reduced the system EE growth rate when the number of D2D links was close to the number of CUs. This was because, as the number of D2D links increased, each D2D pair found it more difficult to match with a better partner in a limited matching market. Therefore, the system EE could not be further maximized. Different from these three, the proposed algorithm jointly reused the uplink-downlink resources and obtained more available channel resources than the other three comparison algorithms. Hence, it could take full advantage of the increased total number of available orthogonal channels and exploit more benefits from the diversity of choices, thereby achieving a better EE performance.   Figure 5 shows that the EE of the D2D pairs when using each of the four algorithms decreased slightly as the number of D2D pairs increased, and the performance of the proposed algorithm decreased the slowest. The reason for this was that in the other three algorithms, as the number of D2D pairs increases, the number of available channel resources decreased. Hence, it was more difficult for the D2D pairs to match the channel resources of the lower-interference CUs. The proposed algorithm combined the uplink-downlink spectrum resources, guaranteeing the better stability of the EE of the D2D pairs as the number of D2D links increased. . As can be seen from Figure 6, the performance of the proposed algorithm was superior to the other three algorithms. With the increase of the threshold of the CUs' SINR, the D2D pair's EE of each of the four algorithms decreased. Because of the QoS constraints of the CUs, the performance of the D2D pair's SE was gradually sacrificed. Furthermore, the EE and SE performances    Figure 5 shows that the EE of the D2D pairs when using each of the four algorithms decreased slightly as the number of D2D pairs increased, and the performance of the proposed algorithm decreased the slowest. The reason for this was that in the other three algorithms, as the number of D2D pairs increases, the number of available channel resources decreased. Hence, it was more difficult for the D2D pairs to match the channel resources of the lower-interference CUs. The proposed algorithm combined the uplink-downlink spectrum resources, guaranteeing the better stability of the EE of the D2D pairs as the number of D2D links increased. . As can be seen from Figure 6, the performance of the proposed algorithm was superior to the other three algorithms. With the increase of the threshold of the CUs' SINR, the D2D pair's EE of each of the four algorithms decreased. Because of the QoS constraints of the CUs, the performance of the D2D pair's SE was gradually sacrificed. Furthermore, the EE and SE performances  Figure 5 shows that the EE of the D2D pairs when using each of the four algorithms decreased slightly as the number of D2D pairs increased, and the performance of the proposed algorithm decreased the slowest. The reason for this was that in the other three algorithms, as the number of D2D pairs increases, the number of available channel resources decreased. Hence, it was more difficult for the D2D pairs to match the channel resources of the lower-interference CUs. The proposed algorithm combined the uplink-downlink spectrum resources, guaranteeing the better stability of the EE of the D2D pairs as the number of D2D links increased. and L d = 25 m. As can be seen from Figure 6, the performance of the proposed algorithm was superior to the other three algorithms. With the increase of the threshold of the CUs' SINR, the D2D pair's EE of each of the four algorithms decreased. Because of the QoS constraints of the CUs, the performance of the D2D pair's SE was gradually sacrificed. Furthermore, the EE and SE performances of the HeuristicOD algorithm were the worst among the four algorithms due to the high fixed power allocation.  In Figure 7, we can see that with the increase of the threshold of the CU's SINR, the D2D pair's SE of the proposed algorithm was still higher than the other three algorithms. The SE of the HeuristicOU algorithm decreased rapidly and the SE of the other three algorithms decreased slowly. To guarantee the performance requirements of the CUs, the power allocation of the proposed algorithm was optimized under the premise of meeting the minimum SINR requirements of the CUs; therefore, the results of the optimization were partially affected by the threshold of the CU's SINR.

Effect of Threshold of the CUs SINR on System Performance
Through a comprehensive analysis of the above simulation results, the proposed algorithm achieved the best performance regarding the EE of the D2D pairs, the SE of the D2D pairs, and the EE of the system. The reason for this was that due to the uplink-downlink channel reuse, the proposed algorithm optimized the individual D2D's EE to obtain the optimal power allocation, which effectively improved the EE of the D2D pairs. Furthermore, the channel allocation algorithm was used to obtain optimal channel-resource matching, which maximized the achievable EE of the D2D pairs. The GaSaBa algorithm did not jointly reuse the uplink-downlink spectrum resources, and its channel matching algorithm only obtained stable matching results. Therefore, the performance of D2D pairs in the network could still be further improved. The other two algorithms, namely  In Figure 7, we can see that with the increase of the threshold of the CU's SINR, the D2D pair's SE of the proposed algorithm was still higher than the other three algorithms. The SE of the HeuristicOU algorithm decreased rapidly and the SE of the other three algorithms decreased slowly. To guarantee the performance requirements of the CUs, the power allocation of the proposed algorithm was optimized under the premise of meeting the minimum SINR requirements of the CUs; therefore, the results of the optimization were partially affected by the threshold of the CU's SINR.
Through a comprehensive analysis of the above simulation results, the proposed algorithm achieved the best performance regarding the EE of the D2D pairs, the SE of the D2D pairs, and the EE of the system. The reason for this was that due to the uplink-downlink channel reuse, the proposed algorithm optimized the individual D2D's EE to obtain the optimal power allocation, which effectively improved the EE of the D2D pairs. Furthermore, the channel allocation algorithm was used to obtain optimal channel-resource matching, which maximized the achievable EE of the D2D pairs. The GaSaBa algorithm did not jointly reuse the uplink-downlink spectrum resources, and its channel matching algorithm only obtained stable matching results. Therefore, the performance of D2D pairs in the network could still be further improved. The other two algorithms, namely In Figure 7, we can see that with the increase of the threshold of the CU's SINR, the D2D pair's SE of the proposed algorithm was still higher than the other three algorithms. The SE of the HeuristicOU algorithm decreased rapidly and the SE of the other three algorithms decreased slowly. To guarantee the performance requirements of the CUs, the power allocation of the proposed algorithm was optimized under the premise of meeting the minimum SINR requirements of the CUs; therefore, the results of the optimization were partially affected by the threshold of the CU's SINR.
Through a comprehensive analysis of the above simulation results, the proposed algorithm achieved the best performance regarding the EE of the D2D pairs, the SE of the D2D pairs, and the EE of the system. The reason for this was that due to the uplink-downlink channel reuse, the proposed algorithm optimized the individual D2D's EE to obtain the optimal power allocation, which effectively improved the EE of the D2D pairs. Furthermore, the channel allocation algorithm was used to obtain optimal channel-resource matching, which maximized the achievable EE of the D2D pairs. The GaSaBa algorithm did not jointly reuse the uplink-downlink spectrum resources, and its channel matching algorithm only obtained stable matching results. Therefore, the performance of D2D pairs in the network could still be further improved. The other two algorithms, namely HeuristicOU and HeuristicOD algorithms, only reused the uplink or downlink spectrum resources with constant transmission power. Moreover, the power between the D2D pairs and CUs were not considered for coordination, resulting in the performance of the D2D communication not being sufficiently improved. Therefore, the EE performance of these three algorithms was lower than the proposed algorithm. Moreover, the proposed algorithm provides an idea for research directions regarding resource allocation in green D2D communication. Future works include implementing many-to-one and many-to-many matching, and combining specific applications of the IoT.

Conclusions
In this paper, a two-layer, energy-efficient algorithm was proposed for the resource allocation problem in D2D communications. Taking into account reusing uplink-downlink resources, we formulated a one-to-one matching problem to maximize the achievable EE of the D2D pairs under maximum transmission power and QoS constraints. To solve the NP-hard problem, we divided the original problem into two sub-problems: power control and channel allocation. First, by satisfying the conditions of the minimum SINR of the CUs and D2D pairs, the closed-form expression of power allocation was solved through the Lambert W function. By assigning either an uplink or downlink resource to reuse, the EE of each D2D pair was calculated using the power control results. The channel allocation scheme based on the Kuhn-Munkres algorithm utilized EE weights to optimize the overall EE of the D2D pairs. Extensive simulation results showed that compared with the existing solutions, the proposed algorithm remarkably improved the system EE and the D2D pair's EE under the premise of ensuring the performance of the CUs. D2D transmitter of D 1 D 1 _Rx D2D receiver of D 1 g C n.m interference channel gain from C n to the D2D receiver of D m K pathloss constant β n,m multipath fading parameter from C n to the D2D receiver of D m λ n,m shadow gain from C n to the receiver of D m d n,m distance from C n to the receiver of D m α path loss factor Table A1. Cont.

Notations Variables and Parameters
g D m,m channel gain of D m g C n,B channel gain between C n and BS g D m,B interference channel gain from the D2D transmitter of D m to the BS g C B,m interference channel gain from the BS to the D2D receiver of D m g D m,n interference channel gain from the D2D transmitter of D m to C n z rx n received signal at the BS

Appendix B
According to Equations (23) and (25), we set θ = p u m Y + 1, where it can be seen that θ > 1; furthermore, p u m = θ−1 Y . Therefore, we transformed Equation (25) into the function g(θ) given as: We evaluated the derivative of the variable θ in Equation (A1) to obtain the expression (A2).
Then, we let f (θ = θ 0 )= 0, i.e., Equation (A3) as follows: Then, Equation (A3) is transformed into θ 0 (ln θ 0 − 1) = 2P 0 Y − 1, which is equivalent to the following Equation (A4): Due to 2P 0 Y > 0, the right side of the equality 2P 0 Y−1 e > −1 is established, which meets the requirements of the Lambert W function. As a result, through the Lambert W function, we obtained the specific value θ 0 represented by the following expression: Equation (A5) is also shown in Equation (26) and the optimal solution * p u m = θ 0 −1 Y of the function g(p u m ) can be further obtained. At this point, we have completed the proof.