While there exist many introductory materials on Particle Swarm Optimization (PSO), it is best to have an intuitive example, simple, understandable at first reading, and illustrative. I personally do not like those examples that try to bring all intricacies together. Here comes the simplest example I guess: to find a minimum for the function:
It is know that the optimal solution is found when x=-1, and the minimum is f(x)=0;
The below video demonstrate the results of finding this optimal solution using PSO based approach:
As you can see, after some initial random movements of the design variables, the design variable gradually converges to x=-1 (the black curve) and the optimal value reaches 0.
The basic procedures to implement this PSO based approach are as follows:
[1] Create a collection of particles, each particle represents an instance of the design variable. In this case, the design variable is a scalar-valued single parameter:
%Initialize a particle swarm with nParticals |
[2] For these particles, evaluate their performances:
for i=1:length(x) |
[3] Find the best of these particles, which generates the minimum errors
ErrMat=cell2mat(err); % Convert cell to array |
[4] The minimum value got so far is both the local best and the global best, keep them down for later use:
lBestX=x{idx}; % Local best |
[5] For each particles, move them according to the formula:
alpha1=2.0; % Local best influence; |
For details of these parameters and their physical meanings, Google “Particle Swarm Optimization”, a quick view of the result goes here.
[6] Terminate when the some conditions are met:
while gBestY> 1e-6 |
Here, RunMoveOnce() refers to the process described in [5].
The Matlab files can be download it below. Enjoy!
hamid
September 16, 2011 at 1:02 pm
Thank You. It is the simplest explanation of PSO I have ever read.
aloui mourad
November 1, 2012 at 3:35 pm
great work , i wish if you can help me and send me all the program my brother
Panagiotis
January 16, 2016 at 9:26 pm
Hello, i cant seem to download the files u posted. Can u please check it out?
Thanks in advance.
mourad
January 24, 2016 at 11:29 pm
the file doesn’t exist !!!!!!!!!!!!