Resource Allocation for D2D Communication Underlaying Cellular Networks: A Distance-Based Grouping Strategy
Algorithm 1
Resource allocation algorithm based on distance grouping.
1: Initializes particle parameters, the maximum number of iterations , the individual optimal value of particles , the global optimal value of particles , the global optimum in the last round , and the stop counting variable
2: Set iteration index , stationary threshold delta
3: Fordo
4: Calculate the objective function value and penalty term according to Eq. (11) and Eqs. (12)–(17)
5: The particle fitness is calculated by using the objective function value and penalty term Eq. (27)
6: Calculate the individual optimal value of particles and the global optimal value of particles
7: If do
8: Set
9: Else do
10: Set
11: End if
12: Set
13: If do
14:
15: End if
16: If do
17:
18: End if
19: Update velocities and position according to Eqs. (28) and (29)
20: Update particle position using particle velocity according to Eq. (29)