1:初始化粒子群,初始位置:X_i, 初始速度:V_i, i = 1....M
2:更具每个栗子初始位置和速度生成新的。
3: 计算每个例子的适应度都。
4: 比较每个粒子的适应度和群体所经历过的最好位置p_id. 如果适应度值比p_id好,update
5:比较群体经历的最好p_gd
6: Vid(t+1) = wVid(t) + m1 r1[Pid -Xid(t)] +
m2r2[Pid -Xid(t)]
Xid(t+1) = Xid (t) + Vid(t+1)
Vid(t+1) : ith 粒子在t+1interation dth dimension.
Parameter: w, m1 m2 r1 r2 (0-1) depends on experience. It will results in the process fast but no most optimized solution. And there is a max verticity. [-Vmax, Vmax]
7: reach the goal, stop. Otherwise, return to step 3