# Resource Allocation Algorithm for NOMA-Enhanced D2D Communications with Energy Harvesting

Authors: Na Su; Qi Zhu; Ying Wang
Journal: Mobile Information Systems
 (2020)

---

## Abstract

In this work, we propose a channel allocation and power control algorithm for energy harvesting (EH) device-to-device (D2D) communication based on nonorthogonal multiple access (NOMA). The algorithm considers users’ quality of service (QoS) and energy causality constraint to maximize the total capacity of D2D groups. The optimal offline allocation of channel and power is realized firstly. Then, the offline optimization results are taken as the training dataset to train the neural network to obtain the optimal model of the transmission power. The online power allocation optimization algorithm is further proposed. Simulation results show that the offline algorithm can improve the total capacity of D2D groups, and the performance of the online algorithm is close to the offline algorithm.


---

## Body

## 1. Introduction

Device-to-device (D2D) communications can establish direct communication links between adjacent users without passing through base station (BS) or other core networks [1]. It can reduce traffic loads of the BS and the transmission power of D2D users [2]. Nonorthogonal multiple access (NOMA) technology allows a transmitter to send multiple signals at the same frequency through power superposition, which can improve spectrum efficiency. Combining D2D communication with NOMA technology is better for future network deployments and allows more users to connect to the network.The D2D communication based on NOMA has attracted researchers’ attention recently. In [3], authors analyze the ergodic capacity of the system, where D2D users communicate while act as relays to forward the information of the BS, and NOMA technology is adopted in two phases of the information transmission. In [4], the BS sends information to multiple cellular users through NOMA technology. The total rate of D2D users is maximized under the minimum rate requirement of cellular users. Authors in [5] analyze the rate of D2D users when NOMA technology is used to transmit information, and propose a channel allocation algorithm to maximize the total rate of the system. A NOMA-enhanced D2D communication system is considered in [6], and the subchannel and power allocation is optimized to maximize the system sum rate. The above papers do not consider the energy supply of D2D user and implicitly assume that the energy of D2D transmitter (DT) is infinite. However, the energy of DTs is limited or needs to be charged. Therefore, the assumption of infinite energy is not always consistent with reality [7].Energy harvesting (EH) technology can solve the energy supply problem of low-energy consumption users and realize green communication [8]. Users can harvest energy by wireless power transfer or from the surrounding environments. Authors in [9–13] investigate the resource allocation issue when D2D transmitters harvest energy by wireless power transfer. However, when the distance between the users and the power station is far, the method of wireless power transfer will lead to serious energy waste due to the path loss.In [14–17], the D2D users harvest energy from the surrounding environments. Authors in [14] utilize the Pareto-optimal boundary and a subcarrier allocation method to allocate power and channel for D2D users under the energy causality constraint and battery overflow constraint. Many-to-many matching problem between cellular users and D2D users is investigated in [15], and the transmission power of D2D users and transmission time are optimized under the energy harvesting constraint. In [16], authors propose a low-complexity energy-aware space matching method to solve the channel and power allocation problems. In [17], an iterative algorithm based on Dinkelbach and Lagrangian constraint optimization is proposed to maximize the average energy efficiency of D2D users. However, authors [14–17] assume that the full system information is available before the transmission process and propose the offline algorithm. Actually, there is no prior knowledge about the harvested energy and the system information. Authors in [18] assume that the harvested energy is causally known and propose an offline joint power control and channel allocation algorithm, and the online transmission power is allocated by using the dynamic programming method. However, due to the high complexity of the online algorithm in [18], the online transmission power cannot be obtained instantaneously while the harvested energy changes.In order to quickly determine the online transmission power, this paper uses a neural network for online power allocation. This is because the neural network is a nonlinear, adaptive information processing system composed of a large number of interconnection processing units, which has the ability to find optimal solutions at a high speed. Assume the DTs can harvest energy from the surroundings and send the superposed signal to multiple D2D receivers (DRs) with NOMA technology by reusing cellular users’ downlink links. The main contributions of this paper are as follows:(1)
In order to optimize the online transmission power of DTs, firstly, the offline transmission power is optimized based on Lagrange constrained optimization by considering the QoS of users and energy causality constraint, and the offline channel allocation and power control algorithm is proposed.(2)
An online power allocation optimization algorithm is proposed with causal system information. The optimal transmission power of the offline power allocation algorithm and the system parameters affecting the transmission power are taken as the training data to train the neural network. Thereby, the optimal online transmission power can be obtained by the neural network model.(3)
The simulation results demonstrate that the proposed resource algorithm can improve the total capacity of D2D groups compared with the algorithm in [18]. In addition, the performance of the online power allocation optimization algorithm is close to the offline power allocation optimization algorithm.The rest of this paper is organized as follows. The system model and EH model are described in Section2. Then, in Section 3, we establish the optimization problem model and solve the optimization problem. We also propose the offline channel allocation and power control algorithm, as well as the online power allocation optimization algorithm. Simulation results are provided and analyzed in Section 4 to show the performance of the proposed algorithm. Finally, conclusions are drawn in Section 5.


## 2. System Model

