SlideShare a Scribd company logo
Artificial intelligence
Group members
Hamza Haseeb(14)
Harmain Haider(23)
content
 Travelling salesman problem?
 Methods to solve this problem
 Hungarian method
 Advantages of Hungarian method
 Time complexity
Travelling salesman
problem
 What is the problem?
Given a list of cites and the distances
between each pair of cities, what is the
shortest possible route that visit each city
exactly once and returns to the origin city.
Methods to solve
 Genetic algorithm
 Branch and bound method
 Dynamic programming
 Optimal solution
 Heuristic algorithm
 Hungarian method
Hungarian method
 The Hungarian method is an algorithm
which finds an optimal assignment for a
given cost matrix.
Algorithm
 Step 1. Subtract the smallest entry in each row from all
the entries of its row.
 Step 2. Subtract the smallest entry in each column from
all the entries of its column.
 Step 3. Draw lines through appropriate rows and columns
so that all the zero entries of the cost matrix are covered
and the minimum number of such lines is used.
 Step 4. Test for Optimality: (i) If the minimum number of
covering lines is n, an optimal assignment of zeros is
possible and we are finished. (ii) If the minimum number
of covering lines is less than n, an optimal assignment of
zeros is not yet possible. In that case, proceed to Step 5.
 Step 5. Determine the smallest entry not covered by any
line. Subtract this entry from each uncovered row, and
then add it to each covered column. Return to Step 3.
Advantages of Hungarian
method
 Hungarian method provides optimal
solution for travelling salesman problem
with minimum cost to travel to all cities
only once and travel back to the origin
city
 It is also used in assignment problems
for example: If there are different tasks
and many employees and you want to
assign them tasks.
Time complexity
 The time complexity of the original
algorithm was O(n^4).
 But it is later modified to O(n^3) and it is
difficult to implement than O(n^4)
algorithm.

More Related Content

What's hot

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
Alex Bidanets
 
Traveling salesman problem
Traveling salesman problemTraveling salesman problem
Traveling salesman problem
Jayesh Chauhan
 
Traveling salesman problem(tsp)
Traveling salesman problem(tsp)Traveling salesman problem(tsp)
Traveling salesman problem(tsp)
Viraj Patil
 
Travelling Salesman Problem
Travelling Salesman ProblemTravelling Salesman Problem
Travelling Salesman Problem
Shikha Gupta
 
Travelling salesman problem
Travelling salesman problemTravelling salesman problem
Travelling salesman problem
Wajahat Hussain
 
Greedy algorithm
Greedy algorithmGreedy algorithm
Greedy algorithm
Caisar Oentoro
 
Tsp branch and-bound
Tsp branch and-boundTsp branch and-bound
Tsp branch and-bound
Saravanan Natarajan
 
Greedy algorithm
Greedy algorithmGreedy algorithm
Branch and bound
Branch and boundBranch and bound
Branch and bound
Nv Thejaswini
 
Approximation Algorithms TSP
Approximation Algorithms   TSPApproximation Algorithms   TSP
Travelling salesman dynamic programming
Travelling salesman dynamic programmingTravelling salesman dynamic programming
Travelling salesman dynamic programming
maharajdey
 
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programming
Yıldırım Tam
 
Travelling salesman problem using genetic algorithms
Travelling salesman problem using genetic algorithms Travelling salesman problem using genetic algorithms
Travelling salesman problem using genetic algorithms
Shivank Shah
 
Markov decision process
Markov decision processMarkov decision process
Markov decision process
Hamed Abdi
 
Introduction to Dynamic Programming, Principle of Optimality
Introduction to Dynamic Programming, Principle of OptimalityIntroduction to Dynamic Programming, Principle of Optimality
Introduction to Dynamic Programming, Principle of Optimality
Bhavin Darji
 
Branch and bound
Branch and boundBranch and bound
Branch and bound
Dr Shashikant Athawale
 
Gradient descent method
Gradient descent methodGradient descent method
Gradient descent method
Sanghyuk Chun
 
Greedy Algorithm - Knapsack Problem
Greedy Algorithm - Knapsack ProblemGreedy Algorithm - Knapsack Problem
Greedy Algorithm - Knapsack Problem
Madhu Bala
 
Problem reduction AND OR GRAPH & AO* algorithm.ppt
Problem reduction AND OR GRAPH & AO* algorithm.pptProblem reduction AND OR GRAPH & AO* algorithm.ppt
Problem reduction AND OR GRAPH & AO* algorithm.ppt
arunsingh660
 
Dijkstra's Algorithm
Dijkstra's Algorithm Dijkstra's Algorithm
Dijkstra's Algorithm
Rashik Ishrak Nahian
 

What's hot (20)

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
 
Traveling salesman problem
Traveling salesman problemTraveling salesman problem
Traveling salesman problem
 
Traveling salesman problem(tsp)
Traveling salesman problem(tsp)Traveling salesman problem(tsp)
Traveling salesman problem(tsp)
 
Travelling Salesman Problem
Travelling Salesman ProblemTravelling Salesman Problem
Travelling Salesman Problem
 
