Skip to main content
. 2022 Aug 12;22(16):6023. doi: 10.3390/s22166023
Algorithm 1 Dynamic Group Matching Algorithm.
  • 1:

    Initialization: Initialize the matched pairing set of the UEs and relays Φ=∅, the unmatched set of the UEs and relays U_UE, U_RE, and initialize the matching priority sets of the UEs and relays {MP_UE}, {MP_RE} through the Equations (20) and (21)

  • 2:

    while U_UE≠∅ do

  • 3:   

    Each UE in U_UE requests to match its highest matching priority relay from U_RE according to the matching priority set {MP_UE}

  • 4:   

    for relay m = 1, 2,…, M do

  • 5:     

    Each relay matches the UE with the highest priority according to the matching priority set of relays {MP_RE} and rejects the other UEs

  • 6:     

    The rejected UEs remove the mth relay from its matching priority set {MP_UE}

  • 7:     

    Add the matched paring Φ(m,n) to the set Φ and remove the mth relay and nth UE from U_RE and U_UE, respectively

  • 8:   

    end for

  • 9:

    end while

  • 10:

    while{MP_UE}≠∅ or U_RE≠∅ do

  • 11:   

    Each UE requests to match its highest matching priority relay from U_RE according to the updated set {MP_UE}

  • 12:   

    for relay m = 1, 2,…, M do

  • 13:     

    The mth relay makes the following judgment for its highest matching priority UE according to its matching priority set {MP_RE}

  • 14:     

    if ∑m=1M|Φ(m,n)|<Q then

  • 15:        

    Add the matched paring Φ(m,n) to the set Φ and remove the mth relay and nth UE from U_RE and U_UE, respectively

  • 16:     

    else

  • 17:        

    The relay matches with the nth UE when there exists a relay that satisfies ψmn>ψln and |Φ(l,n)|=1; then, it updates Φ and removes the lth relay into U_RE

  • 18:        

    Otherwise, reject the matching request of the nth UE and remove the mth relay from its matching priority set {MP_UE}

  • 19:

         end if

  • 20:

       end for

  • 21:

    end while