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)

PPT
EULER AND FERMAT THEOREM
PDF
Little o and little omega
PPTX
Recognition-of-tokens
PPTX
Linear regression with gradient descent
PPTX
Single source Shortest path algorithm with example
PDF
State Space Representation and Search
PPTX
sum of subset problem using Backtracking
PPTX
Public Key Cryptography
PPT
Diffiehellman
PPTX
Semantic nets in artificial intelligence
PDF
Syntax directed translation
PPT
Elliptical curve cryptography
PPTX
Elgamal &amp; schnorr digital signature scheme copy
PPTX
Shortest path algorithm
PPTX
Knowledge Representation, Inference and Reasoning
PDF
I. AO* SEARCH ALGORITHM
PPT
Branch and bound
PPT
Conceptual dependency
PPTX
Artificial Intelligence Notes Unit 4
EULER AND FERMAT THEOREM
Little o and little omega
Recognition-of-tokens
Linear regression with gradient descent
Single source Shortest path algorithm with example
State Space Representation and Search
sum of subset problem using Backtracking
Public Key Cryptography
Diffiehellman
Semantic nets in artificial intelligence
Syntax directed translation
Elliptical curve cryptography
Elgamal &amp; schnorr digital signature scheme copy
Shortest path algorithm
Knowledge Representation, Inference and Reasoning
I. AO* SEARCH ALGORITHM
Branch and bound
Conceptual dependency
Artificial Intelligence Notes Unit 4
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)

PPT
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPTX
Internet of Things (IOT) - A guide to understanding
PDF
PPT on Performance Review to get promotions
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
Current and future trends in Computer Vision.pptx
DOCX
573137875-Attendance-Management-System-original
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PDF
Digital Logic Computer Design lecture notes
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPTX
OOP with Java - Java Introduction (Basics)
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPT
Project quality management in manufacturing
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
Internet of Things (IOT) - A guide to understanding
PPT on Performance Review to get promotions
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Current and future trends in Computer Vision.pptx
573137875-Attendance-Management-System-original
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
Digital Logic Computer Design lecture notes
Model Code of Practice - Construction Work - 21102022 .pdf
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
OOP with Java - Java Introduction (Basics)
bas. eng. economics group 4 presentation 1.pptx
Project quality management in manufacturing
UNIT-1 - COAL BASED THERMAL POWER PLANTS
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx

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