OPTIMIZATION
OPTIMIZATION
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))
Population Size = 4;
𝑥 : (i = 1,2,3,4) and (t = 0)
𝑥1 =1.3;
𝑥2=4.3;
𝑥3=0.4;
𝑥4=−1.2
𝑓1=1.69;
𝑓2=18.49;
𝑓3=0.16;
𝑓4=1.44;
𝑣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.
𝑣_1^1=0.7209;
𝑣_2^1=−3.1229;
𝑣_3^1=0;
𝑣_4^1=1.2816;
𝑥_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 ;
𝑓_2^1=1.3855;
𝑓_3^1=0.16;
𝑓_4^1=0.0067;
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:
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 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.
if (p<0.5)
if(|A|<1)
Update Items.
Else if(|A|=1)
Update Items.
End if
End for
Assumptions
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;
The light intensity of Firefly (i.e., 𝐼_𝑖) at 𝑥_𝑖 is computed by the Value of the Objective Function.
For i = 1 to n -1;
For j = i + 1 to n;
End IF
End For
End For
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
Initialize Parameters.
The light intensity of Firefly (i.e., 𝐼_𝑖) at 𝑥_𝑖 is computed by the Value of the Objective Function.
For i = 1 to n -1;
For j = i + 1 to n;
End IF
End For
End For
Repeat
Step 3 determine how to calculate new intensity
Result