We consider a hybrid single-cell scenario, as illustrated in Figure1, which contains a BS located in the center of the cell, M cellular users, and N D2D groups. Each D2D group includes one DT and two DRs, the receivers in each D2D group are randomly distributed within a circle with radius Rd, and the center of the circle is the corresponding transmitter. We use CU=CU1,CU2,…,CUm,…,CUM and D=D1,D2,…,Dn,…,DN to indicate the sets of cellular users and D2D groups, where CUm and Dn represent the cellular user m and D2D group n, respectively. The cellular users occupy orthogonal downlink channels for traditional cellular communication with the BS. Different from traditional D2D communication, in each D2D group, DT can use NOMA transmission mechanism to send messages to both DRs at the same time. Each D2D group multiplexes a cellular user’s channel for communication, and each channel can be multiplexed by at most one D2D group.Figure 1
System model of downlink sharing between cellular users and D2D groups.We assume that the DTs can harvest energy from the surrounding environment everyτe seconds. That is, the time instants of energy arrival are 0,τe,…,kτe,…, and the harvested energy obeys uniform distribution in [0, Emax]. The time interval between two consecutive energy arrival instants is termed as an epoch [18]. The energy arrives at the beginning of an epoch instantaneously and is stored in the user’s battery for later information transmission. The capacity of the battery is much larger than the harvested energy, that is, the capacity limitation of the battery is not taken into account. The storage and retrieval of the energy from the battery is assumed to be lossless [14]. Supposing the energy arrives K times in the total transmission time T. Then, the number of epoch is K.In order to distinguish the two receivers in the same D2D group, we assumehn,1 < hn,2, where hn,1 (hn,2) is the channel gain between the 1st (2nd) receiver and transmitter in Dn. According to NOMA protocol, the transmission power for 1st receiver is bigger than the transmission power for 2nd receiver. The receiver uses the successive interference cancellation (SIC) technology to detect signals. The basic principle of SIC technology is to gradually eliminate the influence of maximum signal power users. That is, 1st receiver directly decodes its own signal sn,1 from the received superposed signal, and 2nd receiver first decodes the signal of 1st receiver and removes it and then decodes its own signal sn,2 [19].WhenDn multiplexes the channel of CUm, the signal-to-interference-plus-noise-ratio (SINR) of CUm in epoch k is given by(1)SINRmn,kc=PBShBmPnm,kdhnm+σ2.The SINR of the weaker receiver 1 inDn in epoch k is as follows:(2)SINRnm,k1=Pnm,kdanm,k1hn,1PBShBn,1+Pnm,kd1−anm,k1hn,1+σ2.The SINR of the stronger receiver 2 inDn in epoch k is as follows:(3)SINRnm,k2=Pnm,kd1−anm,k1hn,2PBShBn,2+σ2.The capacity ofDn in epoch k is given by(4)Cnm,kd=τe⋅log1+SINRnm,k1+log1+SINRnm,k2,where PBS and Pnm,kd are, respectively, the transmission powers of the BS and the DTn, hBm is the channel gain between the BS and the CUm, hnm is the channel gain between the DTn and the CUm sharing the same channel, hBn,1 (hBn,2) is the channel gain between the BS and 1st (2nd) receiver in Dn, anm,k1 represents the power allocation factor of signal sn,1 in Dn, and σ2 represents the spectral density of additive white Gaussian noise.


## 3. Resource Allocation Algorithm for NOMA-Enhanced D2D Communication with EH

In this section, we analyze the optimal channel matching between cellular users and D2D groups, the optimal transmission power of DTs, and the power allocation scheme of stronger and weaker receivers in the D2D group. Taking the QoS demands and the limited transmission power of DTs into consideration to maximize the total capacity of D2D groups, the optimization problem (P1) is established as follows:(5)P1:maxPnm,kd,anm,k1,xnmCD2D=∑n=1N∑k=1K∑m=1Mxnm⋅Cnm,kd,(6)s.t.SINRmn,kc≥rcth,(7)SINRnm,k1≥rdth,(8)SINRnm,k2≥rdth,(9)∑k=1tτePnm,kd≤∑k=1tEn,k,∀t∈K,(10)Pnm,kd≤Pmaxd,(11)xnm∈0,1,∑nxnm≤1,∑mxnm≤1,(12)0.5<anm,k1<1,where xnm is the channel reuse indicator of the D2D group, xnm = 1 means that the Dn reuses the channel of CUm; otherwise, it does not reuse. rcth and rdth represent the minimum SINR threshold of the cellular users and DRs, respectively, En,k represents the harvested energy of DTn at epoch k, and Pmaxdrepresents the maximum transmit power of DTs. Equation (5) is the objective function of maximizing the total capacity of D2D groups. Equation (6) guarantees the QoS requirements of cellular users. Equations (7) and (8) guarantee the QoS requirements of two DRs. Equation (9) is the energy causality constraint and means that the consumed energy for transmitting signals cannot exceed its harvested energy. Equation (10) indicates the limited transmission power of the DTs. Equation (11) represents that one D2D group can reuse at most one channel and one channel of a cellular user can be reused by at most one D2D group, and equation (12) represents that the power allocated to the weaker receiver is bigger than the stronger receiver but smaller than the total power of DTn.The optimization problemP1 is a mixed-integer nonlinear programming problem, which is NP-hard problem [20], and the algorithm for finding the exact solution of this problem has exponential complexity. Therefore, we decompose the optimization problem P1 into three subproblems. The first subproblem optimizes the power allocation factor of DRs. The second subproblem uses Kuhn–Munkres (KM) algorithm to allocate channels for D2D groups with the goal of maximizing the total capacity of D2D groups. The third subproblem optimizes the transmission power of DTs under the limitations of harvested energy and the maximum transmission power.


### 3.1. Offline Channel Allocation and Power Control Algorithm

#### 3.1.1. Optimization of Power Allocation Factor

There is no interference between D2D groups, so the maximum capacity of a single D2D group inK epochs can be firstly solved. When Dn reuses the channel of CUm, and the transmission power of D2D user is fixed, the optimal power allocation factor of two receivers in the D2D group is calculated to maximize the capacity of Dn. When Dn multiplexes the channel of CUm, the total capacity of Dn in K time periods is given by(13)Cn,md=∑k=1Kτe⋅log1+Pnm,kdA5Pnm,kdA3+A1+log1+Pnm,kdA4A2,where A1=PBShBn,1+σ2, A2=PBShBn,2+σ2, A3=1−anm,k1hn,1, A4=1−anm,k1hn,2, and A5=anm,k1hn,1.From equations (7) and (8), we can obtain the following equation:(14)anm,k1≥rdthPnm,kdhn,1+A1Pnm,kdhn,11+rdth,(15)anm,k1≤Pnm,kdhn,2−rdthA2Pnm,kdhn,2.The Lagrange function of (13) with respect to equations (14) and (15) is formulated as follows:(16)Lanm,k1=Cn,mdPnm,kd,anm,k1−λ1rdthPnm,kdhn,1+A1Pnm,kdhn,11+rdth−anm,k1−λ2anm,k1−Pnm,kdhn,2−rdthA2Pnm,kdhn,2,where λ1 and λ2 are the Lagrange multipliers associated with the constraints of equations (14) and (15). The Karush–Kuhn–Tucker condition of equation (16) with respect to power allocation factor anm,k1 can be expressed as follows:(17)∂Lanm,k1∂anm,k1=τePnm,kdψnmln2⋅Pnm,kdA3+A1Pnm,kdA4+A2+λ1−λ2=0,(18)λ1rdthPnm,kdhn,1+A1Pnm,kdhn,11+rdth−anm,k1=0,(19)λ2anm,k1−Pnm,kdhn,2−rdthA2Pnm,kdhn,2=0,(20)rdthPnm,kdhn,1+A1Pnm,kdhn,11+rdth−anm,k1≤0,(21)anm,k1−Pnm,kdhn,2−rdthA2Pnm,kdhn,2≤0,(22)λ1≥0,λ2≥0,where ψnm=σ2hn,1−hn,2+PBShn,1hBn,1−hn,2hBn,2. As whether hBn,1 or hBn,2 is bigger is unknown, so whether ψnm is positive or negative is unknown. The first item of equation (17) is the first-order partial derivatives of Cn,md with anm,k1, if ψnm>0, Cn,md is a monotone increasing function of anm,k1, so the power is allocated to 1st receiver as much as possible under the condition of satisfying the SINR of 2nd receiver. In this case, from equations (18) and (19), we can know λ1 = 0 and λ2 > 0, and the power allocation factor of 1st receiver can be obtained from equation (21) as follows:(23)anm,k1=Pnm,kdhn,2−rdthA2Pnm,kdhn,2,when ψnm<0, Cn,md is a monotone decreasing function of anm,k1, so the power is allocated to 2nd receiver as much as possible under the condition that satisfying the SINR of 1st receiver. In this case, from equations (18) and (19), we know λ1 > 0 and λ2 = 0, and the power allocation factor of 1st receiver can be obtained from equation (20) as follows:(24)anm,k1=rdthPnm,kdhn,1+A1Pnm,kdhn,11+rdth.


