Implemention Of Particle Swarm Optimization Algorithm in C++ With Simple Environment
particle swarm optimization (PSO) is a metaheuristic optimization algorithm it optimizes a problem by iteratively trying to improve a candidate solution with regard to a given measure of quality.
our environment is a simple image and generate a random goal (Green Circle) then with pso we can predict that.
sudo apt install libopencv-dev
in your main file, include pso header and write your fitness function
then set instance of pso and set your parameters. then call optimize
function and pass the fitness function in optimize parameter . EASY :)
Recommended : Delete environment for your tasks
#include "PSO.h"
auto fitnessfunction()
{}
auto main() -> int
{
PSO pso;
pso.set_c1(0.2);
pso.set_c2(1.8);
auto result = pso.optimize(fitnessfunction);
}
cmake .
make
./pso
make clean
This project is licensed under the MIT License - see the LICENSE file for details
Feel free to use, modify this code. And please feel free to fork the code from Github and send pull requests.
Report any comment or bugs to:
fathierfan97@gmail.com
Regards,
Erfan Fathi