Particle swarm optimization: Difference between revisions

Javascript: bugfix
(Javascript draft: TODO - implement and run the Michalewicz function)
(Javascript: bugfix)
Line 169:
vel[j][k]= p.omega*y.vel[j][k] + p.phip*rp*(bpos[j]-y.pos[j]) + p.phig*rg*(gbpos-y.pos[j]);
pos[j][k]= y.pos[j]+vel[j][k];
ok= ok && y.min[k]>pos[j][k] || y.max<pos[j][k];}
if (!ok)
for (var k= 0; k < y.nDims; k++)
pos[j][k]= y.min[k] + (y.max[k]-y.min[k])*Math.random()}
return {
iter: 1+y.iter,
Line 241:
 
Iteration: 40
GlobalBestPosition: -12.5664840295445174,2.019885845016688
GlobalBestValue: 201.979425538604204468803004459177</lang>
 
 
=={{header|ooRexx}}==
6,951

edits