按照James Kennedy & Russell Eberhart (1995)的版本,算法过程如下:

[x*] = PSO()
P = Particle_Initialization();
For i=1 to it_max
  For each particle p in P do
    fp = f(p);
    If fp is better than f(pBest)
      pBest = p;
    end
  end
  gBest = best p in P;
  For each particle p in P do
    v = v + c1*rand*(pBest – p) + c2*rand*(gBest – p);
    p = p + v;
  end
end

 【NOTE】

pbest是个体在移动过程中的历史最佳位置;

gbest是全局最佳位置;

c1表示自我认知系数,c2为社会认知系数,rand是[0,1]之间的随机数。

 

C++实现代码:https://github.com/wxiaoli/PSO

相关文章:

  • 2021-11-11
  • 2022-12-23
  • 2022-01-01
  • 2022-12-23
  • 2022-12-23
  • 2021-04-11
  • 2021-10-11
猜你喜欢
  • 2021-06-15
  • 2021-12-11
  • 2021-10-15
  • 2022-02-05
  • 2022-01-01
  • 2021-08-27
相关资源
相似解决方案