Travelling salesman problem
Travelling salesman problemTravelling salesman problem
Travelling salesman problem
 
Greedy algorithm
Greedy algorithmGreedy algorithm
Greedy algorithm
 
Tsp branch and-bound
Tsp branch and-boundTsp branch and-bound
Tsp branch and-bound
 
Greedy algorithm
Greedy algorithmGreedy algorithm
Greedy algorithm
 
Branch and bound
Branch and boundBranch and bound
Branch and bound
 
Approximation Algorithms TSP
Approximation Algorithms   TSPApproximation Algorithms   TSP
Approximation Algorithms TSP
 
Travelling salesman dynamic programming
Travelling salesman dynamic programmingTravelling salesman dynamic programming
Travelling salesman dynamic programming
 
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programming
 
Travelling salesman problem using genetic algorithms
Travelling salesman problem using genetic algorithms Travelling salesman problem using genetic algorithms
Travelling salesman problem using genetic algorithms
 
Markov decision process
Markov decision processMarkov decision process
Markov decision process
 
Introduction to Dynamic Programming, Principle of Optimality
Introduction to Dynamic Programming, Principle of OptimalityIntroduction to Dynamic Programming, Principle of Optimality
Introduction to Dynamic Programming, Principle of Optimality
 
Branch and bound
Branch and boundBranch and bound
Branch and bound
 
Gradient descent method
Gradient descent methodGradient descent method
Gradient descent method
 
Greedy Algorithm - Knapsack Problem
Greedy Algorithm - Knapsack ProblemGreedy Algorithm - Knapsack Problem
Greedy Algorithm - Knapsack Problem
 
Problem reduction AND OR GRAPH & AO* algorithm.ppt
Problem reduction AND OR GRAPH & AO* algorithm.pptProblem reduction AND OR GRAPH & AO* algorithm.ppt
Problem reduction AND OR GRAPH & AO* algorithm.ppt
 
Dijkstra's Algorithm
Dijkstra's Algorithm Dijkstra's Algorithm
Dijkstra's Algorithm
 

Similar to Travelling salesman problem

Comparison Study of Multiple Traveling Salesmen Problem using Genetic Algorithm
Comparison Study of Multiple Traveling Salesmen Problem using Genetic AlgorithmComparison Study of Multiple Traveling Salesmen Problem using Genetic Algorithm
Comparison Study of Multiple Traveling Salesmen Problem using Genetic Algorithm
IOSR Journals
 
19IS402_LP1_LM_22-23.pdf
19IS402_LP1_LM_22-23.pdf19IS402_LP1_LM_22-23.pdf
19IS402_LP1_LM_22-23.pdf
GOWTHAMR721887
 
Hungarian Method
Hungarian MethodHungarian Method
Hungarian Method
Aritra7469
 
Assignment problem method
Assignment problem methodAssignment problem method
Assignment problem method
Rishika Gupta
 
Assignment problem
Assignment problemAssignment problem
Assignment problemAbu Bashar
 
Traveling Salesman Problem (TSP)
Traveling Salesman Problem (TSP)Traveling Salesman Problem (TSP)
Traveling Salesman Problem (TSP)
Maksym Voitko
 
Introduction to algorithn class 1
Introduction to algorithn class 1Introduction to algorithn class 1
Introduction to algorithn class 1Kumar
 
The Traveling Salesman problem ppt.pptx
The Traveling Salesman problem ppt.pptxThe Traveling Salesman problem ppt.pptx
The Traveling Salesman problem ppt.pptx
HalimFerchichi
 
A feasible solution algorithm for a primitive vehicle routing problem
A feasible solution algorithm for a primitive vehicle routing problemA feasible solution algorithm for a primitive vehicle routing problem
A feasible solution algorithm for a primitive vehicle routing problemCem Recai Çırak
 
Traveling salesman problem
Traveling salesman problemTraveling salesman problem
Traveling salesman problem
Ameer Hamxa
 
6. assignment problems
6. assignment problems6. assignment problems
6. assignment problems
Hakeem-Ur- Rehman
 
Daa chapter 1
Daa chapter 1Daa chapter 1
Daa chapter 1
B.Kirron Reddi
 
dsa.pptx
dsa.pptxdsa.pptx
Operations Research
Operations ResearchOperations Research
Operations Research
Muthulakshmilakshmi2
 
Operations Research
Operations ResearchOperations Research
Operations Research
SwathiSundari
 
OPERATIONAL RESEARCH BUSINESS APPLICATIONS
OPERATIONAL RESEARCH BUSINESS APPLICATIONS OPERATIONAL RESEARCH BUSINESS APPLICATIONS
OPERATIONAL RESEARCH BUSINESS APPLICATIONS
Akhilesh Mishra
 
Operations Research
Operations ResearchOperations Research
Operations Research
nagathangaraj
 
Combinatorial Optimization
Combinatorial OptimizationCombinatorial Optimization
Combinatorial Optimization
Institute of Technology, Nirma University
 
ETCS262A-Analysis of design Algorithm.pptx
ETCS262A-Analysis of design Algorithm.pptxETCS262A-Analysis of design Algorithm.pptx
ETCS262A-Analysis of design Algorithm.pptx
RahulSingh190790
 
