In computational science, particle swarm optimization (PSO)[1] is a computational method that optimizes a problem by iteratively trying to improve a candidate solution with regard to a given measure of quality. It solves a problem by having a population of candidate solutions, here dubbed particles, and moving these particles around in the search-space according to simple mathematical formulae over the particle's position and velocity. Each particle's movement is influenced by its local best known position, but is also guided toward the best known positions in the search-space, which are updated as better positions are found by other particles. This is expected to move the swarm toward the best solutions.
在计算机科学中,离子群算法是一个通过迭代优化候选解的适应度的计算问题的最优解的方法。它利用候选解的种群解决问题,这里称为粒子,并且在搜素空间中基于粒子的位置和速度的简单数学公式移动这些粒子。每个粒子的移动受它局部已知最佳位置的影响,但是也向搜索空间的已知最佳位置移动,该最佳位置是被群体中其他粒子发现的。这里,我们期待群体向着最佳解移动。
PSO is a metaheuristic as it makes few or no assumptions about the problem being optimized and can search very large spaces of candidate solutions. However, metaheuristics such as PSO do not guarantee an optimal solution is ever found. Also, PSO does not use the gradient of the problem being optimized, which means PSO does not require that the optimization problem be differentiable as is required by classic optimization methods such as gradient descent and quasi-newton methods.
离子群是元启发式算法,它做了更少或者不做关于被优化问题的假设,且能搜索很大的候选解空间。然而,元启发算法例如离子群不能保证一定能发现最优解。并且,离子群不用对目标函数求梯度,这意味着离子群不像经典的优化问题,例如梯度下降和奎西——牛顿算法一样要求目标问题可微。
A basic variant of the PSO algorithm works by having a population (called a swarm) of candidate solutions (called particles). These particles are moved around in the search-space according to a few simple formulae.[9] The movements of the particles are guided by their own best known position in the search-space as well as the entire swarm's best known position. When improved positions are being discovered these will then come to guide the movements of the swarm. The process is repeated and by doing so it is hoped, but not guaranteed, that a satisfactory solution will eventually be discovered.
一种基本的离子群变体算法是通过求解候选解的解集——种群(蜂群)。这些粒子在搜索空间基于一些简单的公式移动。粒子的运动在搜索空间被自身的已知最佳位置引导,同时也被整个群体的最佳位置引导。当一个被优化位置被发现,这些(粒子)将会引导群体的移动。这个过程将会重复,通过重复迭代希望但不能保证最终会发现符合条件的解。
Formally, let f: ℝn → ℝ be the cost function which must be minimized. The function takes a candidate solution as an argument in the form of a vector of real numbers and produces a real number as output which indicates the objective function value of the given candidate solution. The gradient of f is not known. The goal is to find a solution a for which f(a) ≤ f(b) for all b in the search-space, which would mean a is the global minimum.
形式上,设 f : ℝn → ℝ为需要求最小值的损失函数。函数用一个候选解(以实数矩阵的形式)作为依据,生成一个实数作为输出,指示了给定候选解的目标函数值。函数f的梯度未知。目标是发现一个解a,对于所有在搜索空间里的解b满足 f(a) ≤ f(b),这意味着a是全局最小解。
Let S be the number of particles in the swarm, each having a position xi ∈ ℝn in the search-space and a velocity vi ∈ ℝn. Let pi be the best known position of particle i and let g be the best known position of the entire swarm. A basic PSO algorithm is then:[10]
设S是粒子的数目,每个粒子在搜索空间里都有一个位置xi ∈ ℝn 和速度vi ∈ ℝn . 设pi为粒子i的已知最优位置,并设g为蜂群的最佳已知未知。一个基础的离子群算法是:
for each particle i = 1, ..., S do Initialize the particle's position with a uniformly distributed random vector: xi ~ U(blo, bup) Initialize the particle's best known position to its initial position: pi ← xi if f(pi) < f(g) then update the swarm's best known position: g ← pi Initialize the particle's velocity: vi ~ U(-|bup-blo|, |bup-blo|) while a termination criterion is not met do: for each particle i = 1, ..., S do for each dimension d = 1, ..., n do Pick random numbers: rp, rg ~ U(0,1) Update the particle's velocity: vi,d ← ω vi,d + φp rp (pi,d-xi,d) + φg rg (gd-xi,d) Update the particle's position: xi ← xi + lr vi if f(xi) < f(pi) then Update the particle's best known position: pi ← xi if f(pi) < f(g) then Update the swarm's best known position: g ← pi
The values blo and bup represent the lower and upper boundaries of the search-space respectively. The termination criterion can be the number of iterations performed, or a solution where the adequate objective function value is found.[11] The parameters ω, φp, and φg are selected by the practitioner and control the behaviour and efficacy of the PSO method (below). lr represents the learning rate (0 ≤ lr ≤ 1.0), which is the proportion at which the velocity affects the movement of the particle (where lr = 0 means the velocity will not affect the particle at all and lr = 1 means the velocity will fully affect the particle).
blo 和 bup代表搜索空间的上下界。迭代次数是最终的准则,或者找到一个能充分满足目标函数的解。参数ω, φp, 和 φg是训练者选择的,控制离子群方法的行为和有效性。Ir[0,1]表示学习率。是速度影响粒子移动的一个部分。