SlideShare una empresa de Scribd logo
1 de 28
Prepared By:
Mehta Ishani
130040701003
Solving Travelling Salesman Problem
using Firefly Algorithm
1
Contents
Introduction
Travelling Salesman Problem
Firefly Algorithm
Adapting Firefly algorithm for TSP
Implementation and Results
Conclusion
2
Introduction
Nature – great and immense source of inspiration
NP- Hard problem
Nature inspired algorithms
3
TSP
4
Problem definition
The traveling salesman problem consists of a salesman and a set
of cities. The salesman has to visit each one of the cities
starting from a certain one (e.g. the hometown) and
returning to the same city. The challenge of the problem is
that the traveling salesman wants to minimize the total length
of the trip.
TSP
The traveling salesman problem can be described as follows:
TSP = {(G, f, t): G = (V, E)
a complete graph,
f is a function V×V Z, t Z,→ ∈
G is a graph that contains a traveling salesman tour with cost
that does not exceed t}.
5
TSP
6
TSP
The problem lies in finding a minimal path passing from all
vertices once. For example the path Path1 {A, B, C, D, E,
A} and the path Path2 {A, B, C, E, D, A} pass all the
vertices but Path1 has a total length of 24 and Path2 has a
total length of 31.
7
TSP
Solution is given by enumerating each possible tour and
searching for the tour with smallest cost. Each possible tour
is a permutation of 123 . . . n, where n is the number of
cities, so therefore the number of tours is n! When n gets
large, it becomes impossible to find the cost of every tour in
polynomial time. Such a method, which will end up giving
the optimal solution, is obviously not very feasible because of
the time consumption required to calculate all the tours
8
Firefly algorithm
Basic concept
Fireflies are small winged beetles capable of producing a light
flashes in order to attract mates. They are believed to have a
capacitor-like mechanism, that slowly charges until certain
threshold is reached, at which they release the energy in
form of light, after which the cycle repeats.
Firefly Algorithm (FA) is novel nature inspired meta-heuristic
algorithm based on rhythmic flashing behavior of Fireflies.
9
Firefly algorithm
3 flashing characteristics of fireflies to develop firefly-
inspired algorithms.
1. one firefly will be attracted to other fireflies regardless of
their gender
2. The attractiveness is proportional to the brightness and they
both decrease as their distance increases.
3. The brightness of a firefly is determined by the landscape of
the objective function.
10
Firefly algorithm
Objective function f(x), x = (x1... xd)T
Generate initial population of fireflies xi (i = 1, 2... n)
Light intensity Ii at xi is determined by f (xi)
Define light absorption coefficient γ
while (t < MaxGeneration)
for i = 1 : n all n fireflies
for j = 1 : n all n fireflies (inner loop)
if (Ii < Ij),
Move firefly i towards j;
end if
Vary attractiveness with distance r via exp[− r]γ
Evaluate new solutions and update light intensity
end for j
end for i
Rank the fireflies and find the current global best g*
end while11
Firefly algorithm
First each firefly generates an initial solution randomly;
parameters like Light Intensity I, Initial Attractiveness 0,β
and light absorption coefficient are defined. Then for eachγ
firefly, find the brightest firefly. If there is brighter firefly
then less bright firefly will move towards the brighter one.
When firefly moves its light intensity decreases and its
attractiveness will change. Then best firefly will be chosen
based on an objective function for the next iteration. This
condition will continue until the max iteration is reached.
12
Adapting Firefly algorithm for TSP
FA can be used to solve a permutation problem, such as
Travelling Salesman Problem. For that we need to
implement functions Initial_Solution() and Distance(xi, xj )
in a way how it is represented in TSP. We also need to
redefine the step movements of the fireflies
13
Adapting Firefly algorithm for TSP
Initial Solution
fireflies are scattered over the search space in a uniform
distribution.
we need to produce m random permutations of (1, 2… n) as
the initial fireflies.
Use a greedy method or nearest neighborhood search for
solution initialization would improve the performance of the
algorithm.
By putting one relatively good solution among the random
solutions, would cause the random solutions immediately to
advance towards the better solution. This would probably
contribute to find the local optima faster, but not for better
exploration of the search space.14
Adapting Firefly algorithm for TSP
Distance Function
(a)Hamming’s distance
(b)the number of the required swaps of the first solution in
order to get the second one.
Let’s examine this example.
Consider permutations π1,π2 ∈ n�
�1 = [1 2 3 4 5 6]
�2 = [1 2 4 3 6 5]
15
Adapting Firefly algorithm for TSP
The Hamming’s distance between two permutations is the
number of non corresponding elements in the sequence.
Therefore, HammingDistance(π1, π2) is 4 (only the first
two positions have the same elements).
The Swap distance is the number of minimal required swaps
of one permutation in order to obtain the other one.
SwapDistance(π1, π2) is thereby, 2 (in the π2 we swap
elements: 4 with 3 and then 5 with 6).
16
Adapting Firefly algorithm for TSP
Movement
The movement of a firefly i attracted to another brighter (more
attractive) firefly j is determined by:
�� ������← (2,���)
Where, dij is distance between firefly i and j.
The length of movement of a firefly will be randomly selected
from 2 to dij.
17
Adapting Firefly algorithm for TSP
When a firefly moves, existing solutions in the firefly is
changed.
Since the representation of firefly is a permutation
representation, then we use Inversion Mutation to represent
the movement.
With inversion mutation, the path that has been formed can
be maintained so the good path formed previously is not
damaged.
18
Implementation and Results
The Firefly Algorithm with some modification in few
parameters in order to adapt it to solve travelling Salesman
problem is implemented by using MATLAB 2010.
Intel CORE i5 machine with 3 GB RAM is used to run the
algorithm. TSP datasets are standard TSP instances
downloaded from TSPLIB
This algorithm runs itself till the termination criteria are
satisfied. We can use more than one termination criteria in
the model such as predefined number of iterations,
stagnations in the result, time-limit etc. Here, stagnation in
the result is used as the termination criteria.
19
Implementation and Results
20
Implementation and Results
21
Implementation and Results
22
Implementation and Results
23
Implementation and Results
24
Implementation and Results
25
Implementation and Results
26
Table 1 also shows performance Comparison with
three of the most popular meta-heuristic algorithms the
Ant Colony Optimization (ACO), the Genetic Algorithm
(GA), and Simulated Annealing (SA).
Conclusion
Here, basic Firefly Algorithm (FA) is implemented with
some modifications in parameters to adapt it for Travelling
Salesman Problem (TSP) which consists of constructing a
suitable conversion of the continuous functions as are
attractiveness, distance and movement, into new discrete
functions. The experimental results obtained on standard
TSP instances. It shows that Firefly Algorithm (FA) provides
better results than ACO, GA and SA in most of the
instances.
These results can be further improved by using various local
search methods like Tabu Search, nearest neighborhood for
initial solution.
27
28

