WOLFRAM|DEMONSTRATIONS PROJECT

Particle Swarm Optimization for 1D Problems

​
swarm size
10
iteration
0
test function parameters
a
0.1
b
2
Particle swarm optimization (PSO) comes from the pioneering work of Kennedy and Eberhart [1, 2]. PSO algorithms mimic the social behavior patterns of organisms that live and interact within large groups, such as swarms of bees. This optimization technique is used to find the minimum of the following 1D test function:
f(x)=a
2
x
+cos(πx)-bsin(2πx)+cos(3πx)sin(πx)
, with
x∈[-10,10]
; you can vary the parameters
a
and
b
. For the global minimum of
f(x)
, perfect agreement is found using either the Mathematica built-in command NMinimize (the green square) or PSO (the red dots) with the appropriate number of iterations. You can vary the number of iterations as well as the swarm size. However, notice the complementary effect of these parameters. Here, the problem is one-dimensional, but extension to multidimensional problems using the program is straightforward.