
112 Cuckoo Search Algorithm
Algorithm 8 Pseudo-code of the cuckoo search algorithm.
1: Define the objective function f(x)
2: Initialize all the parameters
3: Generate an initial population of n nests x
i
(i = 1, 2, ..., n)
4: for t=1:MaxGeneration do
5: Get a cuckoo/solution randomly
6: Generate a solution by Lévy flights [Eq. (9.3)]
7: Evaluate the new solution x
i
and its fitness f
i
8: Choose a nest (say, j) among n nests randomly
9: if f
i
< f
j
then
10: Replace x
j
by x
i
11: end if
12: A fraction (p
a
) of the worse nests are abandoned
13: New nests/solutions are generated by Eq. (9.1)
14: Update the best solution if a better solution is found
15: end for
16: Output