Más contenido relacionado

La actualidad más candente

Classification with ant colony optimization
Classification with ant colony optimizationClassification with ant colony optimization
Classification with ant colony optimizationkamalikanath89
 
Ant colony optimization
Ant colony optimizationAnt colony optimization
Ant colony optimizationUnnitaDas
 
Particle Swarm Optimization: The Algorithm and Its Applications
Particle Swarm Optimization: The Algorithm and Its ApplicationsParticle Swarm Optimization: The Algorithm and Its Applications
Particle Swarm Optimization: The Algorithm and Its Applicationsadil raja
 
AI_Session 7 Greedy Best first search algorithm.pptx
AI_Session 7 Greedy Best first search algorithm.pptxAI_Session 7 Greedy Best first search algorithm.pptx
AI_Session 7 Greedy Best first search algorithm.pptxAsst.prof M.Gokilavani
 
Ant colony optimization
Ant colony optimizationAnt colony optimization
Ant colony optimizationMeenakshi Devi
 
Local search algorithm
Local search algorithmLocal search algorithm
Local search algorithmMegha Sharma
 
Ant Colony Optimization
Ant Colony OptimizationAnt Colony Optimization
Ant Colony OptimizationPratik Poddar
 
Firefly algorithm
Firefly algorithmFirefly algorithm
Firefly algorithmHasan Gök
 
Online Shopping Agent in AI
Online Shopping Agent in AIOnline Shopping Agent in AI
Online Shopping Agent in AIFazle Rabbi Ador
 
Ant colony optimization
Ant colony optimizationAnt colony optimization
Ant colony optimizationITER
 
Ant colony optimization
Ant colony optimizationAnt colony optimization
Ant colony optimizationAbdul Rahman
 
