**Also available as eBook on:**

Swarm intelligence algorithms are a form of nature-based optimization algorithms. Their main inspiration is the cooperative behavior of animals within specific communities. This can be described as simple behaviors of individuals along with the mechanisms for sharing knowledge between them, resulting in the complex behavior of the entire community. Examples of such behavior can be found in ant colonies, bee swarms, schools of fish or bird flocks.

Swarm intelligence algorithms are used to solve difficult optimization problems for which there are no exact solving methods or the use of such methods is impossible, e.g. due to unacceptable computational time.

This book thoroughly presents the basics of 24 algorithms selected from the entire family of swarm intelligence algorithms. Each chapter deals with a different algorithm describing it in detail and showing how it works in the form of a pseudo-code. In addition, the source code is provided for each algorithm in Matlab and in the C ++ programming language. In order to better understand how each swarm intelligence algorithm works, a simple numerical example is included in each chapter, which guides the reader step by step through the individual stages of the algorithm, showing all necessary calculations.

This book can provide the basics for understanding how swarm intelligence algorithms work, and aid readers in programming these algorithms on their own to solve various computational problems.

This book should also be useful for undergraduate and postgraduate students studying nature-based optimization algorithms, and can be a helpful tool for learning the basics of these algorithms efficiently and quickly. In addition, it can be a useful source of knowledge for scientists working in the field of artificial intelligence, as well as for engineers interested in using this type of algorithms in their work.

If the reader already has basic knowledge of swarm intelligence algorithms, we recommend the book: "Swarm Intelligence Algorithms: Modifications and Applications" (Edited by A. Slowik, CRC Press, 2020), which describes selected modifications of these algorithms and presents their practical applications.

1 Ant Colony Optimization

Pushpendra Singh, Nand K. Meena, Jin Yang, and Adam Slowik

1.1 Introduction

1.2 Ants's Behavior

1.3 Ant Colony Algorithm

1.4 Source-code of ACO Algorithm in Matlab

1.5 Source-code of ACO Algorithm in C++

1.6 Step-by-step numerical example of ACO algorithm

1.7 Conclusion

2 Arti□cial Bee Colony Algorithm

Bahriye Akay and Dervis Karaboga

2.1 Introduction

2.2 The Original ABC algorithm

2.3 Source-code of ABC algorithm in Matlab

2.4 Source-code of ABC algorithm in C++

2.5 Step-by-step numerical example of the ABC algorithm

2.6 Conclusions

References

3 Bacterial Foraging Optimization

Sonam Parashar, Nand K. Meena, Jin Yang, and Neeraj Kanwar

3.1 Introduction

3.2 Bacterial Foraging Optimization Algorithm

3.2.1 Chemotaxis

3.2.2 Swarming

3.2.3 Reproduction

3.2.4 Elimination and dispersal

3.3 Pseudo-code of Bacterial Foraging Optimization

3.4 Matlab Source-code of Bacterial Foraging Optimization

3.5 Numerical Examples

3.6 Conclusions

3.7 Acknowledgement

References

4 Bat Algorithm

Xin-She Yang and Adam Slowik

4.1 Introduction

4.2 Original bat algorithm

4.2.1 Description of the bat algorithm

4.2.2 Pseudo-code of BA

4.2.3 Parameters in the bat algorithm

4.3 Source code of bat algorithm in Matlab

4.4 Source code in C++

4.5 An worked example

4.6 Conclusion

References

5 Cat Swarm Optimization

Dorin Moldovan, Viorica Chifu, Ioan Salomie, and Adam Slowik

5.1 Introduction

5.2 Original CSO algorithm

5.2.1 Pseudo-code of global version of CSO algorithm

5.2.2 Description of global version of CSO algorithm

5.2.2.1 Seeking Mode (Resting)

5.2.2.2 Tracing Mode (Movement)

5.2.3 Description of local version of CSO algorithm

5.3 Source-code of global version of CSO algorithm in Matlab

5.4 Source-code of global version of CSO algorithm in C++

5.5 Step-by-step numerical example of global version of CSO algorithm

5.6 Conclusions

References

6 Chicken Swarm Optimization

Dorin Moldovan and Adam Slowik

6.1 Introduction

6.2 Original CSO algorithm

6.2.1 Pseudo-code of global version of CSO algorithm

6.2.2 Description of global version of CSO algorithm

6.3 Source-code of global version of CSO algorithm in Matlab

6.4 Source-code of global version of CSO algorithm in C++

