SlideShare a Scribd company logo
1 of 13
Tackling the travelling salesman problem
Using Hill Climbing search algorithm
Agenda
•What is the TSP problem ?
•stochastic optimization
•hill-climbing
What is the TSP problem ?
The traveling salesman problem (TSP) asks for
the shortest route to visit a collection of cities
and return to the starting point. Despite an intensive
study by mathematicians, computer scientists, operations
researchers, and others, over the past 50 years, it remains
an open question whether or not an efficient general
solution method exists.
TSP is an NP-Hard Problem
That does not necessarily mean any one instance of the
problem will be hard to solve, it just means that we do not
currently have an algorithm that can give us the guaranteed
best solution for all problems in “polynomial time”.
Stochastic optimization
Stochastic optimization (SO) methods
are optimization methods that generate and use random
variables. For stochastic problems, the random variables
appear in the formulation of the optimization problem
itself, which involve random objective functions or random
constraints, for example. Stochastic optimization methods
also include methods with random iterates.
We take randomly generated routes through the cities
and incrementally improve/change them in some fashion
to search for a better route. How these changes are
made depends on the algorithm being used, but there
are a couple of simple approaches we can take, that I
will outline here:
• swapping the position of two cities on a route
• reversing the order of an entire section of a route
Hill-climbing
Solution landscapes
• A common way to visualize searching for solutions in an
optimization problem, such as the TSP, is to think of the
solutions existing within a “landscape”. Better solutions
exist higher up and we can take a step from one solution
to another in search of better solutions. How we make
steps will depend on the “move operators” we have
available and will therefore also affect how the
landscape “looks”. It will change which solutions are
“adjacent” to each other.
Solution landscapes
• For a simple optimization problem we can directly visual the solution
landscape:
The red dot represents our current solution. It should be pretty clear that if we simply carry
on going “uphill” we’ll get to the highest point in this solution landscape.
If we are using evolutionary optimization methods a solution landscape will often be referred
to as a fitness landscape.
Hill-climbing
• Hill-climbing, pretty much the simplest of
the stochastic optimisation methods, works like this:
• pick a place to start
• take any step that goes “uphill”
• if there are no more uphill steps, stop;
otherwise carry on taking uphill steps
• Metaphorically the algorithm climbs up a hill one step at a time.
It is a “greedy” algorithm and only ever takes steps that take it
uphill (though it can be adapted to behave differently). This
means that it is pretty quick to get to the top of a hill
Hill-climbing
As you can see our current solution (the red dot) can only
go downhill from it’s current position – yet it is not at the
highest point in the solution landscape.
Hill-climbing
The “biggest” hill in the solution landscape is known as
the global maximum. The top of any other hill is known as
a local maximum (it’s the highest point in the local area).
Standard hill-climbing will tend to get stuck at the top of a
local maximum, so we can modify our algorithm to restart
the hill-climb if need be. This will help hill-climbing find
better hills to climb – though it’s still a random search of
the initial starting points.
Thanks

More Related Content

What's hot

The Traveling Salesman Problem
The Traveling Salesman ProblemThe Traveling Salesman Problem
The Traveling Salesman Problem
Maryam Alipour
 

What's hot (20)

The Traveling Salesman Problem
The Traveling Salesman ProblemThe Traveling Salesman Problem
The Traveling Salesman Problem
 
Greedy Algorihm
Greedy AlgorihmGreedy Algorihm
Greedy Algorihm
 
Reinforcement Learning : A Beginners Tutorial
Reinforcement Learning : A Beginners TutorialReinforcement Learning : A Beginners Tutorial
Reinforcement Learning : A Beginners Tutorial
 
Optimization for Deep Learning
Optimization for Deep LearningOptimization for Deep Learning
Optimization for Deep Learning
 
Artificial Intelligence Searching Techniques
Artificial Intelligence Searching TechniquesArtificial Intelligence Searching Techniques
Artificial Intelligence Searching Techniques
 
hill climbing algorithm.pptx
hill climbing algorithm.pptxhill climbing algorithm.pptx
hill climbing algorithm.pptx
 