#### 3.1.2. Optimization of Channel Allocation

Considering the objective function (5) and the constraints (6) and (11), the channel allocation optimization problem can be regarded as the optimum matching problem of two weighted bipartite graphs. As shown in Figure 2, D2D group set and cellular user set, respectively, represent two mutually disjointed vertex sets in the bipartite graph. If Dn multiplexes the channel of CUm, vertex n will be connected with vertex m by a line. The weight value on the connecting line is Cn,md, which represents the capacity of Dn when it reuses the channel of CUm.Figure 2
Weighted bipartite graph for matching problem of D2D groups and cellular users’ channels.KM algorithm is an effective binary matching algorithm, and the maximum weight matching problem can be transformed into the complete matching problem by giving each vertex a label [21]. Therefore, we use KM algorithm to allocate channels for D2D groups. The detailed steps are shown as follows:(1)
Initialize the cellular user set CU, the D2D group setD, and the candidate cellular user set of D2D groups Ω=Ω1,…,Ωn,…,ΩN=Φ.(2)
For each D2D groupDn∈D and each cellular user CUm∈CU, calculate the SINRmnc with equation (1).(3)
IfSINRmnc≥rcth, put CUm into Ωn: Ωn=Ωn∪CUm, calculate the optimal anm,k1 with equations (23) or (24), and calculate Cn,md with equation (13). Else, Cn,md=0.(4)
TakeCn,md as the weight of Dn and CUm, use the KM algorithm [21] to achieve the optimal matching of D2D groups and cellular users’ channels, and the channel allocation matrix X is obtained.(5)
If the candidate cellular user set ofDn is Ωn=0, there is no channel of cellular user that can be reused by Dn, that is, for any m, xnm = 0.(6)
Update theX, and end of the algorithm.


#### 3.1.3. Optimization of the DTs’ Power

In the previous section, we have assigned the channels to D2D groups. Assuming thatDn multiplexes channel of CUm, and the subproblem of optimization problem P1 regarding the transmission power of Dn in K epochs is given by(25)maxPnm,kdCn,md=∑k=1Kτelog1+Pnm,kdA5Pnm,kdA3+A1+log1+Pnm,kdA4A2s.t.9,10.The first partial derivative of equation (25) with Pnm,kd is as follows:(26)∂Cn,mdPnm,kd∂Pnm,kd=A5A1ln2⋅Pnm,kdhn,1+A1Pnm,kdA3+A1+A4ln2⋅Pnm,kdA4+A2.All parameters in equation (26) are positive, so the objective function is a monotonically increasing function in the feasible domain. In order to maximize Cn,md, all the energy harvested in K epochs should be used up. When the maximum value is obtained, the following theorem is applied.Theorem 1.
When the maximum value ofCn,md is obtained, the transmission power of DTn in the epoch k (1≤ k < K) is no more than the transmission power in the next epoch. That is, the transmission power of Dn satisfies Pnm,kd≤Pnm,k+1d for any epoch k (1≤ k < K).The proof is provided in Appendix.According to Theorem1 and the optimization results of power allocation factor and channel allocation, an offline channel allocation and power control algorithm is proposed. The detailed steps are summarized in Algorithm 1.Algorithm 1:Offline channel allocation and power control algorithm.
Input: the number of epoch K, the length of epoch τe, and the maximum number of iterations Titer, hn,1, hn,2, hBn,1, hBn,2, En,k, Pmaxd, PBS, rdth, rcth, and σ2.
Output: the channel allocation matrix X, the offline transmission power Pnm,kd∗, and the power allocation factor anm,k1∗.
(1)
Initialization: tnm = 1, Pnm,kd=En,k/τe.
(2)
Allocate channel for D2D groups, and obtain the channel allocation matrixX.
(3)
For
n = 1 : N
(4)
whiletnm < Titer
(5)
Fork = 1 : K
(6)
IfPnm,kd>Pnm,k+1d
(7)
Pnm,kd=Pnm,kd+Pnm,k+1d/2;
(8)
Pnm,k+1d=Pnm,kd;
(9)
End if
(10)
End for
(11)
tnm = tnm + 1;
(12)
End while
(13)
Fork = 1 : K
(14)
Pnm,kd∗=minPnm,kd,Pmaxd;
(15)
End for
(16)
Calculateanm,k1∗ with equation (20) or (21);
(17)
End for


### 3.2. Online Power Allocation Optimization Algorithm

