Cuckoo Search Algorithm
Inspired by Levy Flights & Cuckoo
Bird Behavior
For Optimization Problems
Cuckoo Search Algorithm (CSA)
• Robust optimization method inspired by the breeding
behavior of cuckoo birds.
• Mimics the behavior of some cuckoo species that lay
their eggs in the nests of other birds. This act increases
their chances of survival and reproduction
• This Meta-Heuristic approach is renowned for solving
complex optimization problems efficiently.
• The concept of Levy flight, a random walk approach
used by cuckoos to find suitable nests for laying their
eggs.
• Cuckoo Birds: They lay their eggs in host nests, relying
on the host birds for their upbringing.
• Host Birds: They represent the local nests where
cuckoo eggs are laid.
• Discovery Probability 𝑷𝒂 ϵ (0,1) : There is a chance
that host birds will discover alien cuckoo eggs.
– The host bird can throw the egg away. Abandon the
nest and build a completely new nest.
Three Basic Principle Cuckoo Search Algorithm Use.
1. Each Cuckoo Lays only one Egg at a time and places it in
a randomly selected nest.
Cuckoo Egg = New Solution
Eggs in Nest = Set of Solutions
2. Best Nest with high quality of Eggs will carry over to next
generation.
High Quality Eggs = Best Solution Near Optimal Value
[Means eggs that are more similar to host bird eggs]
3. The number of available host nests is fixed. Host bird
discovers cuckoo eggs with probability.
𝑷_𝒂 ϵ (0,1). Host birds can throw away the egg or leave
the nest/to build a new one.
Number of Host Nests = Fixed (i.e Population)
Host bird discovers Cuckoo Egg = Worst Solution (away from optimal value)
How Cuckoo Search Works
The algorithm operates in iterative steps:
• Initialize parameters for the cuckoo search
(number of host nests, discovery probability,
etc.).
• Generate a new solution for the cuckoo using
Levi flight to evaluate its fitness.
• Compare the fitness of the cuckoo's egg against
the host's egg. If the cuckoo's fitness is superior,
it replaces the host's egg; otherwise, it gets
discarded.
Implementing the Cuckoo Search Algorithm
Step 1: Initialization
To start, set the parameters of your algorithm:
• n: number of host nests, Xi (i=1,2,3..n)
• P(a): probability of discovering the cuckoo's
egg (e.g., 0.25)
• Maxt : Maximum number of iterations to
reach optimal solutions.
Step 2: Generating Solutions through Levy
Flight
• Levy flight is pivotal to simulating the cuckoo's
movement.
• It involves random walks, where the step sizes
follow Levy distribution, allowing for larger
jumps interspersed with smaller steps.
• This randomness helps in exploring the
solution space effectively
Step 3: Fitness Evaluation
• It determines how suitable a solution (egg) is within its
respective nest.
IF(FintnessOfCuckooEgg>FitnessOfHostEgg)
{
Replace Host Egg with Cuckoo
t=t+1; [next Generation
}
IF(FintnessOfCuckooEgg<FitnessOfHostEgg)
{
Worst case
Cuckoo Egg Killed or throw away
Generate new solution again using levy Flight
}
Example Problem
• We want to minimize the function: f(x) = x²
• The global minimum is at x = 0, f(0) = 0.
Step1: Initialize Nests.
Start with 3 nests:
• Nest 1: x1 = 4, f(x1) = 16
• Nest 2: x2 = -3, f(x2) = 9
• Nest 3: x3 = 6, f(x3) = 36
Best solution so far: x2 = -3 (fitness = 9).
Step 2: Generate new solutions via Levy flight
Step 3: Evaluate and Select Best
Compare new solutions with old ones:
Old best = 9 → new best = 4 (improvement).
So update nests with better solutions.
Now:
Nest 1 = 2 (fitness 4)
Nest 2 = -2 (fitness 4)
Nest 3 = 2 (fitness 4)
Step 4: Abandon Worst Nests
• With probability Pa = 0.25, abandon worst nest:
• Nest 3 abandoned, replaced with random
x3 = -1 → f(-1) = 1
• Best solution now: x = -1, f(x) = 1.
Step 5: Iterate Until Convergence
• Continue process with new Levy flights and
abandonment.
• Next iterations improve solution:
- Example: x = -0.5 → f(x) = 0.25
- Eventually converges near x = 0, f(x) = 0
• Global minimum found!
Applications:
• Neural Network Training
• Scheduling
• Traveling Salesman Problem
• To solve knapsack problem.