SlideShare a Scribd company logo
1 of 25
Approximation
Algorithms
Bipesh Subedi
ME 2021, Computer Engineering
DoCSE
Outline
2
➔ Introduction
➔ Optimization Problem
➔ Statement
➔ Approximation Ratio
➔ Examples of Approximation algorithms
➔ Travelling Salesman Problem (TSP)
➔ Analysis
➔ Application
➔ Pros and Cons
➔ ‘Conclusion
Introduction
Approximation algorithms refers to the efficient algorithms that finds a
solution to an optimization problems ( in particular NP-Hard problems )
that is provably close to optimal solution.
When it is used ?
➔ When finding an optimal solution is very difficult
➔ In some cases, where exact solution is not needed and near-
optimal solution can be found quickly
3
➔ For NP-Complete problems, there is possibly no
polynomial-time algorithms to find an optimal solution.
➔ The idea of approximation algorithms is to develop
polynomial-time algorithms to get near optimal solution.
4
Optimization Problem
It refers to the problem of finding best option/solution among all
feasible/possible solutions.
Various important applied problems involve in finding the best possible way
to accomplish the task which is often done by finding the maximum or
minimum values to a function.
➔ Maximization Problem : Finding the maximum optimal value
➔ Minimization Problem : Finding the minimal optimum value
For example: the minimum time to make a certain journey, the minimum
cost for doing a task, the maximum power that can be generated by a
device, and so on.
5
Statement
➔ An algorithm for a problem of size n has an approximation ratio
ρ(n) if for any input, the algorithm produces a solution with cost
C that satisfies the property:
Where Copt is the cost of optimal solution and ρ(n) is a constant or a
function of n.
6
Approximation Ratio
➔ The approximation ratio of an algorithm is the ratio
between the result obtained by the algorithm and the
optimal cost.
Significance
➔ Performance Guarantee:
It guarantees that the result produced by the approximation
algorithm is not going to be worse than a factor of ρ(n)
compared to the optimal solution.
7
The algorithm with approximation ratio ρ(n) is then called
ρ(n)-approximation algorithm.
Here we will consider our approximation algorithm to have
constant approximation ratio.
For example: If ρ(n) = 2 then,
For maximization problem : our solution will be no less than half
the optimal solution. ( Copt/C <= 2 )
For minimization problem : our solution will be no more than
twice the optimal solution. (C/Copt <= 2)
8
Range of Approximation ratio
➔ If ρ(n) =1 then,
The algorithm can always find a
optimal solution
➔ If ρ(n) >1 then,
It gives the approximation in which
the algorithm works.
9
10
Examples of Approximation algorithms
➔ Travelling salesman Problem
➔ Vertex-Cover Problem
➔ Bin Packing
Travelling Salesman Problem (TSP)
A salesman should visit all the cities exactly once starting from one
city and return back to the starting city such that the total length of the
tour should be minimum.
➔ It is a NP-Complete problem so, there is no polynomial time.
➔ Use an approximation algorithm with a constant approximation
ratio.
11
Special Case of
Travelling
Salesman
Problem (TSP)
Triangle Inequality Property
a + b >= c
b + c >= a
a + c >= b
12
Approach
13
Step 1: Start with a complete graph.
Step 2: Compute a Minimum Spanning
Tree (MST) using algorithms like Prim’s,
kruskal’s.
Step 3: Perform a Depth-First Search
(DFS) traversal.
Step 4: Delete duplicate vertices.
Step 5: Join the edges in the order to
obtain approx. tour walk.
Given a weighted, undirected graph,
start from certain vertex, find a
minimum route to visit each vertices
once, and return to the original
vertex.
14
Computing Minimum Spanning Tree
Kruskal’s algorithm
Steps:
1. Sort all the edges in non-decreasing order
of their weight.
2. Pick the smallest edge. Check if it forms a
cycle in the spanning tree formed so far. If no
cycle is formed, include this edge. Otherwise,
discard it.
3. Repeat step 2 until it is a spanning tree.
15
After computing the
minimum spanning tree ,
we perform a depth-first
search in the MST
starting from a vertex A.
16
MST-DFS
17
A -> B -> D -> B
18
A -> B -> D -> B -> E -> B -> A
19
A -> B -> D -> B -> E -> B -> A -> C -> A
After deleting duplicate vertices we
get, A -> B -> D -> E -> C -> A path.
Joining the edges in the above
order we obtain the approx. tour
route.
20
Analysis
➔ Depth first tree tour (DFTT) length is exactly twice the MST’s weight.
➔ MST weight is not more than the length of optimal tour
➔ The tour length is at most twice the optimal length i.e C <= 2 x Copt
So, in this case ρ(n) = 2
Cost found by the APPROX-MST-DFS algorithm :
C = 15 + 10 + 25 + 25 + 30 = 105
Optimal cost ( Copt ) = Sum of MST weights = 15 + 10 + 25 + 10 = 60
C/Copt <= ρ(n)
105/60 <= 2
1.75 <= 2
21
➔ For companies like FedEx and their competitors traveling
salesman problem is used as a reference to solve related
/similar problems.
➔ Can be used in network design and routing purposes.
➔ Used in astronomy to determine the fastest way of drilling an
aluminium disk placed at the focal point of telescope for each
spot of interest to collect the light from the galaxy or star over
a given period of time .
22
Application
Pros
➔ Deals with NP- Complete
problems
➔ Finds solutions which are close
to optimal solution in
polynomial time
➔ Cost Effective
Cons
➔ This technique does not
guarantee the best solution
➔ May not be useful in all
practical application
23
Conclusion
To conclude we can say that the goal of an approximation
algorithm is to come as close as possible to the optimum value
in a reasonable amount of time which is at the most polynomial
time.
24
Thank you !!
25

