PSO
2 views (last 30 days)
Show older comments
sir
I am dealing with the PSO algorithm given in the matlab file exchange (i.e)Pso.m .In that i have changed the velocity equation to get Time varying acceleration factors as
c1i=c2f=2.5;c1f=c2i=0.5;
ac1=(c1f-c1i)*(i/me)+C1i;
ac2=(c2f-c2i)*(i/me)+c2i;
now i have the variable acceleration coeffiecients and the velocity eqn is
v(i+1)=w(i)*v(i)+ac1*rand*(pbest(i)-x(i))+ac2*rand*(gbest(i)-x(i));
x(i+1)=x(i)+v(i+1)
now when i run with this it is giving different answers each time i run it. Plz help me such that I get the same answer whenever I did it.
0 Comments
Accepted Answer
Walter Roberson
on 22 Mar 2012
You have rand() in your code. Of course you are going to get different answers each time you run it.
The work-around is to re-seed the random number generator to a constant value before running the code. The easiest method of reseeding the random number generator depends upon your MATLAB version.
0 Comments
More Answers (0)
See Also
Categories
Find more on Particle Swarm in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!