This repository contains code and resources for a university course on Metaheuristics and stochastic search algorithms.
The purpose of this repository is to provide implementations of various metaheuristic algorithms in Python and C++. It covers topics such as Genetic Algorithms, Simulated Annealing, Multi-Verse Optimizer, and more.
The Python implementations in this repository for GWO [1][2], MVO [3][4], and ALO [5][6] are adapted from the MATLAB implementations by Dr. Seyedali Mirjalili.
Algorithm | Python | C++ |
---|---|---|
Genetic Algorithms (incomplete) | ❌ | ✅ |
Tabu Search | ❌ | ✅ |
Simulated Annealing | ❌ | ✅ |
Grey Wolf Optimizer | ✅ | ❌ |
Multi-Verse Optimizer | ✅ | ❌ |
Ant Lion Optimizer | ✅ | ❌ |
To get started with this repository, follow these steps: Clone the repository:
git clone -b main --single-branch [https://github.com/Samashi47/Metaheuristics]
Navigate to the directory of the cloned repository:
cd Metaheuristics
Create a virtual environment in the repository by typing the followwing command:
python -m venv /path/to/repo/on/your/local/machine
After cloning the project and creating your venv, activate the venv by:
.venv\Scripts\activate
You can run the following command to install the dependencies:
pip3 install -r requirements.txt
Note
You should run the main scripts of the ALO, GWO, and MVO algorithms from the base directory so that they can access the common folder that has the Utils class in it (e.g. python '.\Grey Wolf Optimizer\main.py'
).
Compile the C++ files. For example, to run the Simulated Annealing
implementation, you can compile the sa.cpp
file in the Simulated Annealing
folder using g++:
g++ -o sa sa.cpp
Run the compiled file:
./sa
Contributions to this repository are welcome. If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.
For any questions or inquiries, please contact the owner of this repository or open an issue.
Happy coding!
@misc{Samady,
title={Samashi47/metaheuristics: Implementation of various metaheuristic algorithms in C++ and python},
url={https://github.com/Samashi47/Metaheuristics},
journal={GitHub},
author={Samady, Ahmed}
}
Samady, A. Samashi47/metaheuristics: Implementation of various metaheuristic algorithms in C++ and python. GitHub. https://github.com/Samashi47/Metaheuristics
[1] Seyedali Mirjalili (2024). Grey Wolf Optimizer (GWO) MATLAB Central File Exchange. Retrieved April 22, 2024.
[2] Mirjalili, S., Mirjalili, S. M., & Lewis, A. (2014). Grey Wolf Optimizer. Advances in Engineering Software, 69, 46–61. doi:10.1016/j.advengsoft.2013.12.007
[3] Seyedali Mirjalili (2024). Multi-Verse Optimizer (MVO) MATLAB Central File Exchange. Retrieved April 22, 2024.
[4] Mirjalili, S., Mirjalili, S. M., & Hatamlou, A. (2015). Multi-Verse Optimizer: a nature-inspired algorithm for global optimization. Neural Computing and Applications, 27(2), 495–513. doi:10.1007/s00521-015-1870-7
[5] Seyedali Mirjalili (2024). Ant Lion Optimizer (ALO) MATLAB Central File Exchange. Retrieved April 22, 2024.
[6] Mirjalili, S. (2015). The Ant Lion Optimizer. Advances in Engineering Software, 83, 80–98. doi:10.1016/j.advengsoft.2015.01.010 \