Local search algorithms
Local search algorithmsLocal search algorithms
Local search algorithms
 
Solving the traveling salesman problem by genetic algorithm
Solving the traveling salesman problem by genetic algorithmSolving the traveling salesman problem by genetic algorithm
Solving the traveling salesman problem by genetic algorithm
 
Rabin karp string matcher
Rabin karp string matcherRabin karp string matcher
Rabin karp string matcher
 
Back propagation
Back propagationBack propagation
Back propagation
 
Lecture 16 memory bounded search
Lecture 16 memory bounded searchLecture 16 memory bounded search
Lecture 16 memory bounded search
 
Heuristic search
Heuristic searchHeuristic search
Heuristic search
 
Optimization/Gradient Descent
Optimization/Gradient DescentOptimization/Gradient Descent
Optimization/Gradient Descent
 
Activation function
Activation functionActivation function
Activation function
 
Greedy method1
Greedy method1Greedy method1
Greedy method1
 
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycleBacktracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
 
Local search algorithm
Local search algorithmLocal search algorithm
Local search algorithm
 
Travelling salesman problem
Travelling salesman problemTravelling salesman problem
Travelling salesman problem
 
Crow search algorithm
Crow search algorithmCrow search algorithm
Crow search algorithm
 
Unit 2 in daa
Unit 2 in daaUnit 2 in daa
Unit 2 in daa
 

Similar to Traveling salesman problem

Artificial Intelligence_Anjali_Kumari_26900122059.pptx
Artificial Intelligence_Anjali_Kumari_26900122059.pptxArtificial Intelligence_Anjali_Kumari_26900122059.pptx
Artificial Intelligence_Anjali_Kumari_26900122059.pptx
CCBProduction
 

Similar to Traveling salesman problem (20)

AI_ppt.pptx
AI_ppt.pptxAI_ppt.pptx
AI_ppt.pptx
 
Artificial Intelligence - Hill climbing.
Artificial Intelligence - Hill climbing.Artificial Intelligence - Hill climbing.
Artificial Intelligence - Hill climbing.
 
02LocalSearch.pdf
02LocalSearch.pdf02LocalSearch.pdf
02LocalSearch.pdf
 
Hill climbing algorithm in artificial intelligence
Hill climbing algorithm in artificial intelligenceHill climbing algorithm in artificial intelligence
Hill climbing algorithm in artificial intelligence
 
Heuristc Search Techniques
Heuristc Search TechniquesHeuristc Search Techniques
Heuristc Search Techniques
 
Heuristic Search Techniques {Artificial Intelligence}
Heuristic Search Techniques {Artificial Intelligence}Heuristic Search Techniques {Artificial Intelligence}
Heuristic Search Techniques {Artificial Intelligence}
 
Lec 6 bsc csit
Lec 6 bsc csitLec 6 bsc csit
Lec 6 bsc csit
 
Artificial Intelligence_Anjali_Kumari_26900122059.pptx
Artificial Intelligence_Anjali_Kumari_26900122059.pptxArtificial Intelligence_Anjali_Kumari_26900122059.pptx
Artificial Intelligence_Anjali_Kumari_26900122059.pptx
 
AI_Session 9 Hill climbing algorithm.pptx
AI_Session 9 Hill climbing algorithm.pptxAI_Session 9 Hill climbing algorithm.pptx
AI_Session 9 Hill climbing algorithm.pptx
 
Hill climbing algorithm
Hill climbing algorithmHill climbing algorithm
Hill climbing algorithm
 
Ai planning with evolutionary computing
Ai planning with evolutionary computingAi planning with evolutionary computing
Ai planning with evolutionary computing
 
Informed Search Techniques new kirti L 8.pptx
Informed Search Techniques new kirti L 8.pptxInformed Search Techniques new kirti L 8.pptx
Informed Search Techniques new kirti L 8.pptx
 
I. Hill climbing algorithm II. Steepest hill climbing algorithm
I. Hill climbing algorithm II. Steepest hill climbing algorithmI. Hill climbing algorithm II. Steepest hill climbing algorithm
I. Hill climbing algorithm II. Steepest hill climbing algorithm
 