In Section3.1, we assume that the energy distribution of all epochs is known before the signal transmission. The offline optimal transmission power of DTs and the offline power allocation factor of the two receivers in the D2D group are obtained. However, in real scenario, only the energy harvested in this epoch and before this epoch is known in epoch k, and the energy distribution after epoch k is unknown. In this section, an online power allocation optimization algorithm is proposed, that is, the neural network is used to optimize the transmission power of DTs. Then, the power allocation factors of the two receivers in the D2D group are obtained.Neural network simulates the working method of the human brain, which has strong adaptability and learning ability. Supervised neural networks require training dataset composed of a large number of known input vector and the corresponding output vector. A nonlinear mapping relation between input vector and output vector is obtained through learning. After completion of neural network learning, the corresponding output vector can be calculated according to the mathematical model of the neural network when input an input vector. Since the harvested energy after epochk is unknown, it cannot be decided whether to store energy for later epoch to maximize the capacity of D2D groups in the total transmission time T. By learning the training dataset of offline optimization algorithm, the neural network can get the mathematical model between the input vector and the transmission power. Then, the online optimal transmission power Pnm,kd,on∗ can be obtained with only the information of the system parameters of epoch k.The model of the neural network adopts the multilayer feedforward network. It is supervised learning and composed of input layer, hidden layer, and output layer. In the training process, the error between the output generated by the neural network and the actual output is calculated. Meanwhile, the error is minimized by adjusting the weight vector of the neural network [22]. In this paper, mean-square error (MSE) is minimized:(27)MSE=1Q∑q=1Qyq−tq2,where Q represents epoch, y(q) represents the output of the neural network, and t(q) is the actual output.When some parameters of minimum mean square error, maximum iteration epoch, minimum gradient, and maximum confirmation failure times reach the set value, the training process ends.In this paper, a two-layer feedforward network is considered. That is, the number of hidden layers is one, due to the fact that the neural network with a single hidden layer is sufficient to approximate any function and any given precision [23]. There are four back propagation (BP) algorithms for training neural network in Matlab neural network toolbox, namely, resilient BP algorithm (trainrp), conjugate gradient BP algorithm (traincgf), gradient descent BP algorithm (traingd), and Levenberg–Marquardt BP algorithm (trainlm). Considering the convergence epoch, convergence time, and MSE of training neural network, trainlm algorithm is selected to train the neural network after testing. The performance of different training algorithms is presented in Table 1.Table 1
Performance of different training algorithms.
Training algorithm
Epoch
Convergence time (s)
MSE
trainrp
271
17
0.000143
traincgf
286
70
0.000135
traingd
1500
102
0.000819
trainlm
38
12
0.000134In addition, when trainlm algorithm is adopted to train the neural network, considering the MSE and complexity of neural network structure, the number of hidden layer neurons is set to 4 after testing. Figure3 shows the variation of MSE with the number of hidden layer neurons.Figure 3
MSE varies with the number of hidden layer neurons.The specific structure of the neural network is shown in Figure4. The input vector is composed of hn,1, hn,2, hBn,1, hBn,2, En,ksum, En,kcons, and En,k, and the output is online transmission power Pnm,kd,on∗, where En,ksum=∑t=1k−1En,t represents the total energy harvested in the k − 1 epochs before epoch k and En,kcons=∑t=1k−1τePnm,td∗ represents the total energy consumed in the k − 1 epochs before epoch k. Before training, the input parameters are normalized. Normalization can ensure that each input parameter provides the same influence in the neural network and can make the training process more stable and the convergence speed faster.Figure 4
Two-layer feedforward neural network model.When offline power allocation is carried out by Algorithm1, input vectors and output vectors required to train the neural network can be obtained. Through training neural network, an optimization model to maximize the total capacity of D2D groups is obtained. The online transmission power of the current epoch can be determined by the optimization model. The online power allocation optimization algorithm is shown in Algorithm 2.Algorithm 2:Online power allocation optimization algorithm.
Input: the channel allocation matrix X, the number of epoch K, the length of epoch τe, hn,1, hn,2, hBn,1, hBn,2, the harvested energy En,k, Pmaxd, PBS, rdth, and σ2.
Output: the online transmission power Pnm,kd,on∗ and the power allocation factor anm,k1,on∗.
(1)
Initialization: k = 1, Sn,1e=En,1, En,1sum=0, En,1cons=0.
(2)
For
m = 1 : M
(3)
n = find(X(:, m) == 1);
(4)
whilek ≤ K
(5)
Input the input vector to the neural network to obtainPnm,kd,on∗;
(6)
Pnm,kd,on∗=minminPmaxd,Pnm,kd,on,Sn,ke/τe;
(7)
Calculateanm,k1,on∗ with equation (20) or (21);
(8)
k = k + 1;
(9)
En,kcons=En,k−1cons+τe⋅Pnm,k−1d,on∗;
(10)
Sn,ke=Sn,k−1e−τe⋅Pnm,kd,on∗+En,k;
(11)
End while
(12)
End forAccording to Algorithm2, the complexity of the online power allocation optimization algorithm is O(LK), where L = min(N, M) represents the number of D2D groups for D2D communication and K represents the total number of epochs. In [18], the power allocation algorithm uses Bisection search method to optimize Lagrange multipliers in two nested loops. Thereby, the complexity is O(LK logn), where n represents the product of the number of elements in the two dichotomy intervals.


## 3.1. Offline Channel Allocation and Power Control Algorithm

### 3.1.1. Optimization of Power Allocation Factor

