Upload
wan
View
32
Download
0
Tags:
Embed Size (px)
DESCRIPTION
Approximation Problems. Network Party. VERTEX-COVER. Optimization. Approximation. VC - Approximation Algorithm. COR(B) 523-524. Mass Mailing. SET-COVER. SET-COVER NP-Hard. SC. VC. COR(B) 530-533. The Greedy Algorithm. How to prove an Approximation Ratio?. l g 2 n. l n n. - PowerPoint PPT Presentation
Citation preview
Approximation Problems
Goal:
• Discuss Optimization• Introduce Approximation• Problems/Algorithms
Plan:
• VERTEX-COVER, SET-COVER
• Greedy Algorithm• TSP
2
3
Network PartyP
lan
a
Part
ywith a set of invitees.Every pair of friends must have at least one invite!
Fin
d smallest subset of guests so as to cover all friendships.Can
you find
such a set?
• If (u,v)E, uC or vC
CV is a cover of G=(V, E)
• An undirected G=(V,E)
Instance:
• find a minimal cover C
Minimization Problem:
• An undirected G=(V,E), k
Instance:
• Is there a cover C, |C|=k?
Decision Problem:
VERTEX-COVER
• Min-V.C. is NP-hard
Theorem:
• For a cover C, V\C is an independent-set
Proof:
4
What to do if NP-
hard
• Best solution according to optimization parameter
Algorithm returns
Optimization
5
problem
CLIQUE
3SAT
V.C.
min/max
max
max
min
instance
graph
3CNF
graph
parameter
|clique|
#clause
|cover|
6
• An -approximation algorithm for a maximization/minimization problem with an optimum solution O, returns a solution that is O/O
Definition:
• and O may depend onthe size of the input
Note
Approximation
• |C| 2optimal
Theorem:
Proof:
• C 1• begin while C not a
cover2• Pick (u,v)E s.t. u,vC3• C C {u,v}4• end while5• return C7
7
VC - Approximation AlgorithmCOR(B) 523-524
note
algorithm runs in poly-time
note
C is a V.C.
Edges algorithm picks:
Have no common vertexes
Optimal V.C. must contain 1 end of
each
8
You’d like to send some message to a large list of recipients (e.g. all campus)
Some mailing-lists are available, however, each list charges $1 for each message sent
You’d like to find the smallest set of lists that covers all recipients
Mass Mailing
9
• a finite set U and a family F of subsets of U, which covers U
Instance:
• find a smallest family CF that covers U
Minimization Problem:
SET-COVER
V.C.L
SET-COVER
SET-COVER NP-Hard
VCSC
• 1 element for each edgeU
• 1 set for each vertex, comprising adjacent edges
F10
Theorem:• SET-COVER is NP-Hard
Proof:
11
The Greedy Algorithm• C , U’ U1
• begin while U’ 2
• Pick SF that maximizes |SU’|3
• C C {S}4
• U’ U’ – S5
• end while6
• return C7
COR(B) 530-533
note
algorithm runs in poly-time
note
C is a S.C.
12
Just:
• Described the greedy algorithm for SET-COVER
Next:
• Analyze its approximation ratio in 3 distinct ways: lg2 n, ln n, even better
• compare the size of the cover returned by the greedy algorithm to optimal
Need to:
• The optimal is unknown
However
• k-cover any part of the universe has a k-cover!
Observation:
• Each step of the greedy algorithm removes 1/k of the remaining elements
Corollary:
13
How to prove an Approximation Ratio?
• After k(=size of optimal S.C.) stages the algorithm covers at least ½ of U
Observe:
• By way of contradiction, assume <½ are coveredThe uncovered part of U intersects with a set in F in >n/2k elementsHence, all previous k stages have covered >n/2k elementsAnd must have covered >kn/2k=n/2
Proof:
14
lg2 n
It can be covered by k sets
ln n• S1, …, St be the sequence of sets
picked by the algorithm Let
• Ui be the set of elements not yet covered after i stages
Let
• |Ui+1|=|Ui-Si+1||Ui|(1-1/k)Note
• |Uik||Uo|(1-1/k)ik|U|e-iHence
• t ≤ k ln(n) + 1and
15
Ui can be covered by k sets
16
• Greedy algorithm approximates the optimal set-cover to within a factor H(max{ |S|: SF } )
Lemma:
• Split the “cost of $1”, for set Si picked ith by the greedy algorithm, among newly covered
• Now, bound the sum paid, over any SF, by H(|S|)
• “Imagine” the optimal solution, and bound the total paid
Proof:
Best Ratio-Bound
1lnn1dxx
11
k
1
k
1)(
n
1
n
2k
n
1k
nH
• Each segment of the tour problem now has a cost• find a least-costly tour
Generalized Tour Problem
17
$2
$5
$4
$3$1
$4
$6
$5
$2
Approximate the optimal tour?
i.e. – find a tour that
costs, say, no more
than twice as much as
the least costly.
Next:
• NP-hard optimization problems• Approximation to within a certain
factor• NP-hard or in P?
Plan:
• Traveling Salesman Problem (TSP)• TSP is NP-hard• Approximation algorithm for special
cases• Inapproximability result
18
• A complete weighted undirected G=(V,E) (non-negative weights)
Instance:
• find a Hamiltonian cycle (traversal) of minimal cost
Minimization Problem:
• TSP is NP-hard
Theorem:
19
Traveling Salesperson Problem
2
1
34
3
4
L
By a simple reduction from Ham. cyc.
Next: show a 2-Approximation algorithm for TSP, in case the cost function
satisfies the triangle inequality
u,v,wV: c(u,v)+c(v,w)c(u,w)
viaMin
SpanningTree
20
• Find a Minimum Spanning Tree (MST) T for G1
• Traverse along DFS of T --- jump over visited2
21
Approximation AlgorithmCOR(B) 525-527
• MST weight Cheapest Traversal
Observation
• Algorithm’s traversal costs 2 weight MST
Observation
Next:
• Show it is NP-hard to approximate TSP –the general case– to within any factor h1
How?
• Introduce its gap version• Show it is NP-hard
22
• a complete weighted undirected graph G=(V,E)
Instance:
• distinguish between the following cases:
GAP Problem: [|V|, h|V|]
• Hamiltonian cycle of cost < |V|
Yes
• The cost of Hamiltonian cycle > h|V|
No
23
gap-TSP
• a complete weighted undirected graph G=(V,E)
Instance:
• distinguish between the following cases:
GAP Problem: [|V|, h|V|]
• Hamiltonian cycle of cost < |V|
Yes
• The cost of Hamiltonian cycle > h|V|
No
24
gap-TSP
• Depending on the least costly traversal
Algorithm returns
Yes if
<|V|
No if
>h|V|
GAP
gap-TSP
• Whatever
GAP
• Efficient h-approximation for TSP resolves gap-TSP[C, hC]
Observation:
25
• For any h1, HAM-CYCLE L gap-TSP[|V|, h|V|]
Theorem:
Proof:
• Approximating TSP to within any factor is NP-hard
Corollary:
26
gap-TSP is NP-hard
L
Some NP-hard optimization problems can be efficiently approximated:• VERTEX-COVER (2)• SET-COVER (ln n)• TSP[triangle ineq.] (2)
For some factors it may still be NP-hardWe’ve introduced GAP problems for that purpose
27
Synopsis
WWindex
28
Optimization Vertex Cover
Greedy Algorithm
Spanning Tree
Set Cover
Minimum Spanning Tree
Independent Set
P NP-Hard
Hamiltonian Cycle
TSP
Clique
3SAT