0% found this document useful (0 votes)
24 views36 pages

OPTIMIZATION

The document discusses several nature-inspired metaheuristic optimization algorithms: Particle Swarm Optimization, Invasive Weed Optimization, Ant Colony Optimization, Whale Optimization Algorithm, and Firefly Optimization Algorithm. Each algorithm is inspired by the social behavior of a different biological system - such as swarming birds, weed colonies, ant colonies, humpback whale hunting, and flashing fireflies - and uses concepts like particles, seeds, pheromones, and brightness to represent candidate solutions to an optimization problem. The algorithms are iterative processes that update the positions and velocities of particles or agents in order to eventually find the global best or optimal solution.

Uploaded by

Mahabub Alam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views36 pages

OPTIMIZATION

The document discusses several nature-inspired metaheuristic optimization algorithms: Particle Swarm Optimization, Invasive Weed Optimization, Ant Colony Optimization, Whale Optimization Algorithm, and Firefly Optimization Algorithm. Each algorithm is inspired by the social behavior of a different biological system - such as swarming birds, weed colonies, ant colonies, humpback whale hunting, and flashing fireflies - and uses concepts like particles, seeds, pheromones, and brightness to represent candidate solutions to an optimization problem. The algorithms are iterative processes that update the positions and velocities of particles or agents in order to eventually find the global best or optimal solution.

Uploaded by

Mahabub Alam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 36

OPTIMIZATION

PARTICLE SWARM OPTIMIZATION


In these 2 boats communicates each other and takes measures, a boat stays in its place unless the other
boat finds more reliable result.

It has position, velocity (changes every time, the next position is the new velocity), personal best(may
change) and global best (may change)
MATLAB CODE: (www.yarpiz.com)
PARTICLE SWARM OPTIMIZATION ALGORITHM NUMERICAL EXAMPLE (PARTICLE SWARM
OPTIMIZATION ALGORITHM NUMERICAL EXAMPLE (codebypixy.blogspot.com))

PSO is a computational method that optimizes a problem. It is a Population-based stochastic search


algorithm. PSO is inspired by the Social Behavior of Birds flocking. n Particle Swarm Optimization the
solution of the problem is represented using Particles. [Flocking birds are replaced with particles for
algorithm simplicity]. Objective Function is used for the performance evaluation for each particle / agent
in the current population. PSO solved problems by having a Population (called Swarms) of Candidate
Solutions (Particles). Local and global optimal solutions are used to update particle position in each
iteration.

1.) Initialize Population [Current Iteration (t) = 0]

Population Size = 4;

𝑥 : (i = 1,2,3,4) and (t = 0)

𝑥1 =1.3;

𝑥2=4.3;
𝑥3=0.4;

𝑥4=−1.2

2.) Fitness Function used:

Compute Fitness Values for Each Particle using fitness function.

𝑓1=1.69;

𝑓2=18.49;

𝑓3=0.16;

𝑓4=1.44;

3.) Initialize Velocity for each particle in the current Population.

𝑣1=0;

𝑣2=0;

𝑣3=0;

𝑣4=0;

4.) Find Personal Best & Global Best (𝐺_𝐵𝑒𝑠𝑡=0.4;) for each Particle.

𝐺_𝐵𝑒𝑠𝑡=0.4;
5.) Calculate Velocity for each Particle.

Calculate Velocity by:

𝑣_1^(0+1)=1∗0 +1∗0.233(1.3 −1.3)+1∗0.801(0.4 −1.3) ;

𝑣_1^1=0.7209;

𝑣_2^1=−3.1229;

𝑣_3^1=0;

𝑣_4^1=1.2816;

6.) Calculate Position for each Particle.

Calculate Particles Position by :

𝑥_1^(0+1)=1.3 +0.7209=2.0209 ;

𝑥_2^(0+1)=4.3 −3.1229=1.1771;

𝑥_3^(0+1)=0.4+0=0.4;

𝑥_4^(0+1)=−1.2+1.2816=0.0819 ;

7.) Calculate Fitness Values for each Particle (t = 1).


𝑓_1^1=4.084;

𝑓_2^1=1.3855;

𝑓_3^1=0.16;

𝑓_4^1=0.0067;

8.) Repeat Until Stopping Criteria is met.

(Output after 100 iterations


INVASIVE WEED OPTIMIZATION
The invasive weed optimization algorithm (IWO) is a population-based metaheuristic optimization
method inspired by the behavior of weed colonies. Weeds are unwanted plants (plant in the wrong
place). Weeds can change their behavior according to the environment and gets fitter.

Invasive Weed Optimization Algorithm Steps.

1.) Initialization Phase Initialize all important parameters.

2.) Initialize Population. The initial population is created by spreading the finite number of seeds
randomly in the search space.
3.) Compute Fitness Values.

Every seed will grow into a flowering plant and produce seeds. [Reproduction]. Seed production is based
on fitness values so compute:

1. Individual Fitness Value

2. Best Fitness Value

3. Worst Fitness Value


4.) Random distribution of germinated seeds. Determine new positions of seeds in the search space

For Randomness and Adaption, the germinated seeds are normally distributed random numbers with a
mean equal to zero. Seeds are normally distributed near to their parent pant.

EXAMPLE:
Repeat
In 2nd 3rd 4th 5th we will repeat this steps and find the best solution for each iteration
ANT COLONY OPTIMIZATION
ALGORITHM STEP-BY-STEP WITH
EXAMPLE
ACO Terminology: Pheromones, Pheromones Trials, Pheromone Density, and Pheromone Evaporation.

Step 01: Construct Graph for the given problem. Each city is considered as graph NODES / VERTICES and
distance between cities are graph EDGES.

