SlideShare a Scribd company logo
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

PPT
SINGLE-SOURCE SHORTEST PATHS
DOC
Unit 3 daa
PPT
Prim's Algorithm on minimum spanning tree
PPTX
Presentation of daa on approximation algorithm and vertex cover problem
PPT
Prim Algorithm and kruskal algorithm
PDF
Approximation Algorithms
PPTX
NP completeness
SINGLE-SOURCE SHORTEST PATHS
Unit 3 daa
Prim's Algorithm on minimum spanning tree
Presentation of daa on approximation algorithm and vertex cover problem
Prim Algorithm and kruskal algorithm
Approximation Algorithms
NP completeness

What's hot (20)

PPTX
System protection in Operating System
PPTX
The n Queen Problem
PPTX
Problem reduction AND OR GRAPH & AO* algorithm.ppt
PPTX
Webinar : P, NP, NP-Hard , NP - Complete problems
PDF
Design & Analysis of Algorithms Lecture Notes
PPTX
Genetic algorithm
PPTX
Alpha-beta pruning (Artificial Intelligence)
PPTX
Design and Analysis of Algorithms
PPT
Branch and bound
PPTX
Daa unit 1
PPTX
Lecture 18: Gaussian Mixture Models and Expectation Maximization
PPT
Greedy Algorihm
PDF
I. Hill climbing algorithm II. Steepest hill climbing algorithm
PPTX
Knapsack Problem
PPT
Genetic algorithms
PDF
P, NP, NP-Complete, and NP-Hard
PPTX
What Is Dynamic Programming? | Dynamic Programming Explained | Programming Fo...
PPT
Graph algorithms
PPTX
Genetic Algorithm
PPTX
Daa:Dynamic Programing
System protection in Operating System
The n Queen Problem
Problem reduction AND OR GRAPH & AO* algorithm.ppt
Webinar : P, NP, NP-Hard , NP - Complete problems
Design & Analysis of Algorithms Lecture Notes
Genetic algorithm
Alpha-beta pruning (Artificial Intelligence)
Design and Analysis of Algorithms
Branch and bound
Daa unit 1
Lecture 18: Gaussian Mixture Models and Expectation Maximization
Greedy Algorihm
I. Hill climbing algorithm II. Steepest hill climbing algorithm
Knapsack Problem
Genetic algorithms
P, NP, NP-Complete, and NP-Hard
What Is Dynamic Programming? | Dynamic Programming Explained | Programming Fo...
Graph algorithms
Genetic Algorithm
Daa:Dynamic Programing
Ad

Similar to Approximation algorithms (20)

PPTX
Undecidable Problems and Approximation Algorithms
PDF
Daa chapter11
PPTX
Undecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWER
PPTX
Approximation
PPT
Chap8 new
PPT
Analysis of Algorithm
PPT
Giáo trình Phân tích và thiết kế giải thuật - CHAP 8
PPT
Approx
PPTX
NP-Completeness - II
PPTX
optimal merge pattern notes - algorithms
PPT
Appendix b 2
PDF
Analysis and design of algorithms part 4
PPTX
Unit ii-ppt
PPT
8783733
PPTX
Dynamic Programming in design and analysis .pptx
PPT
Introduction to algorithms and it's different types
PPT
Appendix b 2
DOCX
AD3351 DAA ANSWER KEY question and answer .docx
Undecidable Problems and Approximation Algorithms
Daa chapter11
Undecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWER
Approximation
Chap8 new
Analysis of Algorithm
Giáo trình Phân tích và thiết kế giải thuật - CHAP 8
Approx
NP-Completeness - II
optimal merge pattern notes - algorithms
Appendix b 2
Analysis and design of algorithms part 4
Unit ii-ppt
8783733
Dynamic Programming in design and analysis .pptx
Introduction to algorithms and it's different types
Appendix b 2
AD3351 DAA ANSWER KEY question and answer .docx
Ad

Recently uploaded (20)

PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPTX
web development for engineering and engineering
PPTX
Foundation to blockchain - A guide to Blockchain Tech
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
DOCX
573137875-Attendance-Management-System-original
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPT
Project quality management in manufacturing
PPTX
Current and future trends in Computer Vision.pptx
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPT
Mechanical Engineering MATERIALS Selection
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
web development for engineering and engineering
Foundation to blockchain - A guide to Blockchain Tech
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
573137875-Attendance-Management-System-original
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Embodied AI: Ushering in the Next Era of Intelligent Systems
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
bas. eng. economics group 4 presentation 1.pptx
Project quality management in manufacturing
Current and future trends in Computer Vision.pptx
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
CYBER-CRIMES AND SECURITY A guide to understanding
R24 SURVEYING LAB MANUAL for civil enggi
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
Mechanical Engineering MATERIALS Selection

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