There is no interference between D2D groups, so the maximum capacity of a single D2D group inK epochs can be firstly solved. When Dn reuses the channel of CUm, and the transmission power of D2D user is fixed, the optimal power allocation factor of two receivers in the D2D group is calculated to maximize the capacity of Dn. When Dn multiplexes the channel of CUm, the total capacity of Dn in K time periods is given by(13)Cn,md=∑k=1Kτe⋅log1+Pnm,kdA5Pnm,kdA3+A1+log1+Pnm,kdA4A2,where A1=PBShBn,1+σ2, A2=PBShBn,2+σ2, A3=1−anm,k1hn,1, A4=1−anm,k1hn,2, and A5=anm,k1hn,1.From equations (7) and (8), we can obtain the following equation:(14)anm,k1≥rdthPnm,kdhn,1+A1Pnm,kdhn,11+rdth,(15)anm,k1≤Pnm,kdhn,2−rdthA2Pnm,kdhn,2.The Lagrange function of (13) with respect to equations (14) and (15) is formulated as follows:(16)Lanm,k1=Cn,mdPnm,kd,anm,k1−λ1rdthPnm,kdhn,1+A1Pnm,kdhn,11+rdth−anm,k1−λ2anm,k1−Pnm,kdhn,2−rdthA2Pnm,kdhn,2,where λ1 and λ2 are the Lagrange multipliers associated with the constraints of equations (14) and (15). The Karush–Kuhn–Tucker condition of equation (16) with respect to power allocation factor anm,k1 can be expressed as follows:(17)∂Lanm,k1∂anm,k1=τePnm,kdψnmln2⋅Pnm,kdA3+A1Pnm,kdA4+A2+λ1−λ2=0,(18)λ1rdthPnm,kdhn,1+A1Pnm,kdhn,11+rdth−anm,k1=0,(19)λ2anm,k1−Pnm,kdhn,2−rdthA2Pnm,kdhn,2=0,(20)rdthPnm,kdhn,1+A1Pnm,kdhn,11+rdth−anm,k1≤0,(21)anm,k1−Pnm,kdhn,2−rdthA2Pnm,kdhn,2≤0,(22)λ1≥0,λ2≥0,where ψnm=σ2hn,1−hn,2+PBShn,1hBn,1−hn,2hBn,2. As whether hBn,1 or hBn,2 is bigger is unknown, so whether ψnm is positive or negative is unknown. The first item of equation (17) is the first-order partial derivatives of Cn,md with anm,k1, if ψnm>0, Cn,md is a monotone increasing function of anm,k1, so the power is allocated to 1st receiver as much as possible under the condition of satisfying the SINR of 2nd receiver. In this case, from equations (18) and (19), we can know λ1 = 0 and λ2 > 0, and the power allocation factor of 1st receiver can be obtained from equation (21) as follows:(23)anm,k1=Pnm,kdhn,2−rdthA2Pnm,kdhn,2,when ψnm<0, Cn,md is a monotone decreasing function of anm,k1, so the power is allocated to 2nd receiver as much as possible under the condition that satisfying the SINR of 1st receiver. In this case, from equations (18) and (19), we know λ1 > 0 and λ2 = 0, and the power allocation factor of 1st receiver can be obtained from equation (20) as follows:(24)anm,k1=rdthPnm,kdhn,1+A1Pnm,kdhn,11+rdth.


### 3.1.2. Optimization of Channel Allocation

Considering the objective function (5) and the constraints (6) and (11), the channel allocation optimization problem can be regarded as the optimum matching problem of two weighted bipartite graphs. As shown in Figure 2, D2D group set and cellular user set, respectively, represent two mutually disjointed vertex sets in the bipartite graph. If Dn multiplexes the channel of CUm, vertex n will be connected with vertex m by a line. The weight value on the connecting line is Cn,md, which represents the capacity of Dn when it reuses the channel of CUm.Figure 2
Weighted bipartite graph for matching problem of D2D groups and cellular users’ channels.KM algorithm is an effective binary matching algorithm, and the maximum weight matching problem can be transformed into the complete matching problem by giving each vertex a label [21]. Therefore, we use KM algorithm to allocate channels for D2D groups. The detailed steps are shown as follows:(1)
Initialize the cellular user set CU, the D2D group setD, and the candidate cellular user set of D2D groups Ω=Ω1,…,Ωn,…,ΩN=Φ.(2)
For each D2D groupDn∈D and each cellular user CUm∈CU, calculate the SINRmnc with equation (1).(3)
IfSINRmnc≥rcth, put CUm into Ωn: Ωn=Ωn∪CUm, calculate the optimal anm,k1 with equations (23) or (24), and calculate Cn,md with equation (13). Else, Cn,md=0.(4)
TakeCn,md as the weight of Dn and CUm, use the KM algorithm [21] to achieve the optimal matching of D2D groups and cellular users’ channels, and the channel allocation matrix X is obtained.(5)
If the candidate cellular user set ofDn is Ωn=0, there is no channel of cellular user that can be reused by Dn, that is, for any m, xnm = 0.(6)
Update theX, and end of the algorithm.


### 3.1.3. Optimization of the DTs’ Power

In the previous section, we have assigned the channels to D2D groups. Assuming thatDn multiplexes channel of CUm, and the subproblem of optimization problem P1 regarding the transmission power of Dn in K epochs is given by(25)maxPnm,kdCn,md=∑k=1Kτelog1+Pnm,kdA5Pnm,kdA3+A1+log1+Pnm,kdA4A2s.t.9,10.The first partial derivative of equation (25) with Pnm,kd is as follows:(26)∂Cn,mdPnm,kd∂Pnm,kd=A5A1ln2⋅Pnm,kdhn,1+A1Pnm,kdA3+A1+A4ln2⋅Pnm,kdA4+A2.All parameters in equation (26) are positive, so the objective function is a monotonically increasing function in the feasible domain. In order to maximize Cn,md, all the energy harvested in K epochs should be used up. When the maximum value is obtained, the following theorem is applied.Theorem 1.
When the maximum value ofCn,md is obtained, the transmission power of DTn in the epoch k (1≤ k < K) is no more than the transmission power in the next epoch. That is, the transmission power of Dn satisfies Pnm,kd≤Pnm,k+1d for any epoch k (1≤ k < K).The proof is provided in Appendix.According to Theorem1 and the optimization results of power allocation factor and channel allocation, an offline channel allocation and power control algorithm is proposed. The detailed steps are summarized in Algorithm 1.Algorithm 1:Offline channel allocation and power control algorithm.
Input: the number of epoch K, the length of epoch τe, and the maximum number of iterations Titer, hn,1, hn,2, hBn,1, hBn,2, En,k, Pmaxd, PBS, rdth, rcth, and σ2.
Output: the channel allocation matrix X, the offline transmission power Pnm,kd∗, and the power allocation factor anm,k1∗.
(1)
Initialization: tnm = 1, Pnm,kd=En,k/τe.
(2)
Allocate channel for D2D groups, and obtain the channel allocation matrixX.
(3)
For
n = 1 : N
(4)
whiletnm < Titer
(5)
Fork = 1 : K
(6)
IfPnm,kd>Pnm,k+1d
(7)
Pnm,kd=Pnm,kd+Pnm,k+1d/2;
(8)
Pnm,k+1d=Pnm,kd;
(9)
End if
(10)
End for
(11)
tnm = tnm + 1;
(12)
End while
(13)
Fork = 1 : K
(14)
Pnm,kd∗=minPnm,kd,Pmaxd;
(15)
End for
(16)
Calculateanm,k1∗ with equation (20) or (21);
(17)
End for