6.5 Step-by-step numerical example of global version of CSO algorithm

6.6 Conclusions

References

7 Cockroach Swarm Optimization

Joanna Kwiecien

7.1 Introduction

7.2 Original Cockroach Swarm Optimization Algorithm

7.2.1 Pseudo-code of CSO algorithm

7.2.2 Description of the CSO algorithm

7.3 Source-code of CSO algorithm in Matlab

7.4 Source-code of CSO algorithm in C++

7.5 Step-by-step numerical example of CSO algorithm

7.6 Conclusions

References

8 Crow Search Algorithm

Adam Slowik and Dorin Moldovan

8.1 Introduction

8.2 Original CSA

8.3 Source-code of CSA in Matlab

8.4 Source-code of CSA in C++

8.5 Step-by-step numerical example of CSA

8.6 Conclusions

References

9 Cuckoo Search Algorithm

Xin-She Yang and Adam Slowik

9.1 Introduction

9.2 Original Cuckoo Search

9.2.1 Description of the cuckoo search

9.2.2 Pseudo-code of CS

9.2.3 Parameters in the cuckoo search

9.3 Source code of the cuckoo search in Matlab

9.4 Source code in C++

9.5 An worked example

9.6 Conclusion

References

10 Dynamic Virtual Bats Algorithm

Ali Osman Topal

10.1 Introduction

10.2 Dynamic Virtual Bats Algorithm

10.2.1 Pseudo-code of DVBA

10.2.2 Description of DVBA

10.3 Source-code of DVBA in Matlab

10.4 Source-code of DVBA in C++

10.5 Step-by-step numerical example of DVBA

10.6 Conclusions

11 Dispersive Flies Optimisation: A Tutorial

Mohammad Majid al-Rifaie

11.1 Introduction

11.2 Dispersive Flies Optimisation

11.3 Source code

11.3.1 Matlab

11.3.2 C++

11.3.3 Python

11.4 Numerical example: optimisation with DFO

11.5 Conclusion

References

12 Elephant Herding Optimization

Nand K. Meena, Jin Yang, and Adam Slowik

12.1 Introduction

12.2 Elephant Herding Optimization

12.2.1 Position update of elephants in a clan

12.2.2 Separation of male elephants from the clan

12.2.3 Pseudo-code of EHO algorithm

12.3 Source-code of EHO Algorithm in Matlab

12.4 Source-code of EHO Algorithm in C++

12.5 Step-by-step Numerical Example of EHO Algorithm

12.6 Conclusions

References

13 Fire□y Algorithm

Xin-She Yang and Adam Slowik

13.1 Introduction

13.2 Original □re□y algorithm

13.2.1 Description of the standard □re□y algorithm

13.2.2 Pseudo-code of FA

13.2.3 Parameters in the □re□y algorithm

13.3 Source code of □re□y algorithm in Matlab

13.4 Source code in C++

13.5 An worked example

13.6 Handling constraints

13.7 Conclusion

References

14 Glowworm Swarm Optimization - A Tutorial

Krishnanand Kaipa and Debasish Ghose

14.1 Introduction

14.1.1 Basic principle of GSO

14.1.2 The Glowworm Swarm Optimization (GSO) Algorithm

14.1.3 Algorithm description

14.2 Source-code of GSO algorithm in Matlab

14.3 Source-code of GSO algorithm in C++

14.4 Step-by-step numerical example of GSO algorithm

14.5 Conclusions

References

15 Grasshopper Optimization Algorithm

Szymon ukasik

15.1 Introduction

15.2 Description of the Grasshopper Optimization Algorithm

15.3 Source-code of GOA in Matlab

15.4 Source-code of GOA in C++

15.5 Step-by-step numerical example of GOA

15.6 Conclusion

References

16 Grey Wolf Optimizer

Ahmed F. Ali and Mohamed A. Tawhid

16.1 Introduction

16.2 Original GWO algorithm

16.2.1 Main concepts and inspiration

16.2.2 Social hierarchy

16.2.3 Encircling prey

16.2.4 Hunting process

16.2.5 Attacking prey (exploitation)

16.2.6 Search for prey (exploration)

16.2.7 Pseudo-code of GWO algorithm

16.2.8 Description of the GWO algorithm

16.3 Source-code of GWO algorithm in Matlab

16.4 Source-code of GWO algorithm in C++

16.5 Step-by-step numerical example of GWO algorithm

16.6 Conclusion

17 Hunting Search Algorithm