Genetic programming
Genetic programmingGenetic programming
Genetic programmingMeghna Singh
 
Lecture 14 Heuristic Search-A star algorithm
Lecture 14 Heuristic Search-A star algorithmLecture 14 Heuristic Search-A star algorithm
Lecture 14 Heuristic Search-A star algorithmHema Kashyap
 
Particle Swarm Optimization - PSO
Particle Swarm Optimization - PSOParticle Swarm Optimization - PSO
Particle Swarm Optimization - PSOMohamed Talaat
 
Optimization by Ant Colony Method
Optimization by Ant Colony MethodOptimization by Ant Colony Method
Optimization by Ant Colony MethodUday Wankar
 

La actualidad más candente (20)

Ant colony algorithm
Ant colony algorithm Ant colony algorithm
Ant colony algorithm
 
A* Search Algorithm
A* Search AlgorithmA* Search Algorithm
A* Search Algorithm
 
Classification with ant colony optimization
Classification with ant colony optimizationClassification with ant colony optimization
Classification with ant colony optimization
 
Ant colony optimization
Ant colony optimizationAnt colony optimization
Ant colony optimization
 
Particle Swarm Optimization: The Algorithm and Its Applications
Particle Swarm Optimization: The Algorithm and Its ApplicationsParticle Swarm Optimization: The Algorithm and Its Applications
Particle Swarm Optimization: The Algorithm and Its Applications
 
AI_Session 7 Greedy Best first search algorithm.pptx
AI_Session 7 Greedy Best first search algorithm.pptxAI_Session 7 Greedy Best first search algorithm.pptx
AI_Session 7 Greedy Best first search algorithm.pptx
 
Greedy algorithm
Greedy algorithmGreedy algorithm
Greedy algorithm
 
Ant colony optimization
Ant colony optimizationAnt colony optimization
Ant colony optimization
 
Local search algorithm
Local search algorithmLocal search algorithm
Local search algorithm
 
Ant Colony Optimization
Ant Colony OptimizationAnt Colony Optimization
Ant Colony Optimization
 
Firefly algorithm
Firefly algorithmFirefly algorithm
Firefly algorithm
 
Online Shopping Agent in AI
Online Shopping Agent in AIOnline Shopping Agent in AI
Online Shopping Agent in AI
 
Ant colony optimization
Ant colony optimizationAnt colony optimization
Ant colony optimization
 
Cuckoo search
Cuckoo searchCuckoo search
Cuckoo search
 
Travelling salesman problem
Travelling salesman problemTravelling salesman problem
Travelling salesman problem
 
Ant colony optimization
Ant colony optimizationAnt colony optimization
Ant colony optimization
 
Genetic programming
Genetic programmingGenetic programming
Genetic programming
 
Lecture 14 Heuristic Search-A star algorithm
Lecture 14 Heuristic Search-A star algorithmLecture 14 Heuristic Search-A star algorithm
Lecture 14 Heuristic Search-A star algorithm
 
Particle Swarm Optimization - PSO
Particle Swarm Optimization - PSOParticle Swarm Optimization - PSO
Particle Swarm Optimization - PSO
 
Optimization by Ant Colony Method
Optimization by Ant Colony MethodOptimization by Ant Colony Method
Optimization by Ant Colony Method
 

Similar a Solving travelling salesman problem using firefly algorithm

Modified Discrete Firefly Algorithm Combining Genetic Algorithm for Traveling...
Modified Discrete Firefly Algorithm Combining Genetic Algorithm for Traveling...Modified Discrete Firefly Algorithm Combining Genetic Algorithm for Traveling...
Modified Discrete Firefly Algorithm Combining Genetic Algorithm for Traveling...TELKOMNIKA JOURNAL
 
Firefly Algorithm, Stochastic Test Functions and Design Optimisation
 Firefly Algorithm, Stochastic Test Functions and Design Optimisation Firefly Algorithm, Stochastic Test Functions and Design Optimisation
Firefly Algorithm, Stochastic Test Functions and Design OptimisationXin-She Yang
 
Research on Chaotic Firefly Algorithm and the Application in Optimal Reactive...
Research on Chaotic Firefly Algorithm and the Application in Optimal Reactive...Research on Chaotic Firefly Algorithm and the Application in Optimal Reactive...
Research on Chaotic Firefly Algorithm and the Application in Optimal Reactive...TELKOMNIKA JOURNAL
 