Step 02: Initialize all important parameters, Number of Artificial Ants, Maximum Iterations, Artificial
Pheromones and other.

Step 03: For any Ant select ant city randomly. Place that ant in randomly Selected city.

Step 04: Build the Tour for Ant from randomly selected city to unvisited cities. Ants are also using
artificial memory to store visited city.

Step 05: One by one move ant to all the unvisited cities and calculate tour length.

Step 06: Once no unvisited city left. Ant will return to the randomly selected city. Then calculate Total
Tour Length. Repeat this for all ants.

Step 07: Update Artificial Pheromones Values.

Step 08: Check stopping criteria. If stopping criteria is not matched repeat loop ELSE display the best
solution.

Traveling Salesman Problem: In traveling salesman problem, salesman want to visit a number of cities
and cover minimum distance during tour.

Constraint: Each city should be visited exactly once. [to minimize tour length]

Ant Colony Optimization is applied on Traveling Salesman Problem to solve this problem. A number of
Artificial Ants are used. We will use Artificial ants to visit all cities and calculate tour length for each
ant. Out of (n) ants, check feasible solution i.e., feasible tour with minimum tour length.

Ant Goal: Find out Feasible Tour for the salesman problem. Objective function Value: Sum of distance
between each city visited during tour.
Whale Optimization Algorithm
Input: Number of Maximum Iteration and Population Size, Minsupport, minconfedence.

Step 01: Initialize the population size for n search agents.[Xi(i=1,2,3,...n)]

Step 02: Initialize i, A, C, L, and p.

Step 03: Compute the fitness value of each search agent/whale.

Step 04: X* = the best rule

Step 05: While (CurrentIteration <= MaximumIteration )

Step 06: Update a, A, C, L and p.

Step 07: For all whale poplation check

if (p<0.5)

if(|A|<1)

For each Item in the solution Xi.

Update Items.

Else if(|A|=1)

Select a random Item in Xi.

Update Items.

End if

For each item in the solution Xi.

If the Item is odd, it belongs to the antecedent,

Otherwise, it belongs to the consequence.

End for

Step 08: Calculate the fitness of each search agent.

Step 09: Update X* if there is a better solution.

Step 11: Iteration = currentIteration + 1

Step 12: End While

Step 13: Return X*


Repeat for i= 2,3,4
Check boundaries

Calculate fitness value


Repeat this loop until meeting stopping criteria

to get search agent position.


Firefly Optimization Algorithm
Firefly algorithm is a swarm-based metaheuristic algorithm that was introduced by Yang. Firefly
Algorithm is inspired by the FLASHING Behavior of Fireflies.

Assumptions

 Fireflies are attracted to each other.


 Attractiveness is proportional to BRIGHTNESS.
 Less Brighter Firefly is attracted to the Brighter Firefly.
 Attractiveness decrease as the distance between 2 fireflies increase.
 If brightness for both is the same, fireflies move randomly.
 New Solutions are generated by Random walks & the Attraction of fireflies.

Video Link: https://youtu.be/QvpEMR-Jp0U

Firefly Optimization Algorithm Steps

1. Initialize Parameters.
2. Generate Population of n Fireflies.
3. Calculate Fitness Value for Each Firefly.
4. Check stopping criteria if (CurrentIteration := 1 to MaximumIteration ).
5. Update Position and Light Intensity for Each Firefly.
6. Report the Best Solution.
Initialize Parameters, Population of Fire Fly Swarm.
Population Size (n) = 20;

Maximum Iteration (Maxt) = 50;

Dimension (d) = 10;

Upper Bound [UB] = 100;

Lower Bound [LB] = -100;

Calculate Fitness Value [Light Intensity] for Each FireFly.

The light intensity of Firefly (i.e., 𝐼_𝑖) at 𝑥_𝑖 is computed by the Value of the Objective Function.

Firefly Position Updated as:

For i = 1 to n -1;

For j = i + 1 to n;

IF ( 𝑰_𝒋 > 𝑰_𝒊 )

Update Position. [move Firefly i towards Firefly j ];

End IF

End For

End For
Firefly Optimization Algorithm

- August 02, 2021

Firefly algorithm is a swarm-based metaheuristic algorithm that was introduced by Yang. Firefly
Algorithm is inspired by the FLASHING Behavior of Fireflies.

Assumptions

Fireflies are attracted to each other.

Attractiveness is proportional to BRIGHTNESS.

Less Brighter Firefly is attracted to the Brighter Firefly.

Attractiveness decrease as the distance between 2 fireflies increase.

If brightness for both is the same, fireflies move randomly.


New Solutions are generated by Random walks & the Attraction of fireflies.

Video Link: https://youtu.be/QvpEMR-Jp0U

Firefly Optimization Algorithm Steps

Initialize Parameters.

Generate Population of n Fireflies.

Calculate Fitness Value for Each Firefly.

Check stopping criteria if (CurrentIteration := 1 to MaximumIteration ).

Update Position and Light Intensity for Each Firefly.

Report the Best Solution.

Initialize Parameters, Population of Fire Fly Swarm.

Population Size (n) = 20;

Maximum Iteration (Maxt) = 50;

Dimension (d) = 10;

Upper Bound [UB] = 100;

Lower Bound [LB] = -100;

Calculate Fitness Value [Light Intensity] for Each FireFly.

The light intensity of Firefly (i.e., 𝐼_𝑖) at 𝑥_𝑖 is computed by the Value of the Objective Function.

Firefly Position Updated as:

For i = 1 to n -1;

For j = i + 1 to n;

IF ( 𝑰_𝒋 > 𝑰_𝒊 )

Update Position. [move Firefly i towards Firefly j ];

End IF

End For

End For
Repeat
Step 3 determine how to calculate new intensity
Result

You might also like