Ferhat Erdal and Osman Tunca

17.1 Introduction

17.2 Original HuS algorithm

17.2.1 Pseudo-code of HuS algorithm

17.2.1.1 Description of the global version of the HuS algorithm

17.3 Source code of HuS algorithm in Matlab

17.4 Source code of HuS algorithm in C++

17.5 Elaborate on HuS Algorithm with Constrained Minimization Problem

17.6 Conclusion

References

18 Krill Herd Algorithm

Ali R. Kashani, Charles V. Camp, Hamed Tohidi, and Adam Slowik

18.1 Introduction

18.2 Original KH algorithm

18.2.1 Pseudo-code of the original version of KH algorithm

18.2.2 Description of the original version of KH algorithm

18.3 Source-code of the KH algorithm in Matlab

18.4 Source-code of the KH algorithm in C++

18.5 Step-by-step numerical example of KH algorithm

18.6 Conclusion

References

19 Monarch Butter□y Optimization

Pushpendra Singh, Nand K. Meena, Jin Yang, and Adam Slowik

19.1 Introduction

19.2 Monarch Butter□y Optimization

19.2.1 Migration operator

19.2.2 Butter□y adjusting operator

19.3 Algorithm of Monarch Butter□y Optimization

19.4 Source-code of MBO Algorithm in Matlab

19.5 Source-code of MBO Algorithm in C++

19.6 Step-by-step Numerical Example of MBO Algorithm

19.7 Conclusion

References

20 Particle Swarm Optimization

Adam Slowik

20.1 Introduction

20.2 Original PSO algorithm

20.2.1 Pseudo-code of global version of PSO algorithm

20.2.2 Description of the global version of the PSO algorithm

20.2.3 Description of the local version of the PSO algorithm

20.3 Source-code of global version of PSO algorithm in Matlab

20.4 Source-code of global version of PSO algorithm in C++

20.5 Step-by-step numerical example of global version of PSO algorithm

20.6 Conclusions

References

21 Salp Swarm Optimization: Tutorial

Essam H. Houssein, Ibrahim E. Mohamed , and Aboul Ella Hassanien

21.1 Introduction

21.2 Salp Swarm Algorithm (SSA)

21.2.1 Pseudo-code of SSA algorithm

21.2.2 Description of the SSA algorithm

21.3 Source code of SSA algorithm in Matlab

21.4 Source-code of SSA algorithm in C++

21.5 Step-by-step numerical example of SSA algorithm

21.6 Conclusion

References

22 Social Spider Optimization

Ahmed F. Ali and Mohamed A. Tawhid

22.1 Introduction

22.2 Original SSO algorithm

22.2.1 Social behavior and inspiration

22.2.2 Population initialization

22.2.3 Evaluation of the solution quality

22.2.4 Modeling of the vibrations through the communal web

22.2.5 Female cooperative operator

22.2.6 Male cooperative operator

22.2.7 Mating operator

22.2.8 Pseudo-code of SSO algorithm

22.2.9 Description of the SSO algorithm

22.3 Source-code of SSO algorithm in Matlab

22.4 Source-code of SSO algorithm in C++

22.5 Step-by-step numerical example of SSO algorithm

22.6 Conclusion

References

23 Stochastic Di□usion Search: A Tutorial

Mohammad Majid al-Rifaie and J. Mark Bishop

23.1 Introduction

23.2 Stochastic Di□usion Search

23.2.1 The Mining Game

23.2.2 Re□nements in the Metaphor

23.3 SDS Architecture

23.4 Step by step example: text search

23.5 Source code

23.5.1 Matlab

23.5.2 C++

23.5.3 Python

23.6 Conclusion

References

24 Whale Optimization Algorithm

Ali R. Kashani, Charles V. Camp, Moein Armanfar, and Adam Slowik

24.1 Introduction

24.2 Original WOA

24.2.1 Pseudo-code of the WOA

24.2.2 Description of the WOA

24.3 Source-code of the WOA in Matlab

24.4 Source-code of the WOA in C++

24.5 A step-by-step numerical example of WOA

24.6 Conclusions

References

Index

### Biography

**Adam Slowik** (IEEE Member 2007; IEEE Senior Member 2012) is an Associate Professor in the Department of Electronics and Computer Science, Koszalin University of Technology. His research interests include soft computing, computational intelligence, and, particularly, bio-inspired optimization algorithms and their engineering applications. He was a recipient of one Best Paper Award (IEEE Conference on Human System Interaction - HSI 2008).