Research Article

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

Algorithm 2

Online power allocation optimization algorithm.
Input: the channel allocation matrix X, the number of epoch K, the length of epoch , hn,1, hn,2, hBn,1, hBn,2, the harvested energy En,k, , PBS, , and .
Output: the online transmission power and the power allocation factor .
(1)Initialization: k = 1, , , .
(2)For m = 1 : M
(3)n = find(X(:, m) == 1);
(4)while kK
(5)  Input the input vector to the neural network to obtain ;
(6)  ;
(7)  Calculate with equation (20) or (21);
(8)  k = k + 1;
(9)  ;
(10)  ;
(11)End while
(12)End for