A Firefly Algorithm for Optimizing Spur Gear Parameters Under Non-Lubricated ...
A Firefly Algorithm for Optimizing Spur Gear Parameters Under Non-Lubricated ...A Firefly Algorithm for Optimizing Spur Gear Parameters Under Non-Lubricated ...
A Firefly Algorithm for Optimizing Spur Gear Parameters Under Non-Lubricated ...irjes
 
Firefly Algorithms for Multimodal Optimization
Firefly Algorithms for Multimodal OptimizationFirefly Algorithms for Multimodal Optimization
Firefly Algorithms for Multimodal OptimizationXin-She Yang
 
Firefly Algorithm for Unconstrained Optimization
Firefly Algorithm for Unconstrained OptimizationFirefly Algorithm for Unconstrained Optimization
Firefly Algorithm for Unconstrained OptimizationIOSR Journals
 
Exploring Algorithms
Exploring AlgorithmsExploring Algorithms
Exploring AlgorithmsSri Prasanna
 
Firefly Algorithm: Recent Advances and Applications
Firefly Algorithm: Recent Advances and ApplicationsFirefly Algorithm: Recent Advances and Applications
Firefly Algorithm: Recent Advances and ApplicationsXin-She Yang
 
Particle Swarm Optimization to Solve Multiple Traveling Salesman Problem
Particle Swarm Optimization to Solve Multiple Traveling Salesman ProblemParticle Swarm Optimization to Solve Multiple Traveling Salesman Problem
Particle Swarm Optimization to Solve Multiple Traveling Salesman ProblemIRJET Journal
 
2010 3-24 cryptography stamatiou
2010 3-24 cryptography stamatiou2010 3-24 cryptography stamatiou
2010 3-24 cryptography stamatiouvafopoulos
 
An Improved Empirical Mode Decomposition Based On Particle Swarm Optimization
An Improved Empirical Mode Decomposition Based On Particle Swarm OptimizationAn Improved Empirical Mode Decomposition Based On Particle Swarm Optimization
An Improved Empirical Mode Decomposition Based On Particle Swarm OptimizationIJRES Journal
 
Improved Firefly Algorithm for Unconstrained Optimization Problems
Improved Firefly Algorithm for Unconstrained Optimization ProblemsImproved Firefly Algorithm for Unconstrained Optimization Problems
Improved Firefly Algorithm for Unconstrained Optimization ProblemsEditor IJCATR
 
lost_valley_search.pdf
lost_valley_search.pdflost_valley_search.pdf
lost_valley_search.pdfmanuelabarca9
 
Cuckoo Search & Firefly Algorithms
Cuckoo Search & Firefly AlgorithmsCuckoo Search & Firefly Algorithms
Cuckoo Search & Firefly AlgorithmsMustafa Salam
 
An agent based particle swarm optimization for papr reduction of ofdm systems
An agent based particle swarm optimization for papr reduction of ofdm systemsAn agent based particle swarm optimization for papr reduction of ofdm systems
An agent based particle swarm optimization for papr reduction of ofdm systemsaliasghar1989
 
An improved ant colony algorithm based on
An improved ant colony algorithm based onAn improved ant colony algorithm based on
An improved ant colony algorithm based onIJCI JOURNAL
 

Similar a Solving travelling salesman problem using firefly algorithm (20)

Modified Discrete Firefly Algorithm Combining Genetic Algorithm for Traveling...
Modified Discrete Firefly Algorithm Combining Genetic Algorithm for Traveling...Modified Discrete Firefly Algorithm Combining Genetic Algorithm for Traveling...
Modified Discrete Firefly Algorithm Combining Genetic Algorithm for Traveling...
 
Firefly Algorithm, Stochastic Test Functions and Design Optimisation
 Firefly Algorithm, Stochastic Test Functions and Design Optimisation Firefly Algorithm, Stochastic Test Functions and Design Optimisation
Firefly Algorithm, Stochastic Test Functions and Design Optimisation
 
Research on Chaotic Firefly Algorithm and the Application in Optimal Reactive...
Research on Chaotic Firefly Algorithm and the Application in Optimal Reactive...Research on Chaotic Firefly Algorithm and the Application in Optimal Reactive...
Research on Chaotic Firefly Algorithm and the Application in Optimal Reactive...
 
