# A Discrete Prey-Predator Algorithm for Cloud Task Scheduling
## 3 The Proposed Discrete Prey-Predator Algorithm for Cloud Task Scheduling
### Pseudo-Code for the Proposed Discrete Prey-Predator Algorithm for Cloud Task Scheduling
\begin{array}{cccccccccccccccc} \mathrm{s}_{6}&\mathrm{s}_{2}&\mathrm{s}_{4}&\mathrm{s}_{3}&\mathrm{s}_{1}& \mathrm{s}_{4}&\mathrm{s}_{2}&\mathrm{s}_{6}&\mathrm{s}_{3}&\mathrm{s}_{3}& \mathrm{s}_{6}&\mathrm{s}_{2}\\ \mathrm{s}_{3}&\mathrm{s}_{4}&\mathrm{s}_{2}&\mathrm{s}_{1}&\mathrm{s}_{3}& \mathrm{s}_{5}&\mathrm{s}_{3}&\mathrm{s}_{4}&\mathrm{s}_{1}&\mathrm{s}_{1}& \mathrm{s}_{5}&\mathrm{s}_{4}\\ \mathrm{s}_{1}&\mathrm{s}_{2}&\mathrm{s}_{3}&\mathrm{s}_{2}&\mathrm{s}_{4}& \mathrm{s}_{6}&\mathrm{s}_{4}&\mathrm{s}_{2}&\mathrm{s}_{3}&\mathrm{s}_{6}& \mathrm{s}_{2}&\mathrm{s}_{4}\\ \mathrm{s}_{2}&\mathrm{s}_{1}&\mathrm{s}_{4}&\mathrm{s}_{6}&\mathrm{s}_{2}& \mathrm{s}_{5}&\mathrm{s}_{1}&\mathrm{s}_{3}&\mathrm{s}_{6}&\mathrm{s}_{1}& \mathrm{s}_{1}&\mathrm{s}_{2}\\ \mathrm{s}_{3}&\mathrm{s}_{6}&\mathrm{s}_{3}&\mathrm{s}_{2}&\mathrm{s}_{4}& \mathrm{s}_{1}&\mathrm{s}_{5}&\mathrm{s}_{2}&\mathrm{s}_{4}&\mathrm{s}_{4}& \mathrm{s}_{1}&\mathrm{s}_{6}\\ \mathrm{s}_{4}&\mathrm{s}_{5}&\mathrm{s}_{2}&\mathrm{s}_{1}&\mathrm{s}_{3}& \mathrm{s}_{6}&\mathrm{s}_{1}&\mathrm{s}_{4}&\mathrm{s}_{2}&\mathrm{s}_{1}& \mathrm{s}_{3}&\mathrm{s}_{5}\end{array} \right) \tag{5}\]

Each surviving solution in Equation (5) represents a cloud-task-scheduling solution. The proposed Discrete Prey-Predator algorithm for cloud task scheduling then calculates the fitness of each surviving solution \(\mathrm{SV}(\mathrm{x}_{\mathrm{i}})\). Equation (6) represents the six surviving solutions and their corresponding fitness values. \[\left( \begin{array}{c}\mathrm{SV}(\mathrm{x}_{1})\\ \mathrm{SV}(\mathrm{x}_{2})\\ \mathrm{SV}(\mathrm{x}_{3})\\ \mathrm{SV}(\mathrm{x}_{4})\\ \mathrm{SV}(\mathrm{x}_{5})\\ \mathrm{SV}(\mathrm{x}_{6})\end{array} \right)=\left( \begin{array}{c}15.44\\ 17.97\\ 18.72\\ 15.18\\ 18.96\\ 18.60\end{array} \right) \tag{6}\]

After calculating the fitness values of each surviving solution \(\mathrm{SV}(\mathrm{x}_{\mathrm{i}})\), the proposed Discrete Prey-Predator algorithm updates the current solutions by moving according to the equation of the best prey. The algorithm considers each surviving value compared to other surviving values \(\mathrm{SV}(\mathrm{x}_{\mathrm{i}})\) in Equation (6). Starting from surviving value 1, the best prey for surviving value 1 SV(\(\mathrm{x}_{\mathrm{1}}\)) is 15.44. The best prey value for \(\mathrm{SV}(\mathrm{x}_{\mathrm{2}})\) considering \(\mathrm{SV}(\mathrm{x}_{\mathrm{1}})\) is 15.88. Using the same calculations, we find that the best prey (bestPrej\({}_{\mathrm{i}}\)) for each surviving value \(\mathrm{SV}(\mathrm{x}_{\mathrm{i}})\) considering surviving value 1 SV(\(\mathrm{x}_{\mathrm{1}}\)) is as follows:

\[\left( \begin{array}{c}\mathrm{bestPrey}_{1}\\ \mathrm{bestPrey}_{2}\\ \mathrm{bestPrey}_{3}\\ \mathrm{bestPrey}_{5}\\ \mathrm{bestPrey}_{6}\end{array} \right)=\left( \begin{array}{c}15.44\\ 15.88\\ 15.44\\ 16.37\\ 16.16\\ 15.50\end{array} \right) \tag{7}\]

Surviving value 4 SV(\(\mathrm{x}_{\mathrm{4}})\) has the best value, 16.37, so surviving value 1 SV(\(\mathrm{x}_{\mathrm{1}}\)) moves to surviving value 4 SV(\(\mathrm{x}_{\mathrm{4}}\)). For surviving value 2 SV(\(\mathrm{x}_{\mathrm{2}}\)),

\[\left( \begin{array}{c}\mathrm{bestPrey}_{1}\\ \mathrm{bestPrey}_{2}\\ \mathrm{bestPrey}_{3}\\ \mathrm{bestPrey}_{4}\\ \mathrm{bestPrey}_{5}\\ \mathrm{bestPrey}_{6}\end{array} \right)=\left( \begin{array}{c}18.33\\ 17.97\\ 18.00\\ 18.35\\ 18.90\\ 18.22\end{array} \right) \tag{8}\]

Surviving value 5 SV(\(\mathrm{x}_{\mathrm{5}}\)) has the best value, 18.90, so surviving value 2 SV(\(\mathrm{x}_{\mathrm{2}}\)) moves to surviving values 5 SV(\(\mathrm{x}_{\mathrm{5}}\)). Using the same steps, the Discrete Prey-Predator cloud-task-scheduling algorithm calculates the movement of the remaining four solutions of the initial random population. The solution with surviving value 5 has maximum fitness and randomly moves in the solution search space. The new population of the proposed Prey-Predator algorithm after applying the movement equation is described in Equation (9):

\[\left(