PSO
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Akzeptierte Antwort
Walter Roberson
am 22 Mär. 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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Particle Swarm finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!