Research Article

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

Algorithm 1

Offline channel allocation and power control algorithm.
Input: the number of epoch K, the length of epoch , and the maximum number of iterations Titer, hn,1, hn,2, hBn,1, hBn,2, En,k, , PBS, , , and .
Output: the channel allocation matrix X, the offline transmission power , and the power allocation factor .
(1)Initialization: tnm = 1, .
(2)Allocate channel for D2D groups, and obtain the channel allocation matrix X.
(3)For n = 1 : N
(4)while tnm<Titer
(5)  For k = 1 : K
(6)   If
(7)    ;
(8)    ;
(9)   End if
(10)  End for
(11)  tnm = tnm + 1;
(12)End while
(13)For k = 1 : K
(14)  ;
(15)End for
(16) Calculate with equation (20) or (21);
(17)End for