More Related Content

What's hot

What's hot (20)

Presentation of daa on approximation algorithm and vertex cover problem
Presentation of daa on approximation algorithm and vertex cover problem Presentation of daa on approximation algorithm and vertex cover problem
Presentation of daa on approximation algorithm and vertex cover problem
 
A* Algorithm
A* AlgorithmA* Algorithm
A* Algorithm
 
Brute force method
Brute force methodBrute force method
Brute force method
 
Backtracking & branch and bound
Backtracking & branch and boundBacktracking & branch and bound
Backtracking & branch and bound
 
Divide and Conquer - Part 1
Divide and Conquer - Part 1Divide and Conquer - Part 1
Divide and Conquer - Part 1
 
Minimum spanning tree
Minimum spanning treeMinimum spanning tree
Minimum spanning tree
 
Intelligent Heuristics for the Game Isolation
Intelligent Heuristics  for the Game IsolationIntelligent Heuristics  for the Game Isolation
Intelligent Heuristics for the Game Isolation
 
Adversarial search
Adversarial search Adversarial search
Adversarial search
 
Backtracking
BacktrackingBacktracking
Backtracking
 
Asymptotic notation
Asymptotic notationAsymptotic notation
Asymptotic notation
 
Traveling Salesman Problem
Traveling Salesman Problem Traveling Salesman Problem
Traveling Salesman Problem
 
Simulated annealing
Simulated annealingSimulated annealing
Simulated annealing
 
Activation functions
Activation functionsActivation functions
Activation functions
 
Approximation algorithms
Approximation algorithmsApproximation algorithms
Approximation algorithms
 
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
 
Tsp is NP-Complete
Tsp is NP-CompleteTsp is NP-Complete
Tsp is NP-Complete
 
Travelling Salesman Problem
Travelling Salesman ProblemTravelling Salesman Problem
Travelling Salesman Problem
 
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programming
 
Ai 7
Ai 7Ai 7
Ai 7
 
Daa notes 1
Daa notes 1Daa notes 1
Daa notes 1
 

Similar to Approximation algorithms

UNIT-II.pptx
UNIT-II.pptxUNIT-II.pptx
UNIT-II.pptxJyoReddy9
 