A Firefly Algorithm for Optimizing Spur Gear Parameters Under Non-Lubricated ...
A Firefly Algorithm for Optimizing Spur Gear Parameters Under Non-Lubricated ...A Firefly Algorithm for Optimizing Spur Gear Parameters Under Non-Lubricated ...
A Firefly Algorithm for Optimizing Spur Gear Parameters Under Non-Lubricated ...
 
Firefly Algorithms for Multimodal Optimization
Firefly Algorithms for Multimodal OptimizationFirefly Algorithms for Multimodal Optimization
Firefly Algorithms for Multimodal Optimization
 
1308.3898 1
1308.3898 11308.3898 1
1308.3898 1
 
1308.3898
1308.38981308.3898
1308.3898
 
Firefly Algorithm for Unconstrained Optimization
Firefly Algorithm for Unconstrained OptimizationFirefly Algorithm for Unconstrained Optimization
Firefly Algorithm for Unconstrained Optimization
 
M01117578
M01117578M01117578
M01117578
 
Exploring Algorithms
Exploring AlgorithmsExploring Algorithms
Exploring Algorithms
 
Firefly Algorithm: Recent Advances and Applications
Firefly Algorithm: Recent Advances and ApplicationsFirefly Algorithm: Recent Advances and Applications
Firefly Algorithm: Recent Advances and Applications
 
Particle Swarm Optimization to Solve Multiple Traveling Salesman Problem
Particle Swarm Optimization to Solve Multiple Traveling Salesman ProblemParticle Swarm Optimization to Solve Multiple Traveling Salesman Problem
Particle Swarm Optimization to Solve Multiple Traveling Salesman Problem
 
2010 3-24 cryptography stamatiou
2010 3-24 cryptography stamatiou2010 3-24 cryptography stamatiou
2010 3-24 cryptography stamatiou
 
An Improved Empirical Mode Decomposition Based On Particle Swarm Optimization
An Improved Empirical Mode Decomposition Based On Particle Swarm OptimizationAn Improved Empirical Mode Decomposition Based On Particle Swarm Optimization
An Improved Empirical Mode Decomposition Based On Particle Swarm Optimization
 
Improved Firefly Algorithm for Unconstrained Optimization Problems
Improved Firefly Algorithm for Unconstrained Optimization ProblemsImproved Firefly Algorithm for Unconstrained Optimization Problems
Improved Firefly Algorithm for Unconstrained Optimization Problems
 
lost_valley_search.pdf
lost_valley_search.pdflost_valley_search.pdf
lost_valley_search.pdf
 
Analysis of algorithms
Analysis of algorithmsAnalysis of algorithms
Analysis of algorithms
 
Cuckoo Search & Firefly Algorithms
Cuckoo Search & Firefly AlgorithmsCuckoo Search & Firefly Algorithms
Cuckoo Search & Firefly Algorithms
 
An agent based particle swarm optimization for papr reduction of ofdm systems
An agent based particle swarm optimization for papr reduction of ofdm systemsAn agent based particle swarm optimization for papr reduction of ofdm systems
An agent based particle swarm optimization for papr reduction of ofdm systems
 
An improved ant colony algorithm based on
An improved ant colony algorithm based onAn improved ant colony algorithm based on
An improved ant colony algorithm based on
 

Más de ishmecse13

Search engine and web crawler
Search engine and web crawlerSearch engine and web crawler
Search engine and web crawlerishmecse13
 
Web services concepts, protocols and development
Web services concepts, protocols and developmentWeb services concepts, protocols and development
Web services concepts, protocols and developmentishmecse13
 
Web services concepts, protocols and development
Web services concepts, protocols and developmentWeb services concepts, protocols and development
Web services concepts, protocols and developmentishmecse13
 
Wap architecture and wml script
Wap architecture and wml scriptWap architecture and wml script
Wap architecture and wml scriptishmecse13
 
Object oriented concepts with java
Object oriented concepts with javaObject oriented concepts with java
Object oriented concepts with javaishmecse13
 
Kerberos using public key cryptography
Kerberos using public key cryptographyKerberos using public key cryptography
Kerberos using public key cryptographyishmecse13
 
Hierarchical clustering
Hierarchical clusteringHierarchical clustering
Hierarchical clusteringishmecse13
 
File models and file accessing models
File models and file accessing modelsFile models and file accessing models
File models and file accessing modelsishmecse13
 
Case study on cyber crime
Case study on cyber crimeCase study on cyber crime
Case study on cyber crimeishmecse13
 
