Research Article

Intelligent Differential Evolution Scheme for Network Resources in IoT

Algorithm 2

Function reallocate.
Input: currentBest //the best schedule among the current population
Output: //the improved schedule
(1) Begin
(2) makespan = f(best)
(3) newbest = currentBest;
(4) Rb ⟵ maxResource (newbest) //the last resource to finish its job
(5) Tb ⟵ set of tasks is performed by resource Rb
(6) For i = 1 to size(Tb) // Consider each task in Tb, the set of tasks performed by resource Rb
(7)  Ti = Tb [i];
(8)  Ri ⟵ set of resource that are skilled enough to execute the task i except Rb
(9)  For j = 1 to size (Ri) // Consider each resource in turn
(10)   Ri[j] = Ri[j] + {i} // Reassign task i to resource Ri[j]
(11)   Rb = Rb – {i} // Remove task i from the task list of Rb
(12)   newmakespan = f(newbest) // The makespan of the new schedule
(13)   If newmakespan < makespan
(14)   makespan = newmakespan
(15)   Return newbest; // Successful Reallocate, return the new and better schedule
(16)   End if
(17)   newbest = currentBest; // Unsuccessful Reallocate, reuse the original schedule for the next iteration
(18)   End for
(19)  End for
(20) Return best
(21) End Function