Research Article

Resource Allocation Schemes Based on Intelligent Optimization Algorithms for D2D Communications Underlaying Cellular Networks

Algorithm 1

Improved harmony search algorithm.
Input: , , , HMS, , MAXI, d, Umin, Umax, L, α
Output: we use , or as the results
(1)Step 1: initialization and coding
(2)Step 2: generate new solutions and update the harmony memory bank
(3)While <= MAXI
(4)For j = 1 : K
(5)  For i = 1 : M
(6)   If rand < HMCR then
(7)    index1 = roultte(fitness function)
(8)    index2 = roultte(fitness function)
(9)     If index1 < index2
(10)      index = index2
(11)     Else
(12)      index = index1
(13)     End
(14)     If rand < PAR
(15)      If rand < d
(16)       Newharmony(i) = HM(index, i) + bw
(17)      Else
(18)       Newharmony (i) = HM(index, i) − bw
(19)      End
(20)     Else
(21)      Newharmony (i) = HM(index, i);
(22)     End
(23)    Else
(24)     Newharmony (i) = rand(Umin, Umax)
(25)    End
(26)   End
(27)  End
(28)  rank these new solutions that satisfied the QoS of UEs
(29)  update the harmony memory bank
(30)End
(31)Step3: return the best fitness value
(32)
(33)Function index = roultte (fitness function)
(34)len = length(fitness function)
(35)Total = sum(fitness function)
(36)P = fitness function/Total
(37)randnumber = rand
(38)While randnumber == 0
(39)  randnumber = rand
(40)End
(41)For j = 1: len
(42)  randnumber = randnumber-P(j)
(43)  If randnumber < 0
(44)   index = j
(45)   return index
(46)  Break
(47)  End
(48)End
(49)End function