Unit 3- Greedy Method.pptx
Unit 3- Greedy Method.pptxUnit 3- Greedy Method.pptx
Unit 3- Greedy Method.pptxMaryJacob24
 
Introduction to dynamic programming
Introduction to dynamic programmingIntroduction to dynamic programming
Introduction to dynamic programmingAmisha Narsingani
 
Algorithms Design Patterns
Algorithms Design PatternsAlgorithms Design Patterns
Algorithms Design PatternsAshwin Shiv
 
Dynamic programmng2
Dynamic programmng2Dynamic programmng2
Dynamic programmng2debolina13
 
clear allclc Ex2-1 A) Compute the 5 gravity profiles.docx
clear allclc Ex2-1 A)  Compute the 5 gravity profiles.docxclear allclc Ex2-1 A)  Compute the 5 gravity profiles.docx
clear allclc Ex2-1 A) Compute the 5 gravity profiles.docxmonicafrancis71118
 
Unit 3 greedy method
Unit 3  greedy methodUnit 3  greedy method
Unit 3 greedy methodMaryJacob24
 
Unit 3 - Greedy Method
Unit 3  - Greedy MethodUnit 3  - Greedy Method
Unit 3 - Greedy MethodMaryJacob24
 
ETCS262A-Analysis of design Algorithm.pptx
ETCS262A-Analysis of design Algorithm.pptxETCS262A-Analysis of design Algorithm.pptx
ETCS262A-Analysis of design Algorithm.pptxRahulSingh190790
 
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
 
Data_Structure_and_Algorithms_Lecture_1.ppt
Data_Structure_and_Algorithms_Lecture_1.pptData_Structure_and_Algorithms_Lecture_1.ppt
Data_Structure_and_Algorithms_Lecture_1.pptISHANAMRITSRIVASTAVA
 
APLICACIONES DE LA DERIVADA EN LA CARRERA DE (Mecánica, Electrónica, Telecomu...
APLICACIONES DE LA DERIVADA EN LA CARRERA DE (Mecánica, Electrónica, Telecomu...APLICACIONES DE LA DERIVADA EN LA CARRERA DE (Mecánica, Electrónica, Telecomu...
APLICACIONES DE LA DERIVADA EN LA CARRERA DE (Mecánica, Electrónica, Telecomu...WILIAMMAURICIOCAHUAT1
 
Undecidable Problems and Approximation Algorithms
Undecidable Problems and Approximation AlgorithmsUndecidable Problems and Approximation Algorithms
Undecidable Problems and Approximation AlgorithmsMuthu Vinayagam
 
Graph Traversal Algorithms - Breadth First Search
Graph Traversal Algorithms - Breadth First SearchGraph Traversal Algorithms - Breadth First Search
Graph Traversal Algorithms - Breadth First SearchAmrinder Arora
 

Similar to Approximation algorithms (20)

NP-Completeness - II
NP-Completeness - IINP-Completeness - II
NP-Completeness - II
 
UNIT-II.pptx
UNIT-II.pptxUNIT-II.pptx
UNIT-II.pptx
 
Unit 3- Greedy Method.pptx
Unit 3- Greedy Method.pptxUnit 3- Greedy Method.pptx
Unit 3- Greedy Method.pptx
 
Greedy Algorihm
Greedy AlgorihmGreedy Algorihm
Greedy Algorihm
 
Introduction to dynamic programming
Introduction to dynamic programmingIntroduction to dynamic programming
Introduction to dynamic programming
 
Analysis of Algorithm
Analysis of AlgorithmAnalysis of Algorithm
Analysis of Algorithm
 
Combinatorial Optimization
Combinatorial OptimizationCombinatorial Optimization
Combinatorial Optimization
 
Algorithms Design Patterns
Algorithms Design PatternsAlgorithms Design Patterns
Algorithms Design Patterns
 
Dynamic programmng2
Dynamic programmng2Dynamic programmng2
Dynamic programmng2
 
clear allclc Ex2-1 A) Compute the 5 gravity profiles.docx
clear allclc Ex2-1 A)  Compute the 5 gravity profiles.docxclear allclc Ex2-1 A)  Compute the 5 gravity profiles.docx
clear allclc Ex2-1 A) Compute the 5 gravity profiles.docx
 
