PSO

1 次查看(过去 30 天)
vydyam
vydyam 2012-3-5
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.

采纳的回答

Walter Roberson
Walter Roberson 2012-3-22
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 个)

类别

Help CenterFile Exchange 中查找有关 Particle Swarm 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by