## 3.1.1. Optimization of Power Allocation Factor

There is no interference between D2D groups, so the maximum capacity of a single D2D group inK epochs can be firstly solved. When Dn reuses the channel of CUm, and the transmission power of D2D user is fixed, the optimal power allocation factor of two receivers in the D2D group is calculated to maximize the capacity of Dn. When Dn multiplexes the channel of CUm, the total capacity of Dn in K time periods is given by(13)Cn,md=∑k=1Kτe⋅log1+Pnm,kdA5Pnm,kdA3+A1+log1+Pnm,kdA4A2,where A1=PBShBn,1+σ2, A2=PBShBn,2+σ2, A3=1−anm,k1hn,1, A4=1−anm,k1hn,2, and A5=anm,k1hn,1.From equations (7) and (8), we can obtain the following equation:(14)anm,k1≥rdthPnm,kdhn,1+A1Pnm,kdhn,11+rdth,(15)anm,k1≤Pnm,kdhn,2−rdthA2Pnm,kdhn,2.The Lagrange function of (13) with respect to equations (14) and (15) is formulated as follows:(16)Lanm,k1=Cn,mdPnm,kd,anm,k1−λ1rdthPnm,kdhn,1+A1Pnm,kdhn,11+rdth−anm,k1−λ2anm,k1−Pnm,kdhn,2−rdthA2Pnm,kdhn,2,where λ1 and λ2 are the Lagrange multipliers associated with the constraints of equations (14) and (15). The Karush–Kuhn–Tucker condition of equation (16) with respect to power allocation factor anm,k1 can be expressed as follows:(17)∂Lanm,k1∂anm,k1=τePnm,kdψnmln2⋅Pnm,kdA3+A1Pnm,kdA4+A2+λ1−λ2=0,(18)λ1rdthPnm,kdhn,1+A1Pnm,kdhn,11+rdth−anm,k1=0,(19)λ2anm,k1−Pnm,kdhn,2−rdthA2Pnm,kdhn,2=0,(20)rdthPnm,kdhn,1+A1Pnm,kdhn,11+rdth−anm,k1≤0,(21)anm,k1−Pnm,kdhn,2−rdthA2Pnm,kdhn,2≤0,(22)λ1≥0,λ2≥0,where ψnm=σ2hn,1−hn,2+PBShn,1hBn,1−hn,2hBn,2. As whether hBn,1 or hBn,2 is bigger is unknown, so whether ψnm is positive or negative is unknown. The first item of equation (17) is the first-order partial derivatives of Cn,md with anm,k1, if ψnm>0, Cn,md is a monotone increasing function of anm,k1, so the power is allocated to 1st receiver as much as possible under the condition of satisfying the SINR of 2nd receiver. In this case, from equations (18) and (19), we can know λ1 = 0 and λ2 > 0, and the power allocation factor of 1st receiver can be obtained from equation (21) as follows:(23)anm,k1=Pnm,kdhn,2−rdthA2Pnm,kdhn,2,when ψnm<0, Cn,md is a monotone decreasing function of anm,k1, so the power is allocated to 2nd receiver as much as possible under the condition that satisfying the SINR of 1st receiver. In this case, from equations (18) and (19), we know λ1 > 0 and λ2 = 0, and the power allocation factor of 1st receiver can be obtained from equation (20) as follows:(24)anm,k1=rdthPnm,kdhn,1+A1Pnm,kdhn,11+rdth.


## 3.1.2. Optimization of Channel Allocation

Considering the objective function (5) and the constraints (6) and (11), the channel allocation optimization problem can be regarded as the optimum matching problem of two weighted bipartite graphs. As shown in Figure 2, D2D group set and cellular user set, respectively, represent two mutually disjointed vertex sets in the bipartite graph. If Dn multiplexes the channel of CUm, vertex n will be connected with vertex m by a line. The weight value on the connecting line is Cn,md, which represents the capacity of Dn when it reuses the channel of CUm.Figure 2
Weighted bipartite graph for matching problem of D2D groups and cellular users’ channels.KM algorithm is an effective binary matching algorithm, and the maximum weight matching problem can be transformed into the complete matching problem by giving each vertex a label [21]. Therefore, we use KM algorithm to allocate channels for D2D groups. The detailed steps are shown as follows:(1)
Initialize the cellular user set CU, the D2D group setD, and the candidate cellular user set of D2D groups Ω=Ω1,…,Ωn,…,ΩN=Φ.(2)
For each D2D groupDn∈D and each cellular user CUm∈CU, calculate the SINRmnc with equation (1).(3)
IfSINRmnc≥rcth, put CUm into Ωn: Ωn=Ωn∪CUm, calculate the optimal anm,k1 with equations (23) or (24), and calculate Cn,md with equation (13). Else, Cn,md=0.(4)
TakeCn,md as the weight of Dn and CUm, use the KM algorithm [21] to achieve the optimal matching of D2D groups and cellular users’ channels, and the channel allocation matrix X is obtained.(5)
If the candidate cellular user set ofDn is Ωn=0, there is no channel of cellular user that can be reused by Dn, that is, for any m, xnm = 0.(6)
Update theX, and end of the algorithm.


## 3.1.3. Optimization of the DTs’ Power