Unit 3 greedy method
Unit 3  greedy methodUnit 3  greedy method
Unit 3 greedy method
 
Unit 3 - Greedy Method
Unit 3  - Greedy MethodUnit 3  - Greedy Method
Unit 3 - Greedy Method
 
ETCS262A-Analysis of design Algorithm.pptx
ETCS262A-Analysis of design Algorithm.pptxETCS262A-Analysis of design Algorithm.pptx
ETCS262A-Analysis of design Algorithm.pptx
 
Greedymethod
GreedymethodGreedymethod
Greedymethod
 
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
 
Data_Structure_and_Algorithms_Lecture_1.ppt
Data_Structure_and_Algorithms_Lecture_1.pptData_Structure_and_Algorithms_Lecture_1.ppt
Data_Structure_and_Algorithms_Lecture_1.ppt
 
Computer Science Exam Help
Computer Science Exam Help Computer Science Exam Help
Computer Science Exam Help
 
APLICACIONES DE LA DERIVADA EN LA CARRERA DE (Mecánica, Electrónica, Telecomu...
APLICACIONES DE LA DERIVADA EN LA CARRERA DE (Mecánica, Electrónica, Telecomu...APLICACIONES DE LA DERIVADA EN LA CARRERA DE (Mecánica, Electrónica, Telecomu...
APLICACIONES DE LA DERIVADA EN LA CARRERA DE (Mecánica, Electrónica, Telecomu...
 
Undecidable Problems and Approximation Algorithms
Undecidable Problems and Approximation AlgorithmsUndecidable Problems and Approximation Algorithms
Undecidable Problems and Approximation Algorithms
 
Graph Traversal Algorithms - Breadth First Search
Graph Traversal Algorithms - Breadth First SearchGraph Traversal Algorithms - Breadth First Search
Graph Traversal Algorithms - Breadth First Search
 

Recently uploaded

College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and usesDevarapalliHaritha
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
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
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2RajaP95
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 

Recently uploaded (20)

College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and uses
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
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
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 

Approximation algorithms

  • 2. Outline 2 ➔ Introduction ➔ Optimization Problem ➔ Statement ➔ Approximation Ratio ➔ Examples of Approximation algorithms ➔ Travelling Salesman Problem (TSP) ➔ Analysis ➔ Application ➔ Pros and Cons ➔ ‘Conclusion
  • 3. Introduction Approximation algorithms refers to the efficient algorithms that finds a solution to an optimization problems ( in particular NP-Hard problems ) that is provably close to optimal solution. When it is used ? ➔ When finding an optimal solution is very difficult ➔ In some cases, where exact solution is not needed and near- optimal solution can be found quickly 3
  • 4. ➔ For NP-Complete problems, there is possibly no polynomial-time algorithms to find an optimal solution. ➔ The idea of approximation algorithms is to develop polynomial-time algorithms to get near optimal solution. 4
  • 5. Optimization Problem It refers to the problem of finding best option/solution among all feasible/possible solutions. Various important applied problems involve in finding the best possible way to accomplish the task which is often done by finding the maximum or minimum values to a function. ➔ Maximization Problem : Finding the maximum optimal value ➔ Minimization Problem : Finding the minimal optimum value For example: the minimum time to make a certain journey, the minimum cost for doing a task, the maximum power that can be generated by a device, and so on. 5
  • 6. Statement ➔ An algorithm for a problem of size n has an approximation ratio ρ(n) if for any input, the algorithm produces a solution with cost C that satisfies the property: Where Copt is the cost of optimal solution and ρ(n) is a constant or a function of n. 6
  • 7. Approximation Ratio ➔ The approximation ratio of an algorithm is the ratio between the result obtained by the algorithm and the optimal cost. Significance ➔ Performance Guarantee: It guarantees that the result produced by the approximation algorithm is not going to be worse than a factor of ρ(n) compared to the optimal solution. 7
  • 8. The algorithm with approximation ratio ρ(n) is then called ρ(n)-approximation algorithm. Here we will consider our approximation algorithm to have constant approximation ratio. For example: If ρ(n) = 2 then, For maximization problem : our solution will be no less than half the optimal solution. ( Copt/C <= 2 ) For minimization problem : our solution will be no more than twice the optimal solution. (C/Copt <= 2) 8
  • 9. Range of Approximation ratio ➔ If ρ(n) =1 then, The algorithm can always find a optimal solution ➔ If ρ(n) >1 then, It gives the approximation in which the algorithm works. 9
  • 10. 10 Examples of Approximation algorithms ➔ Travelling salesman Problem ➔ Vertex-Cover Problem ➔ Bin Packing
  • 11. Travelling Salesman Problem (TSP) A salesman should visit all the cities exactly once starting from one city and return back to the starting city such that the total length of the tour should be minimum. ➔ It is a NP-Complete problem so, there is no polynomial time. ➔ Use an approximation algorithm with a constant approximation ratio. 11
  • 12. Special Case of Travelling Salesman Problem (TSP) Triangle Inequality Property a + b >= c b + c >= a a + c >= b 12
  • 13. Approach 13 Step 1: Start with a complete graph. Step 2: Compute a Minimum Spanning Tree (MST) using algorithms like Prim’s, kruskal’s. Step 3: Perform a Depth-First Search (DFS) traversal. Step 4: Delete duplicate vertices. Step 5: Join the edges in the order to obtain approx. tour walk.
  • 14. Given a weighted, undirected graph, start from certain vertex, find a minimum route to visit each vertices once, and return to the original vertex. 14
  • 15. Computing Minimum Spanning Tree Kruskal’s algorithm Steps: 1. Sort all the edges in non-decreasing order of their weight. 2. Pick the smallest edge. Check if it forms a cycle in the spanning tree formed so far. If no cycle is formed, include this edge. Otherwise, discard it. 3. Repeat step 2 until it is a spanning tree. 15
  • 16. After computing the minimum spanning tree , we perform a depth-first search in the MST starting from a vertex A. 16
  • 17. MST-DFS 17 A -> B -> D -> B
  • 18. 18 A -> B -> D -> B -> E -> B -> A
  • 19. 19 A -> B -> D -> B -> E -> B -> A -> C -> A
  • 20. After deleting duplicate vertices we get, A -> B -> D -> E -> C -> A path. Joining the edges in the above order we obtain the approx. tour route. 20
  • 21. Analysis ➔ Depth first tree tour (DFTT) length is exactly twice the MST’s weight. ➔ MST weight is not more than the length of optimal tour ➔ The tour length is at most twice the optimal length i.e C <= 2 x Copt So, in this case ρ(n) = 2 Cost found by the APPROX-MST-DFS algorithm : C = 15 + 10 + 25 + 25 + 30 = 105 Optimal cost ( Copt ) = Sum of MST weights = 15 + 10 + 25 + 10 = 60 C/Copt <= ρ(n) 105/60 <= 2 1.75 <= 2 21
  • 22. ➔ For companies like FedEx and their competitors traveling salesman problem is used as a reference to solve related /similar problems. ➔ Can be used in network design and routing purposes. ➔ Used in astronomy to determine the fastest way of drilling an aluminium disk placed at the focal point of telescope for each spot of interest to collect the light from the galaxy or star over a given period of time . 22 Application
  • 23. Pros ➔ Deals with NP- Complete problems ➔ Finds solutions which are close to optimal solution in polynomial time ➔ Cost Effective Cons ➔ This technique does not guarantee the best solution ➔ May not be useful in all practical application 23
  • 24. Conclusion To conclude we can say that the goal of an approximation algorithm is to come as close as possible to the optimum value in a reasonable amount of time which is at the most polynomial time. 24