最详细的PSO算法通过Java实现,附带详细注释
介绍地址:https://blog.csdn.net/HYL51740740/article/details/106105925
private static int M=200; //迭代次数
private static int numParticles=50; //粒子数
private static int dimension=3; //粒子维数
private static double[][] pBest = new double[numParticles][dimension]; //存储各粒子的历史最优位置信息
private static double[][] xPos = new double[numParticles][dimension]; //存储各粒子的当前位置信息
private static double[][] xVel = new double[numParticles][dimension]; //存储各粒子的速度信息
private static double[] gBest = new double[dimension]; //存储全局最优解对应的位置信息
private static double[] fitness = new double[numParticles]; //存储各粒子适应值
1