필터 지우기
필터 지우기

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