CO423 - Swarm and Evolutionary Computing - Notes by V Daneesha
CO423 - Swarm and Evolutionary Computing - Notes by V Daneesha
EVOLUTIONARY
COMPUTING
Lecture Notes
Swarm and Evolutionary Computing V Daneesha
1. Contents
1. Contents .......................................................................................................................................... 1
Chapter 1 - Introduction to Evolutionary Computing ........................................................................... 2
1. Background ................................................................................................................................... 2
2. Optimization .................................................................................................................................. 3
3. Global Optimization ..................................................................................................................... 4
4. Evolutionary Computing .............................................................................................................. 6
5. Evolutionary Algorithm ............................................................................................................... 9
6. Components of evolutionary algorithms ................................................................................... 10
7. General Evolutionary Algorithm ............................................................................................... 16
8. Evolution Strategies .................................................................................................................... 16
9. Learning Classifier Systems ....................................................................................................... 21
10. Parameter Control ...................................................................................................................... 24
11. Multimodal Problems .................................................................................................................. 27
Chapter 2 -Swarm Intelligence............................................................................................................. 30
1. Introduction to Swarm Intelligence........................................................................................... 30
2. Applications of Swarm Intelligence in Optimization Problems .............................................. 32
3. Particle swarm optimization (PSO) ........................................................................................... 33
Page 1 of 40
Swarm and Evolutionary Computing V Daneesha
An example is that of a weather forecast system. In this case, the inputs are the
meteorological data regarding, temperature, wind, humidity, etc. The output can be
prediction of rainfall.
1.2. Modelling or system identification problem
Corresponding sets of inputs and outputs are known, and a model of the system is
sought that delivers the correct output for each known input .
These occur frequently in data mining and machine learning
Page 2 of 40
Swarm and Evolutionary Computing V Daneesha
let us consider the travelling salesman problem. In the abstract version, we are given a
set of cities and have to find the shortest tour which visits each city exactly once. For
a given instance of this problem, we have a formula (the model) that for each given
sequence of cities (the inputs) will compute the length of the tour (the output). The
problem is to find an input with a desired output, that is, a sequence of cities with
optimal (minimal) length. Note that in this example the desired output is defined
implicitly. That is, rather specifying the exact length, it is required that the tour should
be shorter than all others, and we are looking for inputs realising this.
2. Optimization
Optimization involves finding the best solution from all possible solutions for a given
problem.
In mathematical terms, an optimization problem aims to maximize or minimize an
objective function subject to certain constraints.
Minimize (or Maximize) f(x)
Subject to: gi(x)≤0,i=1,2,…,m
hj(x)=0,j=1,2,…,p
Where:
f(x) is the objective function.
gi(x) are inequality constraints.
hj(x) are equality constraints.
x is the vector of decision variables.
Page 3 of 40
Swarm and Evolutionary Computing V Daneesha
3. Global Optimization
3.1.Local Maximum and Minimum
Page 4 of 40
Swarm and Evolutionary Computing V Daneesha
Page 5 of 40
Swarm and Evolutionary Computing V Daneesha
4. Evolutionary Computing
Evolutionary Computing (EC) is a branch of artificial intelligence that draws inspiration
from the process of natural evolution to solve complex optimization problems.
The motivation behind EC is rooted in the limitations of traditional optimization
techniques, especially when dealing with complex, high-dimensional, and nonlinear
problems.
4.1. Positioning of EC
EC is part of computer science.
It is not part of life science/biology. It’s only biology derived inspiration and terminology.
Path: Computer Science Artificial Intelligence Computational Intelligence EC
Page 6 of 40
Swarm and Evolutionary Computing V Daneesha
Page 7 of 40
Swarm and Evolutionary Computing V Daneesha
Evolutionary computation (EC) refers to computer-based problem solving systems that use
computational models of evolutionary processes, such as natural selection, survival of the
fittest and reproduction, as the fundamental components of such computational systems.
Page 8 of 40
Swarm and Evolutionary Computing V Daneesha
5. Evolutionary Algorithm
Evolution via natural selection of a randomly chosen population of individuals can be
thought of as a search through the space of possible chromosome values.
In that sense, an evolutionary algorithm (EA) is a stochastic search for an optimal
solution to a given problem.
Page 9 of 40
Swarm and Evolutionary Computing V Daneesha
“In nature, every creature has a body and a set of behaviours. They are known as
its phenotype, which is the way a creature appears and behave. Hair, eyes and skin
colour are all part of your phenotype. The look of a creature is mostly determined by a
set of instructions written in its own cells. This is called genotype, and it refers to the
information that is carried out, mostly in our DNA. While the phenotype is how a house
looks like once its built, the genotype is the original blueprint that drove
its construction. The first reason why we keep phenotype and genotype separate is
simple: the environment plays a huge role in the final look of a creature. The same
house, built with a different budget, could look very different.
Page 10 of 40
Swarm and Evolutionary Computing V Daneesha
The environment is, in most cases, what determines the success of a genotype.
In biological terms, surviving long enough is succeeding. Successful creatures have a
higher chance of reproducing, transmitting their genotype to their offspring. The
information to design the body and the behaviours of each creature is store in its DNA.
Every time a creature reproduces, its DNA is copied and transmitted to its offspring.
Random mutations can occur during the duplication process, introducing changes in the
A complex relationship can exist between the genotype and phenotype. Two such
relationships are:
Examples:
In genetic algorithms, the chromosome could be a binary string like 101010, where
each bit represents a decision variable.
Page 11 of 40
Swarm and Evolutionary Computing V Daneesha
The fitness function is crucial because it evaluates how good a potential solution is. It's akin to
the concept of "survival of the fittest" in nature, where only the fittest organisms reproduce.
Fitness Calculation: The fitness function maps the chromosome to a scalar value that
quantifies its quality as a solution. This value is then used for selection, reproduction,
and other operations.
Constraints: Fitness functions often include penalties for violating constraints. For
example, in a scheduling problem, a solution that violates time constraints might have
its fitness reduced.
Examples:
The initial population is the starting point for the evolutionary process. Its diversity affects the
algorithm's ability to explore the search space.
Page 12 of 40
Swarm and Evolutionary Computing V Daneesha
A summary of the most frequently used selection operators are given in the subsections below.
That is, the probability of an individual being selected, e.g. to produce offspring, is
directly proportional to the fitness value of that individual. This may cause an individual
to dominate the production of offspring, thereby limiting diversity in the new
population. This can of course be prevented by limiting the number of offspring that a
single individual may produce.
In roulette wheel sampling the fitness values are normalized, usually by dividing each
fitness value by the maximum fitness value. The probability distribution can then be
thought of as a roulette wheel, where each slice has a width corresponding to the
Page 13 of 40
Swarm and Evolutionary Computing V Daneesha
Tournament Selection: A subset of the population is chosen randomly, and the fittest
individual in this subset is selected. This method avoids some of the pitfalls of
proportional selection, such as premature convergence.
The advantage of tournament selection is that the worse individuals of the population
will not be selected, and will therefore not contribute to the genetic construction of the
next generation, and the best individual will not dominate in the reproduction process
Rank-Based Selection: Instead of using fitness values directly, individuals are ranked,
and selection probabilities are assigned based on rank.
Rank-based selection uses the rank ordering of the fitness values to determine the
probability of selection and not the fitness values itself. This means that the selection
probability is independent of the actual fitness value. Ranking therefore has the
advantage that a highly fit individual will not dominate in the selection process as a
function of the magnitude of its fitness. One example of rank-based selection is non-
deterministic linear sampling, where individuals are sorted in decreasing fitness value.
The first individual is the most fit one. The selection operator is defined as
Page 14 of 40
Swarm and Evolutionary Computing V Daneesha
These nonlinear selection operators bias toward the best individuals, at the cost of
possible premature convergence.
Elitism: Elitism involves the selection of a set of individuals from the current
generation to survive to the next generation. The number of individuals to survive to
the next generation, without being mutated, is referred to as the generation gap. If the
generation gap is zero, the new generation will consist entirely of new individuals. For
positive generation gaps, say k, k individuals survive to the next generation. These can
be
the k best individuals, which will ensure that the maximum fitness value does
not decrease, or
k individuals, selected using any of the previously discussed selection operators.
Crossover: Combines genetic material from two parents to produce offspring. Various
methods exist, such as single-point crossover (where the chromosome is split at a
random point) and uniform crossover (where genes are randomly swapped between
parents).
Mutation: Introduces random changes to the chromosome to explore new areas of the
search space. The aim of mutation is to introduce new genetic material into an existing
individual, thereby enlarging the search-space. Mutation usually occurs at a low
probability. A large mutation probability distorts the genetic structure of a chromosome
- the disadvantage being a loss of good genetic material in the case of highly fit
individuals.
Examples:
Reproduction operators are usually applied to produce the individuals for the next generation.
Reproduction can, however, be applied with replacement. That is, newly generated individuals
replace parents if the fitness of the offspring is better than the parents; if not, the offspring do
not survive to the next generation.
Page 15 of 40
Swarm and Evolutionary Computing V Daneesha
8. Evolution Strategies
Evolution Strategies (ES) are a class of evolutionary algorithms that focus on optimizing real-
valued parameters. Originating in the 1960s, they were developed by Ingo Rechenberg and
Hans-Paul Schwefel at the Technical University of Berlin. The primary goal of ES is to
optimize continuous functions, especially for real-world engineering problems.
The core idea is to generate a population of solutions, apply random variations, and
then select the best solutions for the next generation.
Evolution Strategies involve several core concepts, including chromosome
representation, selection, mutation, and crossover operators. These components work together
to drive the evolutionary process and produce optimized solutions.
Page 16 of 40
Swarm and Evolutionary Computing V Daneesha
The fitness function f(x) evaluates the quality of the solution x. The goal is to maximize or
minimize f(x).
In ES, each individual (solution) is represented by a chromosome that consists of two parts:
genetic material and strategy parameters. The genetic material represents the actual solution
to the problem, while the strategy parameters control the evolutionary process, particularly
mutation.
Including rotation angles enables the algorithm to adjust the mutation steps more effectively,
improving the search trajectory alignment with the problem's landscape.
Evolution strategies use the three main operators of EC, namely selection, crossover and
mutation.
Selection operators in ES are responsible for choosing the individuals that will pass their
genes to the next generation. Two primary strategies are used:
(𝜇 + 𝜆) Selection:
o 𝜇 parents produce 𝜆 offspring.
o The best 𝜇 individuals are selected from both the parent and offspring
populations.
o This strategy implements elitism, ensuring that the best solutions are always
carried forward.
(𝜇, 𝜆) Selection:
o 𝜇 parents generate 𝜆 offspring.
Page 17 of 40
Swarm and Evolutionary Computing V Daneesha
o Only the best 𝜇 individuals are selected from the offspring, with no guarantee
that parents survive.
o This strategy promotes diversity by preventing the dominance of existing
solutions.
Crossover operators differ in the number of parents used to produce a single offspring.
Local Crossover:
o Offspring are generated by combining randomly selected components from
two parents.
o This method maintains the local structure of parent genes while introducing
new combinations.
Global Crossover:
o The entire population contributes to the creation of offspring.
o Components are randomly selected from different individuals, resulting in
greater diversity.
In both local and global cross over, recombination is done in one of two ways:
Discrete Recombination:
o The offspring directly inherit genes from either parent.
o This method keeps the genes intact and straightforward.
Intermediate Recombination:
𝑥𝑖1 +𝑥𝑖2
o The offspring's genes are the average of the parents' genes, e.g., 𝑥𝑖 =
2
o This method is useful for real-valued optimization problems where
intermediate values often provide better solutions.
The mutation step size p is adjusted based on the success rate of previous
mutations. The 1/5th success rule is often applied, where the step size increases if
more than 1/5 of the mutations are successful:
1
𝜎𝑔 ⋅ 𝑐𝑑 if𝑠𝑔 <
𝜎𝑔+1 = { 5
1
𝜎𝑔 ⋅ 𝑐𝑖 if𝑠𝑔 =
5
Page 18 of 40
Swarm and Evolutionary Computing V Daneesha
When correlation information (e.g., rotational angles) is included, the mutation process
involves:
Each of these operators plays a critical role in ensuring that the population evolves effectively
towards optimal solutions.
i. (1+1) ES: A simple two-membered ES where one parent generates one offspring. The
offspring is accepted if it has better fitness than the parent. Otherwise, the parent is
retained. This is an elitist strategy.
ii. (1,1) ES: Similar to (1+1) ES but without elitism. The offspring always replaces the
parent, even if it is worse.
iii. (𝝁 + 𝝀) ES: A multi-membered ES where μ parents generate λ offspring. The best μ
individuals from both parents and offspring are selected for the next generation.
Selection: Elitist; the best individuals, including parents and offspring, are
retained.
Mutation: Gaussian perturbation with adaptive step sizes.
Advantage:
o This strategy ensures that the best solutions are always preserved, leading
to steady progress towards the optimal solution.
o Suitable for static optimization problems where retaining good solutions is
crucial.
iv. (μ, λ) ES: Similar to (μ + λ) ES, but only the λ offspring are considered for selection,
discarding the parents. This is beneficial for escaping local optima.
Selection: Non-elitist; only offspring contribute to the next generation.
Page 19 of 40
Swarm and Evolutionary Computing V Daneesha
Advantage:
o This strategy is more exploratory and can escape local optima by not
retaining older solutions.
o Suitable for dynamic optimization problems and multimodal functions
where diversity is important.
Page 20 of 40
Swarm and Evolutionary Computing V Daneesha
Page 21 of 40
Swarm and Evolutionary Computing V Daneesha
LCS research was reinvigorated in the mid-1990s by Wilson who removed the concept of
memory and stripped out all but the essential components in his minimalist ZCS algorithm . At
the same time several authors were noting the conceptual similarity between LCS and
reinforcement learning algorithms which attempt to learn, for each input state, an accurate
mapping from possible actions to expected rewards. The XCS algorithm firmly established this
link by extending rule-tuples to {condition:action:payoff,accuracy}, where the accuracy value
reflects the system’s experience of how well the predicted payoff matches the reward received.
Unlike ZCS, the EA is restricted at each cycle — originally to the match set, latterly to the
action set, which increases the pressure to discover generalised conditions for each action. As
per ZCS, a credit assignment mechanism is triggered by the receipt of rewards from the
environment to update the predicted pay-offs for rules in the previous action set. However, the
major difference is that these are not used directly to drive selection in the evolution process.
Instead selection operates on the basis of accuracy, so the algorithm can in principle evolve a
Page 22 of 40
Swarm and Evolutionary Computing V Daneesha
complete mapping from input space to actions. Table below gives a simple overview of the
major features of Michigan-style classifiers for a problem with a binary input and output space.
The Pittsburgh-style LCS predates, but is similar to the better-known GP: each member of the
evolutionary algorithm’s population represents a complete model of the mapping from input to
output spaces. Each gene in an individual typically represents a rule, and again a new input
item may match more than one rule, in which case typically the first match is taken. This means
that the representation should be viewed as an ordered list, and two individuals which contain
the same rules, but in a different order on the genome, are effectively different models.
Learning of appropriately complex models is typically facilitated by using a variable-length
representation so that new rules can be added at any stage. This approach has several conceptual
advantages — in particular, since fitness is awarded to complete rule sets, models can be
learned for complex multi-step problems. The downside of this flexibility is that, like GP,
Pittsburgh-style LCS suffers from bloat and the search space becomes potentially infinite.
Nevertheless, given sufficient computational resources, and effective methods of parsimony to
counteract bloat, Pittsburgh-style LCS has demonstrated state-of-the-art performance in several
machine learning domains, especially for applications such as bioinformatics and medicine,
where human-interpretability of the evolved models is vital and large data-sets are available so
that the system can evolve off-line to minimise prediction error. Two recent examples winning
Humies Awards for better than human performance are in the realms of prostate cancer
detection and protein structure prediction
Page 23 of 40
Swarm and Evolutionary Computing V Daneesha
𝑡
𝜎(𝑡) = 1 − 0.9 ⋅
𝑇
This approach enables finer search control as the algorithm progresses, aiding in convergence.
Page 24 of 40
Swarm and Evolutionary Computing V Daneesha
Adaptive control uses feedback from the algorithm's performance to adjust parameters. This
feedback can be based on various aspects, such as the success of certain operations or the
diversity of the population.
If more than 1/5 of mutations are successful, increase the step size.
If fewer than 1/5 are successful, decrease the step size.
𝜎/𝑐 if𝑝𝑠 > 1/5,
𝜎 = {𝜎 ⋅ 𝑐 if𝑝𝑠 < 1/5,
′
𝜎 if𝑝𝑠 = 1/5,
where c is a constant, and is the success ratio.
Adaptive control can be more responsive and improve algorithm efficiency during execution.
In self-adaptive control, the parameters themselves are treated as variables within the algorithm
and evolve along with the solutions. Parameters such as mutation rates or crossover
probabilities are encoded in the chromosomes and are subject to the same evolutionary
operators.
Each individual in the population includes both the solution and the mutation step size.
𝜎 ′ = 𝜎 ⋅ 𝑒 𝜏⋅𝑁(0,1)
𝑥𝑖′ = 𝑥𝑖 + 𝜎 ′ ⋅ 𝑁(0,1)
This approach allows the algorithm to naturally adapt the parameters based on their impact on
the search process.
Deterministic: The mutation step size can decrease over generations, such as:
𝑡
𝜎(𝑡) = 1 − 0.9 ⋅ 𝑇
Adaptive: Using Rechenberg 's 1/5 success rule.
Self-adaptive: Each individual carries its mutation step size that evolves.
Page 25 of 40
Swarm and Evolutionary Computing V Daneesha
What is Changed?
Scope of Changes
Gene-Level: Changes affect individual genes.
Individual-Level: Changes affect entire individuals.
Population-Level: Changes affect the entire population.
Page 26 of 40
Swarm and Evolutionary Computing V Daneesha
In EAs, multimodality is a common characteristic, and they are often employed to either:
1. Locate the global optimum, especially in cases where local optima are misleading.
2. Identify multiple high-fitness solutions, which correspond to different local optima.
This scenario is useful in practical problems where multiple viable solutions are
required.
Example: Consider the design of a new product where different design options need to be
evaluated. The fitness function might evolve as decisions about materials, functionality, and
aesthetics are made. In such a dynamic scenario, it is beneficial to examine several design
options to allow flexibility in future stages.
Genetic Drift Example: Imagine a population with two equally fit niches, each initially
containing 50% of the population. Due to random selection effects, one niche may eventually
dominate. For instance, if one niche slightly outnumbers the other (51% vs. 49%), the EA will
increasingly favor the more populous niche until only one niche remains.
1. Genotype Space: Represents the set of all possible solutions. Diversity in this space
can be maintained using distance metrics (e.g., Manhattan distance).
2. Phenotype Space: The actual solution space, where diversity is based on the
differences between solutions.
3. Algorithmic Space: Represents how the EA operates, such as population structure or
distribution across different processors.
Page 27 of 40
Swarm and Evolutionary Computing V Daneesha
Process:
Effect: Individuals within densely populated niches will have lower fitness, reducing their
chances of selection and encouraging the population to spread across multiple niches.
11.3. Crowding
Crowding is another explicit approach where new individuals replace similar ones in the
population, ensuring that diversity is maintained.
Crowding Process:
Deterministic Crowding: A variant where offspring compete with their parents for survival,
ensuring that similar solutions don't crowd out diverse ones.
11.4. Speciation
Automatic Speciation introduces mating restrictions to promote diversity. In this approach,
individuals are grouped into species based on their characteristics, and they only mate within
their species. This approach mimics biological evolution and maintains diversity by preventing
the mixing of very different solutions.
Implementation:
Page 28 of 40
Swarm and Evolutionary Computing V Daneesha
Page 29 of 40
Swarm and Evolutionary Computing V Daneesha
Definition: Swarm Intelligence (SI) refers to the collective, decentralized, and self-
organized behavior of a group of individuals or agents. These individuals interact
locally with one another and their environment, resulting in the emergence of complex,
coordinated behaviors.
Origin of the Term: The term Swarm Intelligence was introduced by Beni and Wang
in connection with cellular robotic systems. They developed algorithms for controlling
robotic swarms. An earlier example of utilizing the concept of flocking behavior was
in 1987 when Reynolds developed a program to simulate the motion of bird flocks.
The swarm consists of simple, dynamic, and active agents with little inherent
knowledge of the environment. This cooperative behavior leads to the emergence of
intelligent search strategies that are more efficient than random searches.
Page 30 of 40
Swarm and Evolutionary Computing V Daneesha
These phases help in maintaining the balance between exploration (discovering new solutions)
and exploitation (refining known good solutions) within the swarm
i. Self-Organization
Swarm intelligence systems are self-organizing, meaning ordered patterns and behaviours
arise from local interactions between individuals without centralized control. According to
Bonabeau et al., self-organization involves:
Positive Feedback: Reinforces the formation of favourable structures. It promotes
diversity and exploration in swarm intelligence.
Negative Feedback: Stabilizes the collective behaviour and helps exploit known
solutions.
Fluctuations: Introduces randomness, helping the system escape from local optima.
Multiple Interactions: Individuals learn from interactions with others, improving the
overall intelligence of the swarm.
iii. Flexibility
SI systems can adapt to changes in the environment.
iv. Robustness
They can withstand individual failures without collapse.
Page 31 of 40
Swarm and Evolutionary Computing V Daneesha
Particle swarm optimization and Ant colony optimization are the most popular ones.
PSO was developed by Kennedy and Eberhart in 1995, inspired by the social behaviour of bird
flocks and fish schools.
Typically, a flock of birds have no leader and they find food by collaborative trial and error.
They follow one of the members of the group that has the closest position with the food source.
Others update their position simultaneously by communicating with members who already
have a better position. This is done repeatedly until the best food source is found. Particle
swarm optimization consists of a population of individuals called swarm, and each individual
is called a particle, which represents a location or possible candidate solution in a
multidimensional search space.
Over time, the swarm converges toward the best solution. PSO has been widely used in
continuous optimization problems, such as parameter tuning and function optimization.
ACO is inspired by the foraging behaviour of ants. Ants are able to find the shortest
path between their nest and a food source using pheromones.
Ant Colony Optimization is the first successful example of swarm intelligence. The algorithm
was introduced to find the optimal path in a graph. A group of ants starts food foraging
randomly. Once an ant finds a food source, it exploits the same and returns to the nest leaving
pheromones on the path. The concentration of this pheromone can guide other ants in searching
for food. When other ants find the pheromones they follow the path with a probability
proportional to the concentration of the pheromone. Now if other ants also able to find the food
source, they also leave pheromones during their return to the nest. As more ants find the path,
the concentration of pheromone gets stronger. The pheromone evaporates with time and hence
the longer paths will have more evaporation as compared to shorter paths.
Page 32 of 40
Swarm and Evolutionary Computing V Daneesha
Particle Swarm Optimization (PSO): PSO is used to solve problems where variables take
continuous values, such as parameter tuning in machine learning models and function
optimization.
Example:
PSO optimizes a multi-dimensional function by adjusting the positions of particles (potential
solutions) in the search space, where each particle represents a candidate solution and its
velocity is influenced by both its own best-known position and the best-known positions of
other particles.
Particle Swarm Optimization (PSO) is a swarm intelligent algorithm, inspired from birds’
flocking or fish schooling for the solution of nonlinear, nonconvex or combinatorial
optimization problems that arise in many science and engineering domains.
It was developed by James Kennedy and Russell Eberhart in 1995.
PSO simulates the natural group behaviour where no leader exists, and individuals
communicate and cooperate to achieve a common goal, such as finding food.
Key Idea: PSO mimics the social interactions of individuals (particles) within a
population (swarm) to explore the search space and find the optimal solution. Each
particle adjusts its position based on its own best-known position and the best-known
position of the swarm.
Key Concepts of PSO
Swarm: A population of potential solutions to the optimization problem, called
particles.
Particle: Each particle represents a candidate solution in a multi-dimensional search
space.
Position: The location of each particle in the search space.
Velocity: The rate at which the particle moves through the search space.
Page 33 of 40
Swarm and Evolutionary Computing V Daneesha
Fitness: A measure of how good a particle's current position (solution) is, based on an
objective function.
Particles adjust their positions by considering two factors:
1. Personal best (pBest): The best position a particle has encountered so far.
2. Global best (gBest): The best position found by any particle in the entire swarm.
More Eyes and Ears: Better opportunities for finding food and detecting predators.
Survival Advantage: Collective behavior aids in increasing the survival chances of
individual birds.
i. Foraging
E.O. Wilson's Theory: Individuals in a group can benefit from the discoveries and
experiences of others. When birds forage together, they can share information about
food sources.
Non-Competing Flocks: Some species form flocks in a non-competitive way, where
all members benefit from shared knowledge about food locations.
iii. Aerodynamics
When birds fly in flocks, they often arrange themselves in specific shapes or
formations. Those formations take advantage of the changing wind patterns based on
the number of birds in the flock and how each bird’s wings create different currents.
This allows flying birds to use the surrounding air in the most energy efficient way.
Page 34 of 40
Swarm and Evolutionary Computing V Daneesha
PSO, inspired by bird flocking, simulates the advantages of collective behaviour but
PSO does not simulate the disadvantages of the birds’ flocking behaviour.
No Elimination of Weaker Individuals: During the search process killing of any
individual is not allowed as in Genetic Algorithms where some weaker individuals die
out. In PSO, all individuals remain alive and try to make themselves stronger throughout
the search process.
Cooperation Over Competition: The improvement in potential solutions in PSO is due
to cooperation while in evolutionary algorithms it is due to competition.
This concept makes swarm intelligence different from evolutionary algorithms.
The basic PSO model developed by Kennedy and Eberhart incorporates some, but not all,
of the flocking rules.
Safe Wandering and Dispersion: These rules are not enforced in PSO. Particles
(agents) are allowed to come as close to each other as possible during movement.
Aggregation and Homing: These rules are valid in the PSO model. In PSO, agents
have to fly within a particular region so that they can maintain a maximum distance
with any other agent. Homing says that any agent in the group may reach to the global
optima.
i. Proximity Principle: the population should be able to carry out simple space and time
computations.
ii. Quality Principle: the population should be able to respond to quality factors in the
environment.
iii. Diverse Response Principle: the population should not commit its activity along
excessively narrow channels.
iv. Stability Principle: the population should not change its mode of behaviour every time
the environment changes.
v. Adaptability Principle: the population should be able to change its behaviour mode
when it is worth the computational price.
Page 35 of 40
Swarm and Evolutionary Computing V Daneesha
Change of the direction and the magnitude in any particle is decided by a factor called velocity.
This is the rate of change in the position with respect to the time. With reference to the PSO,
time is the iteration. In this way, for PSO, the velocity may be defined as the rate of change in
the position with respect to the iteration. Since iteration counter increases by unity, the
dimension of the velocity v and the position x becomes the same.
𝑡+1 𝑡 𝑡 𝑡 𝑡 𝑡
𝑣𝑖,𝑑 = 𝑣𝑖,𝑑 + 𝑐1 𝑟1 (𝑝𝑖,𝑑 − 𝑥𝑖,𝑑 ) + 𝑐2 𝑟2 (𝑝𝑔,𝑑 − 𝑥𝑖,𝑑 ) (1)
Where,
𝑡+1
𝑣𝑖,𝑑 : Updated velocity for particle i in dimension d
𝑐1 𝑐2 : Cognitive and social scaling parameters.
𝑟1 𝑟2 : Random numbers between [0, 1].
𝑝𝑖,𝑑 : Personal best position of particle i
𝑝𝑔,𝑑 : Global best position (best in the swarm).
𝑥𝑖,𝑑 : Current position of particle i.
𝑡+1
Where 𝑥𝑖,𝑑 : Updated position of particle i in dimension d.
Page 36 of 40
Swarm and Evolutionary Computing V Daneesha
The only link between the dimensions of the problem space is introduced via the objective
function, i.e., through the locations of the best positions found so far g best and p best.
Flowchart of PSO
1. Initialize the swarm with random positions and velocities.
2. Evaluate the fitness of each particle.
3. Update the velocity of each particle based on pBest and gBest.
4. Update the position of each particle.
5. Update pBest and gBest.
6. If the termination condition is met, stop. Otherwise, return to step 3.
The constants 𝑐1 and 𝑐2 regulate the influence of personal best and global best, respectively.
Typically, c1 and c2 are set to 1.5-2.0, and ω is decreased linearly over time to encourage
convergence.
Page 37 of 40
Swarm and Evolutionary Computing V Daneesha
The convergence speed and the ability of finding optimal solution of any population based
algorithm is greatly influenced by the choice of its parameters. Usually, a general
recommendation for the setting of parameters of these algorithms is not possible as it is
highly dependent upon the problem parameters. However, theoretical and/or experimental
studies have been carried out to recommend the generic range for parameter values. Likewise
other population based search algorithms, tuning of parameters for a generic version of PSO
has always been a challenging task due the presence of stochastic factors r1 and r2 in the
search procedure.
Definition: The swarm size refers to the number of particles (potential solutions) used in
the optimization process.
Importance: The choice of swarm size influences the algorithm's balance between
exploration (searching broadly across the solution space) and exploitation (refining the
search around promising areas).
Recommended Swarm Size:
o Empirically chosen based on the number of decision variables and the complexity of
the problem.
o General guidelines suggest using 20–50 particles for many problems.
Role: These scaling factors, also known as cognitive (𝑐1) and social (𝑐2 )coefficients,
determine the step size of the particles as they move through the solution space.
Influence on Search:
o The values of 𝑐1 and 𝑐2 decide how much weight is given to the personal experience
of a particle (via p best) and to the experience of the swarm (via g best).
o They regulate the speed of particles in reaching better solutions.
Common Values:
o In the basic PSO model, 𝑐1 = 𝑐2 = 2 is a typical setting.
o With this setting, particles can converge quickly, but uncontrolled speed may reduce
the exploitation of the search space, potentially leading to premature convergence.
Effect of Different Configurations:
o If 𝑐1 = 𝑐2 > 0 , particles are attracted toward the average of their personal best
position and the swarm’s best position.
o If 𝑐1 > 𝑐2 , the algorithm is more useful for multimodal problems (with multiple
optimal solutions).
o If 𝑐2 > 𝑐1 , the algorithm is better suited for unimodal problems (with a single optimal
solution).
Small vs. Large Values:
o Small values of 𝑐1 and 𝑐2 result in smoother particle movements, which improves the
stability of the search process.
o Larger values can cause abrupt, aggressive movements, leading to faster convergence
but a higher chance of missing the global optimum.
Page 38 of 40
Swarm and Evolutionary Computing V Daneesha
Adaptive Scaling: Researchers have also proposed adaptive versions of 𝑐1 and 𝑐2 , where
these parameters change dynamically during the search process to balance exploration and
exploitation.
Role: Stopping criterion is also a parameter not only for PSO but for any population based
meta-heuristic algorithm
Popular Stopping Criteria:
o Maximum number of iterations: This is a common choice. The algorithm stops after
a fixed number of iterations, regardless of the quality of the solution.
o Maximum number of function evaluations: Another common criterion, where the
algorithm stops after evaluating the objective function a certain number of times.
More Efficient Stopping Criteria:
o Instead of relying only on iteration or evaluation counts, a more sophisticated approach
is to monitor the improvement in the solution.
o Convergence-based criterion: If the best solution doesn’t improve significantly after
a certain number of iterations, the search should stop. This method saves computational
time by halting the search once the algorithm’s progress slows down.
Page 39 of 40
Swarm and Evolutionary Computing V Daneesha
𝑓(𝑥) = ∑ 𝑥𝑖2
𝑖=1
References:
Page 40 of 40