Skip to main content
. 2020 Nov 23;20(22):6692. doi: 10.3390/s20226692
Algorithm 2 Next hop selection algorithm at D2D device i
  • Input: Packet with RRH destination RRHd

  • Output: Best next hop to RRHd

  • Variables: RoutingTable, j

  • while Battery lifetime is not equal to zero do

  •     Receive a packet with destination RRH

  •     Determine the next-hop corresponding to the path with the smallest path quality (PQ):

  • PQ=l=1L(LQMl)nH1LQMl
  •     Send packet to j with selected level of pdc

  •     Receive feedback/reward, Rf from j

  • Rf=LQMl1LQMl+LQMl×AfornN.LQMl1LQMln>N.
  •     Update the Q value for Q-learning

  •     Update the corresponding entry in the table, RRHTable

  • end while