Algorithm 1. Modified CS algorithm |
1. Begin |
2. Generate initial population of n nests (solutions) , i = 1, 2, …, n |
3. Define objective function f(x); x = (x1, x2, …, xd); |
4. Set the range of and : , , ,
|
5. Set the range of the nest(solution): ,
|
6. Set the maximum number of iterations: N_itertotal |
7. For all do |
8. Calculate the fitness
|
9. End For |
10. N_iter = 1 |
11. While (N_iter < N_itertotal) do |
12. For all do |
13. Compute the step size for flight using Equation (6) |
14. Generate a new cuckoo () from the nest randomly by taking Lévy flight |
15. If () then |
16.
|
17. End If |
18. If () then |
19.
|
20. End If |
21. Calculate the fitness
|
22. Choose a random nest () among n nest randomly |
23. If () then |
24.
|
25.
|
26. End If |
27. End For |
28. Keep the current global optimal fitness:
|
29. Compute the probability using Equation (7) |
30. A fraction () of worse nests abandoned and new ones/solutions are built/generated correspondingly |
31. For all the nests (say, ) to be built/generated do |
32. If () then |
33.
|
34. End If |
35. If () then |
36.
|
37. End If |
38. Calculate the fitness and evaluate its quality/fitness
|
39. Keep best solutions (or nests with quality solutions) |
40. End For |
41. Rank all the solutions and find the current best |
42. End While |
43. End |