In the previous section, we have assigned the channels to D2D groups. Assuming thatDn multiplexes channel of CUm, and the subproblem of optimization problem P1 regarding the transmission power of Dn in K epochs is given by(25)maxPnm,kdCn,md=∑k=1Kτelog1+Pnm,kdA5Pnm,kdA3+A1+log1+Pnm,kdA4A2s.t.9,10.The first partial derivative of equation (25) with Pnm,kd is as follows:(26)∂Cn,mdPnm,kd∂Pnm,kd=A5A1ln2⋅Pnm,kdhn,1+A1Pnm,kdA3+A1+A4ln2⋅Pnm,kdA4+A2.All parameters in equation (26) are positive, so the objective function is a monotonically increasing function in the feasible domain. In order to maximize Cn,md, all the energy harvested in K epochs should be used up. When the maximum value is obtained, the following theorem is applied.Theorem 1.
When the maximum value ofCn,md is obtained, the transmission power of DTn in the epoch k (1≤ k < K) is no more than the transmission power in the next epoch. That is, the transmission power of Dn satisfies Pnm,kd≤Pnm,k+1d for any epoch k (1≤ k < K).The proof is provided in Appendix.According to Theorem1 and the optimization results of power allocation factor and channel allocation, an offline channel allocation and power control algorithm is proposed. The detailed steps are summarized in Algorithm 1.Algorithm 1:Offline channel allocation and power control algorithm.
Input: the number of epoch K, the length of epoch τe, and the maximum number of iterations Titer, hn,1, hn,2, hBn,1, hBn,2, En,k, Pmaxd, PBS, rdth, rcth, and σ2.
Output: the channel allocation matrix X, the offline transmission power Pnm,kd∗, and the power allocation factor anm,k1∗.
(1)
Initialization: tnm = 1, Pnm,kd=En,k/τe.
(2)
Allocate channel for D2D groups, and obtain the channel allocation matrixX.
(3)
For
n = 1 : N
(4)
whiletnm < Titer
(5)
Fork = 1 : K
(6)
IfPnm,kd>Pnm,k+1d
(7)
Pnm,kd=Pnm,kd+Pnm,k+1d/2;
(8)
Pnm,k+1d=Pnm,kd;
(9)
End if
(10)
End for
(11)
tnm = tnm + 1;
(12)
End while
(13)
Fork = 1 : K
(14)
Pnm,kd∗=minPnm,kd,Pmaxd;
(15)
End for
(16)
Calculateanm,k1∗ with equation (20) or (21);
(17)
End for


## 3.2. Online Power Allocation Optimization Algorithm

In Section3.1, we assume that the energy distribution of all epochs is known before the signal transmission. The offline optimal transmission power of DTs and the offline power allocation factor of the two receivers in the D2D group are obtained. However, in real scenario, only the energy harvested in this epoch and before this epoch is known in epoch k, and the energy distribution after epoch k is unknown. In this section, an online power allocation optimization algorithm is proposed, that is, the neural network is used to optimize the transmission power of DTs. Then, the power allocation factors of the two receivers in the D2D group are obtained.Neural network simulates the working method of the human brain, which has strong adaptability and learning ability. Supervised neural networks require training dataset composed of a large number of known input vector and the corresponding output vector. A nonlinear mapping relation between input vector and output vector is obtained through learning. After completion of neural network learning, the corresponding output vector can be calculated according to the mathematical model of the neural network when input an input vector. Since the harvested energy after epochk is unknown, it cannot be decided whether to store energy for later epoch to maximize the capacity of D2D groups in the total transmission time T. By learning the training dataset of offline optimization algorithm, the neural network can get the mathematical model between the input vector and the transmission power. Then, the online optimal transmission power Pnm,kd,on∗ can be obtained with only the information of the system parameters of epoch k.The model of the neural network adopts the multilayer feedforward network. It is supervised learning and composed of input layer, hidden layer, and output layer. In the training process, the error between the output generated by the neural network and the actual output is calculated. Meanwhile, the error is minimized by adjusting the weight vector of the neural network [22]. In this paper, mean-square error (MSE) is minimized:(27)MSE=1Q∑q=1Qyq−tq2,where Q represents epoch, y(q) represents the output of the neural network, and t(q) is the actual output.When some parameters of minimum mean square error, maximum iteration epoch, minimum gradient, and maximum confirmation failure times reach the set value, the training process ends.In this paper, a two-layer feedforward network is considered. That is, the number of hidden layers is one, due to the fact that the neural network with a single hidden layer is sufficient to approximate any function and any given precision [23]. There are four back propagation (BP) algorithms for training neural network in Matlab neural network toolbox, namely, resilient BP algorithm (trainrp), conjugate gradient BP algorithm (traincgf), gradient descent BP algorithm (traingd), and Levenberg–Marquardt BP algorithm (trainlm). Considering the convergence epoch, convergence time, and MSE of training neural network, trainlm algorithm is selected to train the neural network after testing. The performance of different training algorithms is presented in Table 1.Table 1
Performance of different training algorithms.
Training algorithm
Epoch
Convergence time (s)
MSE
trainrp
271
17
0.000143
traincgf
286
70
0.000135
traingd
1500
102
0.000819
trainlm
38
12
0.000134In addition, when trainlm algorithm is adopted to train the neural network, considering the MSE and complexity of neural network structure, the number of hidden layer neurons is set to 4 after testing. Figure3 shows the variation of MSE with the number of hidden layer neurons.Figure 3
MSE varies with the number of hidden layer neurons.The specific structure of the neural network is shown in Figure4. The input vector is composed of hn,1, hn,2, hBn,1, hBn,2, En,ksum, En,kcons, and En,k, and the output is online transmission power Pnm,kd,on∗, where En,ksum=∑t=1k−1En,t represents the total energy harvested in the k − 1 epochs before epoch k and En,kcons=∑t=1k−1τePnm,td∗ represents the total energy consumed in the k − 1 epochs before epoch k. Before training, the input parameters are normalized. Normalization can ensure that each input parameter provides the same influence in the neural network and can make the training process more stable and the convergence speed faster.Figure 4
Two-layer feedforward neural network model.When offline power allocation is carried out by Algorithm1, input vectors and output vectors required to train the neural network can be obtained. Through training neural network, an optimization model to maximize the total capacity of D2D groups is obtained. The online transmission power of the current epoch can be determined by the optimization model. The online power allocation optimization algorithm is shown in Algorithm 2.Algorithm 2:Online power allocation optimization algorithm.
Input: the channel allocation matrix X, the number of epoch K, the length of epoch τe, hn,1, hn,2, hBn,1, hBn,2, the harvested energy En,k, Pmaxd, PBS, rdth, and σ2.
Output: the online transmission power Pnm,kd,on∗ and the power allocation factor anm,k1,on∗.
(1)
Initialization: k = 1, Sn,1e=En,1, En,1sum=0, En,1cons=0.
(2)
For
m = 1 : M
(3)
n = find(X(:, m) == 1);
(4)
whilek ≤ K
(5)
Input the input vector to the neural network to obtainPnm,kd,on∗;
(6)
Pnm,kd,on∗=minminPmaxd,Pnm,kd,on,Sn,ke/τe;
(7)
Calculateanm,k1,on∗ with equation (20) or (21);
(8)
k = k + 1;
(9)
En,kcons=En,k−1cons+τe⋅Pnm,k−1d,on∗;
(10)
Sn,ke=Sn,k−1e−τe⋅Pnm,kd,on∗+En,k;
(11)
End while
(12)
End forAccording to Algorithm2, the complexity of the online power allocation optimization algorithm is O(LK), where L = min(N, M) represents the number of D2D groups for D2D communication and K represents the total number of epochs. In [18], the power allocation algorithm uses Bisection search method to optimize Lagrange multipliers in two nested loops. Thereby, the complexity is O(LK logn), where n represents the product of the number of elements in the two dichotomy intervals.