Design & Analysis Of Algorithm
Design & Analysis Of AlgorithmDesign & Analysis Of Algorithm
Design & Analysis Of Algorithm
Computer Hardware & Trouble shooting
 

Similar to Travelling salesman problem (20)

Comparison Study of Multiple Traveling Salesmen Problem using Genetic Algorithm
Comparison Study of Multiple Traveling Salesmen Problem using Genetic AlgorithmComparison Study of Multiple Traveling Salesmen Problem using Genetic Algorithm
Comparison Study of Multiple Traveling Salesmen Problem using Genetic Algorithm
 
19IS402_LP1_LM_22-23.pdf
19IS402_LP1_LM_22-23.pdf19IS402_LP1_LM_22-23.pdf
19IS402_LP1_LM_22-23.pdf
 
Hungarian Method
Hungarian MethodHungarian Method
Hungarian Method
 
Assignment problem method
Assignment problem methodAssignment problem method
Assignment problem method
 
Assignment problem
Assignment problemAssignment problem
Assignment problem
 
Traveling Salesman Problem (TSP)
Traveling Salesman Problem (TSP)Traveling Salesman Problem (TSP)
Traveling Salesman Problem (TSP)
 
Introduction to algorithn class 1
Introduction to algorithn class 1Introduction to algorithn class 1
Introduction to algorithn class 1
 
The Traveling Salesman problem ppt.pptx
The Traveling Salesman problem ppt.pptxThe Traveling Salesman problem ppt.pptx
The Traveling Salesman problem ppt.pptx
 
A feasible solution algorithm for a primitive vehicle routing problem
A feasible solution algorithm for a primitive vehicle routing problemA feasible solution algorithm for a primitive vehicle routing problem
A feasible solution algorithm for a primitive vehicle routing problem
 
Traveling salesman problem
Traveling salesman problemTraveling salesman problem
Traveling salesman problem
 
6. assignment problems
6. assignment problems6. assignment problems
6. assignment problems
 
Daa chapter 1
Daa chapter 1Daa chapter 1
Daa chapter 1
 
dsa.pptx
dsa.pptxdsa.pptx
dsa.pptx
 
Operations Research
Operations ResearchOperations Research
Operations Research
 
Operations Research
Operations ResearchOperations Research
Operations Research
 
OPERATIONAL RESEARCH BUSINESS APPLICATIONS
OPERATIONAL RESEARCH BUSINESS APPLICATIONS OPERATIONAL RESEARCH BUSINESS APPLICATIONS
OPERATIONAL RESEARCH BUSINESS APPLICATIONS
 
Operations Research
Operations ResearchOperations Research
Operations Research
 
Combinatorial Optimization
Combinatorial OptimizationCombinatorial Optimization
Combinatorial Optimization
 
ETCS262A-Analysis of design Algorithm.pptx
ETCS262A-Analysis of design Algorithm.pptxETCS262A-Analysis of design Algorithm.pptx
ETCS262A-Analysis of design Algorithm.pptx
 
Design & Analysis Of Algorithm
Design & Analysis Of AlgorithmDesign & Analysis Of Algorithm
Design & Analysis Of Algorithm
 

Recently uploaded

Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Anthony Dahanne
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
WSO2
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
vrstrong314
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Jay Das
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 

Recently uploaded (20)

Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 

Travelling salesman problem

  • 1. Artificial intelligence Group members Hamza Haseeb(14) Harmain Haider(23)
  • 2. content  Travelling salesman problem?  Methods to solve this problem  Hungarian method  Advantages of Hungarian method  Time complexity
  • 3. Travelling salesman problem  What is the problem? Given a list of cites and the distances between each pair of cities, what is the shortest possible route that visit each city exactly once and returns to the origin city.
  • 4. Methods to solve  Genetic algorithm  Branch and bound method  Dynamic programming  Optimal solution  Heuristic algorithm  Hungarian method
  • 5. Hungarian method  The Hungarian method is an algorithm which finds an optimal assignment for a given cost matrix.
  • 6. Algorithm  Step 1. Subtract the smallest entry in each row from all the entries of its row.  Step 2. Subtract the smallest entry in each column from all the entries of its column.  Step 3. Draw lines through appropriate rows and columns so that all the zero entries of the cost matrix are covered and the minimum number of such lines is used.  Step 4. Test for Optimality: (i) If the minimum number of covering lines is n, an optimal assignment of zeros is possible and we are finished. (ii) If the minimum number of covering lines is less than n, an optimal assignment of zeros is not yet possible. In that case, proceed to Step 5.  Step 5. Determine the smallest entry not covered by any line. Subtract this entry from each uncovered row, and then add it to each covered column. Return to Step 3.
  • 7. Advantages of Hungarian method  Hungarian method provides optimal solution for travelling salesman problem with minimum cost to travel to all cities only once and travel back to the origin city  It is also used in assignment problems for example: If there are different tasks and many employees and you want to assign them tasks.
  • 8. Time complexity  The time complexity of the original algorithm was O(n^4).  But it is later modified to O(n^3) and it is difficult to implement than O(n^4) algorithm.