Download presentation
Presentation is loading. Please wait.
1
Approximation Algorithms Lecture for CS 302
2
What is a NP problem? Given an instance of the problem, V, and a ‘certificate’, C, we can verify V is in the language in polynomial time All problems in P are NP problems – Why?
3
VERTEX-COVER Given a graph, G, return the smallest set of vertices such that all edges have an end point in the set
4
HAMILTONIAN PATH Given a graph, G, find a path that visits every vertex exactly once Alt version: Find the path with the minimum weight
5
What is NP-Complete? A problem is NP-Complete if: – It is in NP – Every other NP problem has a polynomial time reduction to this problem NP-Complete problems: – 3-SAT – VERTEX-COVER – CLIQUE – HAMILTONIAN-PATH (HAMPATH)
6
Applications
7
SAT is used to verify circuit design NEED MORE EXAMPLES. WANT PICTURES
8
Dilemma NP problems need solutions in real-life We only know exponential algorithms What do we do?
9
Accuracy NP problems are often optimization problems It’s hard to find the EXACT answer Maybe we just want to know our answer is close to the exact answer?
10
Approximation Algorithms Can be created for optimization problems The exact answer for an instance is OPT The approximate answer will never be far from OPT We CANNOT approximate decision problems
11
k-approximation S is the approx. answer, OPT is optimal Maximization – k*OPT ≤ S ≤ OPT Minimization – OPT ≤ S ≤ k*OPT
12
Approximate Vertex-Cover Let S be the cover Pick an edge (u,v) in the graph Add it’s end-points u and v to S Remove any edge that neighbors u or v Repeat until there are no edges left
13
Approximate Vertex-Cover OPT must cover every edge so either u or v must be in the cover => OPT > ½|S| => 2*OPT ≥ |S| We have a 2-approximation
14
Traveling Salesperson Problem Given a graph, find a minimum weight hamiltonian path There is a 2-approximation based on MINIMUM SPANNING TREES
15
Minimum Spanning Tree Given a graph, G, a Spanning Tree of G is a subgraph with no cycles that connects every vertex together A MST is a Spanning Tree with minimal weight
16
Finding a MST Finding a MST can be done in polynomial time using PRIM’S ALGORITHM or KRUSKAL’S ALGORITHM Both are greedy algorithms Details can be found on Wikipedia
17
MST vs HAMPATH Any HAMPATH becomes a Spanning Tree by removing an edge cost(MST) ≤ cost(min-HAMPATH)
18
Approximate TSP Given a complete graph G Compute G’s MST, M The tour is the pre-order traversal of M This is a 2-approximation
19
Approximating 3-SAT f is a Boolean formula in 3-CNF form if: What’s the optimization version of 3-SAT? Satisfy as many clauses as you can
20
Approximating 3-SAT Algorithm: – For each variable x i assign True with probability ½, False with probability ½ – This satisfies 7/8ths of the clauses in expectation
21
Approximating 3-SAT x1x1 x2x2 x3x3 TTTT TTTF TTFT TTFF TFTT TFTF TFFT FFFF The only way we don’t satisfy the clause is if we select the last assignment. This happens only 1/8 th of the time.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.