Lecture 16 Approximation algorithms

Download Report

Transcript Lecture 16 Approximation algorithms

Lecture 15 Approximation algorithms
•
Approximation algorithms
•
Hardness result: Traveling sales man problem
•
Easiness result: Subset Sum problem
Optimization problem
Optimization Problems are a type of problems of finding
the optimum solution.
Knapsack
Minimum spanning tree
Change making
Min Vertex cover
Max-Clique
Traveling-Sales-Person
Approximation algorithm
An approximation algorithm for an optimization
problem π is a (polynomial time) algorithm such that
given an instance I, it outputs some solution.
Approximation ratio
|A(I) - OPT(I)|
or
A(I) / OPT(I)
Reason1.
Planar graph coloring problem
|A(I) - OPT(I)| < 4
Reason2.
Knapsack problem
for any k. there DOES NOT exist A, s.t.
|A(I) - OPT(I)| <= k
Where are we?
• Approximation algorithms:
‣ Vertex cover problem
‣ Knapsack problem
‣ Euclidean TSP problem
• Hardness result: Traveling Sales Person
problem
• Easiness result: Subset Sum problem
Vertex cover problem
None is correct.
Which one has the best
approx. ratio?
Algorithm1: Pick up a node v --> delete v
and all edges incident to v.
Algortihm2: Pick up an edge e(u,v) -->
add u, v to the cover --> delete all edeges
incident to u,v.
Algorithm3(Greedy): Pick up a node v
with max degree --> delete v and all edges
incident to v.
R1 = ∞
R2 <= 2
R3 >= ln n
VC - Greedy
R >= ln n
Greedy for Knapsack
Algorithm1: Repeatedly choose the item
R1 = ∞
with the largest value/size ratio.
What about U={u1,u2}, v1=2, s1=1; v2=s2=C>2?
Algorithm2: Repeatedly choose the item
with the largest value/size ratio. Then
compare the total value with the item with
maximum value.
R2 <= 2
Greedy for Knapsack
∀I, OPT(I)/A(I) ≤ 2
maximum value
Euclidean TSP problem
TSP with the triangle inequality: ab + ad >= bd
A simple approximation
APP-ETSP-MST
A simple approximation
APP-ETSP-MST
Theorem. R < 2.
2OPT(I) > 2MST(I) > A(I)
An improved heuristic
Theorem R < 3/2.
OPT(I) > MST(I)
OPT(I) > 2Matching(I)
MST(I) + Matching(I) > A(I)
Roadmap
• Approximation algorithms:
‣ Vertex cover problem
‣ Knapsack problem
‣ Euclidean traveling sales man problem
• Hardness result: Traveling sales man problem
• Easiness result: Subset Sum problem
Traveling sales person
problem
Theorem
There is no approximation algorithm A for the problem
Traveling Sales person with RA < ∞ unless NP = P.
Hamiltonian cycle => Approximation TSP with R<k
1
1
kn
1
kn
kn 1
1
1
Roadmap
• Approximation algorithms:
‣ Vertex cover problem
‣ Knapsack problem
‣ Euclidean traveling sales man problem
• Hardness result: Traveling sales man
problem
• Easiness result: Subset Sum problem
Subset sum
Problem: SubsetSum
Input: A set of numbers A={a1,a2,...,an}, and a sum s
Output: Yes, if there exists a subset B⊆A such that the
sum of B equals to s; No, otherwise.
Problem: SubsetSumOpt
Input: A set of numbers A={a1,a2,...,an}, and a sum s
Output: a subset of the items that maximizes the total
sum of their sizes without exceeding the sum s.
APP_SUBSETSUM
We construct a new instance I’ and apply the subset-sum
algorithm to it:
Time complexity: O(nC/K) = O(kn2)
S={104,102,201,101}, C=308, k=5/2
S={109,109,208,109}, C=308, k=5/2
FPTAS for Subset sum
Theorem
Let ε = 1/k for some k ≥ 1. Then the running time of
APP_SUBSETSUM is O(kn2), and its performance ratio is
1 + ε.
Conclusion
• Approximation algorithms are polynomial
algorithms.
• The trade-off between precision and time
• Hardness result: Traveling sales man
problem
• Easiness result: Subset Sum problem