Branch and bound technique
Branch and bound techniqueBranch and bound technique
Branch and bound techniqueishmecse13
 
Branch and bound technique
Branch and bound techniqueBranch and bound technique
Branch and bound techniqueishmecse13
 
Cyber crime and cyber laws
Cyber crime and cyber lawsCyber crime and cyber laws
Cyber crime and cyber lawsishmecse13
 

Más de ishmecse13 (14)

Search engine and web crawler
Search engine and web crawlerSearch engine and web crawler
Search engine and web crawler
 
Web services concepts, protocols and development
Web services concepts, protocols and developmentWeb services concepts, protocols and development
Web services concepts, protocols and development
 
Web services concepts, protocols and development
Web services concepts, protocols and developmentWeb services concepts, protocols and development
Web services concepts, protocols and development
 
Web services
Web servicesWeb services
Web services
 
Wap wml
Wap wmlWap wml
Wap wml
 
Wap architecture and wml script
Wap architecture and wml scriptWap architecture and wml script
Wap architecture and wml script
 
Object oriented concepts with java
Object oriented concepts with javaObject oriented concepts with java
Object oriented concepts with java
 
Kerberos using public key cryptography
Kerberos using public key cryptographyKerberos using public key cryptography
Kerberos using public key cryptography
 
Hierarchical clustering
Hierarchical clusteringHierarchical clustering
Hierarchical clustering
 
File models and file accessing models
File models and file accessing modelsFile models and file accessing models
File models and file accessing models
 
Case study on cyber crime
Case study on cyber crimeCase study on cyber crime
Case study on cyber crime
 
Branch and bound technique
Branch and bound techniqueBranch and bound technique
Branch and bound technique
 
Branch and bound technique
Branch and bound techniqueBranch and bound technique
Branch and bound technique
 
Cyber crime and cyber laws
Cyber crime and cyber lawsCyber crime and cyber laws
Cyber crime and cyber laws
 

Último

Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesPrabhanshu Chaturvedi
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 

Último (20)

Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 

