PSO
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Walter Roberson
le 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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Particle Swarm dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!