zoukankan      html  css  js  c++  java
  • 最基本PSO算法的C++实现

    按照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

  • 相关阅读:
    hadoop 配置
    spark 学习网站和资料
    spark-submit 提交任务及参数说明
    python 浮点运算
    nginx 和 php
    clojure 语法
    编程语言
    spark
    mvn 与 pom.xml
    偏导数与偏微分
  • 原文地址:https://www.cnblogs.com/wxiaoli/p/5557797.html
Copyright © 2011-2022 走看看