Heuristic search-in-artificial-intelligence
Heuristic search-in-artificial-intelligenceHeuristic search-in-artificial-intelligence
Heuristic search-in-artificial-intelligence
 
AI3391 Session 11 Hill climbing algorithm.pptx
AI3391 Session 11 Hill climbing algorithm.pptxAI3391 Session 11 Hill climbing algorithm.pptx
AI3391 Session 11 Hill climbing algorithm.pptx
 
Heuristic or informed search
Heuristic or informed searchHeuristic or informed search
Heuristic or informed search
 
Hill Climbing.pptx
Hill Climbing.pptxHill Climbing.pptx
Hill Climbing.pptx
 
A* Algorithm
A* AlgorithmA* Algorithm
A* Algorithm
 
Problem Formulation in Artificial Inteligence Projects
Problem Formulation in Artificial Inteligence ProjectsProblem Formulation in Artificial Inteligence Projects
Problem Formulation in Artificial Inteligence Projects
 
Week6n7 Applications of Derivative.pptx
Week6n7 Applications of  Derivative.pptxWeek6n7 Applications of  Derivative.pptx
Week6n7 Applications of Derivative.pptx
 

Recently uploaded

Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 

Recently uploaded (20)

Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 

Traveling salesman problem

  • 1. Tackling the travelling salesman problem Using Hill Climbing search algorithm
  • 2. Agenda •What is the TSP problem ? •stochastic optimization •hill-climbing
  • 3. What is the TSP problem ? The traveling salesman problem (TSP) asks for the shortest route to visit a collection of cities and return to the starting point. Despite an intensive study by mathematicians, computer scientists, operations researchers, and others, over the past 50 years, it remains an open question whether or not an efficient general solution method exists.
  • 4. TSP is an NP-Hard Problem That does not necessarily mean any one instance of the problem will be hard to solve, it just means that we do not currently have an algorithm that can give us the guaranteed best solution for all problems in “polynomial time”.
  • 5. Stochastic optimization Stochastic optimization (SO) methods are optimization methods that generate and use random variables. For stochastic problems, the random variables appear in the formulation of the optimization problem itself, which involve random objective functions or random constraints, for example. Stochastic optimization methods also include methods with random iterates.
  • 6. We take randomly generated routes through the cities and incrementally improve/change them in some fashion to search for a better route. How these changes are made depends on the algorithm being used, but there are a couple of simple approaches we can take, that I will outline here: • swapping the position of two cities on a route • reversing the order of an entire section of a route
  • 8. Solution landscapes • A common way to visualize searching for solutions in an optimization problem, such as the TSP, is to think of the solutions existing within a “landscape”. Better solutions exist higher up and we can take a step from one solution to another in search of better solutions. How we make steps will depend on the “move operators” we have available and will therefore also affect how the landscape “looks”. It will change which solutions are “adjacent” to each other.
  • 9. Solution landscapes • For a simple optimization problem we can directly visual the solution landscape: The red dot represents our current solution. It should be pretty clear that if we simply carry on going “uphill” we’ll get to the highest point in this solution landscape. If we are using evolutionary optimization methods a solution landscape will often be referred to as a fitness landscape.
  • 10. Hill-climbing • Hill-climbing, pretty much the simplest of the stochastic optimisation methods, works like this: • pick a place to start • take any step that goes “uphill” • if there are no more uphill steps, stop; otherwise carry on taking uphill steps • Metaphorically the algorithm climbs up a hill one step at a time. It is a “greedy” algorithm and only ever takes steps that take it uphill (though it can be adapted to behave differently). This means that it is pretty quick to get to the top of a hill
  • 11. Hill-climbing As you can see our current solution (the red dot) can only go downhill from it’s current position – yet it is not at the highest point in the solution landscape.
  • 12. Hill-climbing The “biggest” hill in the solution landscape is known as the global maximum. The top of any other hill is known as a local maximum (it’s the highest point in the local area). Standard hill-climbing will tend to get stuck at the top of a local maximum, so we can modify our algorithm to restart the hill-climb if need be. This will help hill-climbing find better hills to climb – though it’s still a random search of the initial starting points.