Chapter 2. Backgrounds
2.3. Optimization
2.3.1. Particle Swarm Optimization
2.3.1.1. C
LASSICALPSO
Kennedy and Eberhart devise the particle swarm optimization algorithm, which is inspired by a sociological model [12][13]. Each particle represents a trial solution of the problem that we want to solve. In this algorithm, as implied by the name
“particle swarm”, a large number of particles are generated. The PSO algorithm uses these particles to carry out multi-agent parallel search. Each particle has its own memory. They can “remember” their previous best positions that make the objective function minimal or maximal. In addition, the particles communicate with each other to get the best global position that achieves the global extreme in the past. One
13
particle moves to its next position according to its previous best position and the global best position in the past. The particles repeat the same steps and they gradually converge to the final position.
In mathematics, the objective function can be expressed as
( ) (
1, , ,2 n)
f x = f x x … x Eq. 2-1
where x is the variable vector in the n-dimensional space. Here we assume that the problem we want to solve is a minimization problem and we would like to find a x* that minimizes Eq. 2-1.
First, a group of particles are initialized randomly. That is, we create a certain number of particles and allocate their initial positions and velocities randomly. The velocity defines where the corresponding particle should move to next time. The position and velocity of the i-th particle at Time t are denoted as x and it v , it respectively. The number of particles is initialized by the user. For each particle, we calculate the value of the objective function at its current position. Every particle keeps track of its best previous position that gets the extreme value of the objective function. We denote the best previous position as Pi . In the meantime, we also record the globally best position, which is denoted as P . Finally, the next velocity and g position of each particle can be calculated by Eq. 2-2 and Eq. 2-3, respectively.
( ) ( )
numbers generated from the uniform distribution over the interval [0, 1]. The aforementioned process is repeated until the stop criterion is reached. The followings are the pseudo code of the PSO algorithm.PSEUDO CODE
Initialization: Initialize the positions ( x ) and velocities (i0 v ) of N particles i0 randomly. Also initializePi and P . g
Begin
While the stop criterion is not reached For i = 1 to N
14
Evaluate the value of objective function for each particle: f x
( )
itIf f x
( )
it < f P( )
i doThe PSO algorithm is simple to implement without heavy computation load. In addition, it can find the global optimum and does not depend on the form of objective function (or fitness function). It is an effective optimization algorithm. We can utilize PSO to deal with complex, high-dimensional and nonlinear optimization problems.
2.3.1.2. D
ISCRETEB
INARYPSO
The PSO algorithm mentioned above is originally operated in continuous domain.
However, many optimization problems are actually in a discrete domain. Hence, Kennedy and Eberhart proposed the discrete binary version of PSO [14] for discrete optimization problems. The concept of discrete binary PSO algorithm is the same as the original PSO algorithm, except a few modifications over the original PSO algorithm. In the discrete binary space, the variables are only the integers 0 or 1.
Hence we re-define the objective function (or fitness function) to Eq. 2-4:
15
( ) (
1, , ,2 n)
f x = f x x … x Eq. 2-4
where x denotes an n-bit string, and xk represents the k-th bit which is 0 or 1 in the bit string. Similarly, we want to find a x to minimize Eq. 2-4. The position of the i-th * particle and its d-th bit are denoted by xi and xid. The definition of velocity is different from the original PSO. In continuous PSO, the velocity is defined for each particle.
Here each dimension has its own velocity which is denoted by vid. That is, each bit has its own velocity. Moreover, the velocity of the original PSO indicates where the corresponding particle moves to. However, when we discuss the velocity of binary PSO, we focus on each single bit and the meaning of velocities is changed. The meaning of velocity now represents the tendency of the corresponding bit to become 1.
The larger the velocity is, the more likely the corresponding bit becomes 1. Besides, with the modification of the definition of velocity, the best previous position and the best previous global position are also treated in a bitwise manner. pid denotes the best previous d-th bit of the i-th particles and pgd denotes the best previous global d-th bit.
Of course pid and pgd are either 0 or 1. With the above modifications, we rewrite the velocity updating formula to be
( ) ( )
random numbers generated from the uniform distribution over the interval [0,1]. The authors used probability to describe the tendency of bit change so the velocities have to be converted to the interval [0, 1]. They introduce the sigmoid function and modified the position-updating formula to be defined as below:( ) ( )
where rand(0,1) is a random number selected from the uniform distribution over [0, 1], and S is a sigmoid function. Eq. 2-7 is the formula of the sigmoid function.
( )
11 v
S v = e−
+ Eq. 2-7
The logistic curve of the sigmoid function is shown in Figure 2-12. This function transfers the value of vid into the interval [0, 1].
16 Figure 2-12 Sigmoid function
Basically, the binary PSO is very similar to the original PSO. Only the definition of velocity and the position-updating function are modified. The followings are the pseudo codes of the DBPSO algorithm.
PSEUDO CODE
Initialization: Initialize the positions (x ) and velocities (i0 vid0 ) of N particles randomly. Also initialize pi and pg
Begin
While the stop criterion is not reached For i = 1 to N
Evaluate the value of objective function of each particle: f x
( )
tiIf f
( )
xti < f( )
p do i ti = i
p x End do
If f
( )
pi < f( )
pg dog = i
p p End do End for For i = 1 to N
For d = 1 to n
17
The binary PSO inherits the main concept from the original PSO. The particle swarm still has “memory” in the binary PSO and the particles move toward the region that so far provides the best solution. The DBPSO is also effective for solving the discrete binary optimization problems.