Solving travelling salesman problem using firefly algorithm

  • 1. Prepared By: Mehta Ishani 130040701003 Solving Travelling Salesman Problem using Firefly Algorithm 1
  • 2. Contents Introduction Travelling Salesman Problem Firefly Algorithm Adapting Firefly algorithm for TSP Implementation and Results Conclusion 2
  • 3. Introduction Nature – great and immense source of inspiration NP- Hard problem Nature inspired algorithms 3
  • 4. TSP 4 Problem definition The traveling salesman problem consists of a salesman and a set of cities. The salesman has to visit each one of the cities starting from a certain one (e.g. the hometown) and returning to the same city. The challenge of the problem is that the traveling salesman wants to minimize the total length of the trip.
  • 5. TSP The traveling salesman problem can be described as follows: TSP = {(G, f, t): G = (V, E) a complete graph, f is a function V×V Z, t Z,→ ∈ G is a graph that contains a traveling salesman tour with cost that does not exceed t}. 5
  • 7. TSP The problem lies in finding a minimal path passing from all vertices once. For example the path Path1 {A, B, C, D, E, A} and the path Path2 {A, B, C, E, D, A} pass all the vertices but Path1 has a total length of 24 and Path2 has a total length of 31. 7
  • 8. TSP Solution is given by enumerating each possible tour and searching for the tour with smallest cost. Each possible tour is a permutation of 123 . . . n, where n is the number of cities, so therefore the number of tours is n! When n gets large, it becomes impossible to find the cost of every tour in polynomial time. Such a method, which will end up giving the optimal solution, is obviously not very feasible because of the time consumption required to calculate all the tours 8
  • 9. Firefly algorithm Basic concept Fireflies are small winged beetles capable of producing a light flashes in order to attract mates. They are believed to have a capacitor-like mechanism, that slowly charges until certain threshold is reached, at which they release the energy in form of light, after which the cycle repeats. Firefly Algorithm (FA) is novel nature inspired meta-heuristic algorithm based on rhythmic flashing behavior of Fireflies. 9
  • 10. Firefly algorithm 3 flashing characteristics of fireflies to develop firefly- inspired algorithms. 1. one firefly will be attracted to other fireflies regardless of their gender 2. The attractiveness is proportional to the brightness and they both decrease as their distance increases. 3. The brightness of a firefly is determined by the landscape of the objective function. 10
  • 11. Firefly algorithm Objective function f(x), x = (x1... xd)T Generate initial population of fireflies xi (i = 1, 2... n) Light intensity Ii at xi is determined by f (xi) Define light absorption coefficient γ while (t < MaxGeneration) for i = 1 : n all n fireflies for j = 1 : n all n fireflies (inner loop) if (Ii < Ij), Move firefly i towards j; end if Vary attractiveness with distance r via exp[− r]γ Evaluate new solutions and update light intensity end for j end for i Rank the fireflies and find the current global best g* end while11
  • 12. Firefly algorithm First each firefly generates an initial solution randomly; parameters like Light Intensity I, Initial Attractiveness 0,β and light absorption coefficient are defined. Then for eachγ firefly, find the brightest firefly. If there is brighter firefly then less bright firefly will move towards the brighter one. When firefly moves its light intensity decreases and its attractiveness will change. Then best firefly will be chosen based on an objective function for the next iteration. This condition will continue until the max iteration is reached. 12
  • 13. Adapting Firefly algorithm for TSP FA can be used to solve a permutation problem, such as Travelling Salesman Problem. For that we need to implement functions Initial_Solution() and Distance(xi, xj ) in a way how it is represented in TSP. We also need to redefine the step movements of the fireflies 13
  • 14. Adapting Firefly algorithm for TSP Initial Solution fireflies are scattered over the search space in a uniform distribution. we need to produce m random permutations of (1, 2… n) as the initial fireflies. Use a greedy method or nearest neighborhood search for solution initialization would improve the performance of the algorithm. By putting one relatively good solution among the random solutions, would cause the random solutions immediately to advance towards the better solution. This would probably contribute to find the local optima faster, but not for better exploration of the search space.14
  • 15. Adapting Firefly algorithm for TSP Distance Function (a)Hamming’s distance (b)the number of the required swaps of the first solution in order to get the second one. Let’s examine this example. Consider permutations π1,π2 ∈ n� �1 = [1 2 3 4 5 6] �2 = [1 2 4 3 6 5] 15
  • 16. Adapting Firefly algorithm for TSP The Hamming’s distance between two permutations is the number of non corresponding elements in the sequence. Therefore, HammingDistance(π1, π2) is 4 (only the first two positions have the same elements). The Swap distance is the number of minimal required swaps of one permutation in order to obtain the other one. SwapDistance(π1, π2) is thereby, 2 (in the π2 we swap elements: 4 with 3 and then 5 with 6). 16
  • 17. Adapting Firefly algorithm for TSP Movement The movement of a firefly i attracted to another brighter (more attractive) firefly j is determined by: �� ������← (2,���) Where, dij is distance between firefly i and j. The length of movement of a firefly will be randomly selected from 2 to dij. 17
  • 18. Adapting Firefly algorithm for TSP When a firefly moves, existing solutions in the firefly is changed. Since the representation of firefly is a permutation representation, then we use Inversion Mutation to represent the movement. With inversion mutation, the path that has been formed can be maintained so the good path formed previously is not damaged. 18
  • 19. Implementation and Results The Firefly Algorithm with some modification in few parameters in order to adapt it to solve travelling Salesman problem is implemented by using MATLAB 2010. Intel CORE i5 machine with 3 GB RAM is used to run the algorithm. TSP datasets are standard TSP instances downloaded from TSPLIB This algorithm runs itself till the termination criteria are satisfied. We can use more than one termination criteria in the model such as predefined number of iterations, stagnations in the result, time-limit etc. Here, stagnation in the result is used as the termination criteria. 19
  • 26. Implementation and Results 26 Table 1 also shows performance Comparison with three of the most popular meta-heuristic algorithms the Ant Colony Optimization (ACO), the Genetic Algorithm (GA), and Simulated Annealing (SA).
  • 27. Conclusion Here, basic Firefly Algorithm (FA) is implemented with some modifications in parameters to adapt it for Travelling Salesman Problem (TSP) which consists of constructing a suitable conversion of the continuous functions as are attractiveness, distance and movement, into new discrete functions. The experimental results obtained on standard TSP instances. It shows that Firefly Algorithm (FA) provides better results than ACO, GA and SA in most of the instances. These results can be further improved by using various local search methods like Tabu Search, nearest neighborhood for initial solution. 27
  • 28. 28