(1)  Given CSI, TTI , the factors , , the fairness coefficient , and the additional cost , .
(2)  Initialize
(3)  Update prices according to the iterative function
           
(4)  Calculate the optimal power
        
(5)  Calculate priorities
            .
(6)  Sort in descending order to form a priority queue.
(7)  while do
(8)    Select the head of the queue. The pair is .
(9)    if and then
(10)     Schedule the pair .
(11)      Set and
(12)    end if
(13)    Delete the head of the queue.
(14)  end while
Algorithm 1: Joint D2D scheduling and resource allocation algorithm.