## 4. Simulation Results and Analysis

In this section, we present the simulation results of the proposed offline and online algorithms. The influences of the distance Rd between DT and DR, the number of D2D groupsN, the maximum value of energy arrival distribution Emax, and the SINR threshold of CU rcth on the total capacity of D2D groups are analyzed. The two-layer feedforward neural network is realized by MATLAB neural network toolbox. The transfer functions of hidden layer and output layer are symmetric sigmoid transfer function and linear transfer function, respectively. The maximum iteration epoch is 1500. The minimum MSE is 10e − 5. The minimum gradient is 10e − 7. The maximum confirmation failure time is 15. The channel gain consists of large-scale fading based on path loss and small-scale fading based on Rayleigh fading, which is expressed as h=βd−αg02, where β and α, respectively, represents path loss constant and path loss exponent, d is the distance between transmitter and receiver, and g02 represents Rayleigh fading that follows the exponential distribution with unit mean [24]. Other simulation parameters and their specific values are given in Table 2.Table 2
Simulation parameters.
Parameters
Value
Cell radiusR (m)
500
Number of cellular usersM
4
Transmission power of BSPBS (dBm)
24
Maximum transmission power of DTPmaxd (dBm)
21
Noise powerσ2 (dBm)
−114
Length of epochτe (s)
0.5
TimeT (s)
10
Path loss constantβ
0.01
Path loss exponentα
3Figure5 shows the impact of different distances between DT and DR on the total capacity of D2D groups. In the simulation, it is assumed that there are 4 D2D groups in the cell, the maximum value of energy arrival distribution Emax is 80 mJ, and the SINR threshold of CU rcth is 2 dB. From the figure, we can see that the total capacity of D2D groups decreases with the increasing distance between DT and DR. This is because the channel gain decreases as the distance between the DT and DR increases, which leads to the decrease of D2D groups’ total capacity. Meanwhile, the proposed algorithm is superior to the algorithm in [18], due to that the proposed power allocation algorithm takes the harvested energy of the whole time T into consideration. Gupta et al.’s study [18] uses the binary search method to optimize the transmission power in a certain period and ignores the energy arrival after the current epoch when determining the binary interval.Figure 5
Total capacity of D2D groups with different Rd.Figure6 presents the total capacity of D2D groups with the increasing number of D2D groups. In the simulation, it is assumed that the distance between DT and DR is 20 m, the maximum value of energy arrival distribution Emax is 80 mJ, and the SINR threshold of CU rcth is 2 dB. As can be seen from Figure 6, with the increasing number of D2D groups, the total capacity of D2D groups increases. This is because when the number of D2D groups is less than the number of cellular users, more D2D groups can reuse the channels of cellular users for communication with the increase of the D2D group number, which increases the total capacity of D2D groups. When the number of D2D groups is larger than the number of cellular users, channels will be assigned to D2D groups with better channel gain, increasing the total capacity of D2D groups. Additionally, the proposed online power allocation optimization algorithm in this paper can achieve 98.6% of the performance of the offline power allocation algorithm. This is because the offline algorithm can achieve the optimal power allocation with the assumption that the harvested energy of all epochs is available. Online power allocation is unable to maximize the total capacity of D2D groups on the whole time because the harvested energy after current epoch is unknown. However, because the training dataset of the neural network is the optimal data of the offline power allocation algorithm, the performance of the online algorithm is only slightly lower than that of the offline algorithm.Figure 6
Total capacity of D2D groups with different number of D2D groups.Figure7 shows the impact of the maximum value of energy arrival distribution on the total capacity of D2D groups under different SINR thresholds of CU. In the simulation, we assume that there are 4 D2D groups in the cell, and the distance between DT and DR is 20 m. It can be observed that for a certain SINR threshold, with the increasing maximum value of energy arrival distribution, the total capacity of D2D groups increases. This is because when the maximum value of energy arrival distribution increases, the average harvested energy of each epoch will increase. Then, the average transmitting power of DT is increased in each epoch, which leads to the rise of the total capacity of D2D groups. In addition, for a certain SINR threshold, with the increasing maximum value of energy arrival distribution, the transmission power of DT in each epoch is closer to the preset maximum transmission power Pmaxd. This results in the performance difference between offline algorithm and online algorithm to gradually decrease. From the figure, we can also observe that the total capacity of D2D groups with a SINR threshold of 2 dB for cellular users is larger than that of 8 dB. This is because the SINR threshold of cellular users increases, D2D groups’ candidate cellular user number is reduced and even no candidate cellular user. D2D groups can reuse fewer channels and even cannot communicate, causing the total capacity of D2D groups to decrease.Figure 7
Total capacity of D2D groups with differentEmax.


## 5. Conclusions

This paper assumes a scenario where DTs harvest energy from the surrounding environment and use NOMA technology to send information to two DRs at the same time. We investigate the problem of assigning optimal transmission power, power allocation factor, and channels to D2D groups. The total capacity of D2D groups is maximized while satisfying the QoS requirements of users and the energy causality constraints. Firstly, the offline channel allocation and power control algorithm is proposed based on the assumption that all harvested energy information is known. Then, the optimal transmission power of the offline algorithm is taken as the output vector, the system parameters that affect the transmission power are taken as input vector, making up the training dataset to train the neural network, and the optimization model of transmission power is obtained. According to the system parameters in a certain epoch, the optimal transmission power of the current epoch can be obtained by the neural network. An online power allocation optimization algorithm is proposed by considering the maximum transmission power limitation. Simulation results show that the proposed offline algorithm can effectively improve the total capacity of D2D groups, and the online power allocation optimization algorithm can approach the upper bound provided by the offline power allocation algorithm.



---

*Source: 4062487-2020-02-17.xml*