We are trying to find the global minimum of Rastrigin and Rosenbrock functions using PSO. The difficulty with these functions is that they have several local minimums.
The following figure shows the Rastrigin function:
This is the result of the PSO algorithm with an initial population of 30 particles and after 100 generations:The following figure shows the Rosenbrock function:
Result of the PSO algorithm with the same parameters:
Dependencies needed:
- Numpy
- Matplotlib
Instructions to run the program:
- Run each of the files in your favorite python environment.
Remark:
- The result will be different at each run because the initialization of the particles is random.