This project presents a simple implementation of the Particle Swarm Optimization (PSO) algorithm in MATLAB, applied to the Ackley benchmark function for testing global optimization.Standars Particle Swarm Optimization algorithm is defined as below :
The Ackley function is defined as:
The results was visualized as below :
As shown in the plot, the swarm successfully converges to the global minimum of the Ackley function.
The repository is organized as follows:
Main/
: Contains the main PSO algorithm and related scripts.ackley.m
: Defines the Ackley test function used for optimization.plotPSO.m
: Provides visualization of the PSO optimization process.pso.m
: Implements the PSO algorithm.
- Clone the repository to your local machine using Git:
git clone https://github.com/zeniafragaki/Particle_Swarm_Optimization.git
- Open MATLAB and change the working directory to the Main folder inside the cloned repo:
cd('path/to/Particle_Swarm_Optimization/Main')
*Check your path before running the algorithm
- Run
pso.m
to start the PSO algorithm.
*4.If you use this algorithm, try changing the upper and lower bounds in the parameters section of pso.m
, or replace Ackley’s benchmark function to observe how the PSO results change.