75
Introduction to Algorithms NP-Completeness and Approximation Algorithms

Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 [email protected] Why Approximation Algorithms ... solutions in polynomial

  • Upload
    vucong

  • View
    309

  • Download
    8

Embed Size (px)

Citation preview

Page 1: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

Introduction to Algorithms

NP-Completeness and Approximation

Algorithms

Page 2: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

2

Why Approximation Algorithms

Problems that we cannot find an optimal

solution in a polynomial time

Eg: Set Cover, Bin Packing

Need to find a near-optimal solution:

Heuristic

Approximation algorithms:

This gives us a guarantee approximation ratio

Page 3: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

3

Why important

Your advisers/bosses give you a

computationally hard problem. Here are two

scenarios:

No knowledge about approximation:

Spend a few months looking for an optimal solution

Come to their office and confess that you cannot do it

Get fired

Knowledge about approximation:

Page 4: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

4

Knowledge about approximation

Show your boss that this is a NP-complete (NP-

hard) problem

There does not exist any polynomial time algorithm

to find an exact solution

Propose a good algorithm (either heuristic or

approximation) to find a near-optimal solution

Better yet, prove the approximation ratio

Page 5: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

5

Techniques

A variety of techniques to design and analyze

many approximation algorithms for

computationally hard problems:

Combinatorial algorithms:

Greedy Techniques, Independent System, Submodular

Function

Linear Programming based algorithms

Semidefinite Programming based algorithms

In this class, we just introduce a few examples

Page 6: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

6

Combinatorial Optimization

The study of finding the “best” object from

within some finite space of objects, eg:

Shortest path: Given a graph with edge costs and a

pair of nodes, find the shortest path (least costs)

between them

Traveling salesman: Given a complete graph with

nonnegative edge costs, find a minimum cost cycle

visiting every vertex exactly once

Maximum Network Lifetime: Given a wireless

sensor networks and a set of targets, find a schedule

of these sensors to maximize network lifetime

Page 7: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

7

In P or not in P?

Informal Definitions:

The class P consists of those problems that are

solvable in polynomial time, i.e. O(nk) for some

constant k where n is the size of the input.

The class NP consists of those problems that

are “verifiable” in polynomial time:

Given a certificate of a solution, then we can verify

that the certificate is correct in polynomial time

Page 8: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

8

In P or not in P: Examples

In P:

Shortest path

Minimum Spanning Tree

Not in P (NP):

Vertex Cover

Traveling salesman

Minimum Connected Dominating Set

Page 9: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

9

NP-completeness (NPC)

A problem is in the class NPC if it is in NP and

is as “hard” as any problem in NP

Page 10: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

10

What is “hard”

Decision Problems: Only consider YES-NO

Decision version of TSP: Given n cities, is there a

TSP tour of length at most L?

Why Decision Problem? What relation between

the optimization problem and its decision?

Decision is not “harder” than that of its

optimization problem

If the decision is “hard”, then the optimization

problem should be “hard”

Page 11: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

11

NP-complete and NP-hard

A language L is NP-complete if:

1. L is in NP, and

2. For every L’ in NP, L’ can be polynomial-time

reducible to L

Page 12: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

12

Approximation Algorithms

An algorithm that returns near-optimal

solutions in polynomial time

Approximation Ratio ρ(n):

Define: C* as a optimal solution and C is the

solution produced by the approximation algorithm

max (C/C*, C*/C) <= ρ(n)

Maximization problem: 0 < C <= C*, thus C*/C

shows that C* is larger than C by ρ(n)

Minimization problem: 0 < C* <= C, thus C/C*

shows that C is larger than C* by ρ(n)

Page 13: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

13

Approximation Algorithms (cont)

PTAS (Polynomial Time Approximation

Scheme): A (1 + ε)-approximation algorithm

for a NP-hard optimization П where its running

time is bounded by a polynomial in the size of

instance I

FPTAS (Fully PTAS): The same as above +

time is bounded by a polynomial in both the

size of instance I and 1/ε

Page 14: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

14

A Dilemma!

We cannot find C*, how can we compare C to

C*?

How can we design an algorithm so that we can

compare C to C*

It is the objective of this course!!!

Page 15: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

15

Vertex Cover

Definition:

An Example

'at incident endpoint one

leastat has , edgeevery for iff ofcover vertex a

called is 'subset a ,),(graph undirectedan Given

V

eEeG

VVEVG

Page 16: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

16

Vertex Cover Problem

Definition:

Given an undirected graph G=(V,E), find a vertex

cover with minimum size (has the least number of

vertices)

This is sometimes called cardinality vertex cover

More generalization:

Given an undirected graph G=(V,E), and a cost

function on vertices c: V → Q+

Find a minimum cost vertex cover

Page 17: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

17

How to solve it

Matching:

A set M of edges in a graph G is called a matching

of G if no two edges in set M have an endpoint in

common

Example:

Page 18: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

18

How to solve it (cont)

Maximum Matching:

A matching of G with the greatest number of edges

Maximal Matching:

A matching which is not contained in any larger

matching

Note: Any maximum matching is certainly

maximal, but not the reverse

Page 19: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

19

Main Observation

No vertex can cover two edges of a matching

The size of every vertex cover is at least the

size of every matching: |M| ≤ |C|

|M| = |C| indicates the optimality

Possible Solution: Using Maximal matching to

find Minimum vertex cover

Page 20: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

20

An Algorithm

Alg 1: Find a maximal matching in G and output the

set of matched vertices

Theorem: The algorithm 1 is a factor 2-approximation

algorithm.

Proof:

optC

MCoptM

Copt

2|| Therefore,

||2|| and ||

:have We1. algorithm from obtainedcover vertex

ofset a be Let solution. optimalan of size a be Let

Page 21: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

21

Can Alg1 be improved?

Q1: Can the approximation ratio of Alg 1 be

improved by a better analysis?

Q2: Can we design a better approximation

algorithm using the similar technique (maximal

matching)?

Q3: Is there any other lower bounding method

that can lead to a better approximation

algorithm?

Page 22: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

22

Answers

A1: No by considering the complete bipartite

graphs Kn,n

A2: No by considering the complete graph Kn

where n is odd.

|M| = (n-1)/2 whereas opt = n -1

Page 23: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

23

Answers (cont)

A3:

Currently a central open problem

Yes, we can obtain a better one by using the

semidefinite programming

Generalization vertex Cover

Can we still able to design a 2-approximation

algorithm?

Homework Excersice

Page 24: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

24

Set Cover

Definition: Given a universe U of n elements, a collection of subsets of U, S = {S1, …, Sm}, and a cost function c: S → Q+, find a minimum cost subcollection C of S that covers all elements of U.

Example:

U = {1, 2, 3, 4, 5}

S1 = {1, 2, 3}, S2 = {2,3}, S3 = {4, 5}, S4 = {1, 2, 4}

c1 = c2 = c3 = c4 = 1

Solution C = {S1, S3}

If the cost is uniform, then the set cover problem asks us to find a subcollection covering all elements of U with the minimum size.

Page 25: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

25

An Example

Page 26: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

26

INSTANCE: Given a universe U of n elements, a collection of subsets of U, S = {S1, …, Sm}, and a positive integer b

QUESTION: Is there a , |C| ≤ b, such that

(Note: The subcollection {Si | } satisfying the above condition is called a set cover of U

NP-completeness

Theorem: Set Cover (SC) is NP-complete

Proof:

Page 27: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

27

Proof (cont)

First we need to show that SC is in NP. Given a collection of sets C, it is easy to verify that if |C| ≤ b and the union of all sets listed in C does include all elements in U.

To complete the proof, we need to show that Vertex Cover (VC) ≤p Set Cover (SC)

Given an instance C of VC (an undirected graph G=(V,E) and a positive integer j), we need to construct an instance C’ of SC in polynomial time such that C is satisfiable iff C’ is satisfiable.

Page 28: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

28

Proof (cont)

Construction: Let U = E. We will define n elements of U and a collection S as follows:

Note: Each edge corresponds to each element in U and each vertex corresponds to each set in S.

Label all vertices in V from 1 to n. Let Si be the set of all edges that incident to vertex i. Finally, let b = j. This construction is in poly-time with respect to the size of VC instance.

Page 29: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

29

VERTEX-COVER p SET-COVER

one set for every vertex, containing the edges it covers

VC

one element for every edge

VC SC

Page 30: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

30

Proof (cont)

Now, we need to prove that C is satisfiable iff C’ is.

That is, we need to show that if the original instance

of VC is a yes instance iff the constructed instance of

SC is a yes instance.

(→) Suppose G has a vertex cover of size at most j, called

C. By our construction, C corresponds to a collection C’ of

subsets of U. Since b = j, |C’| ≤ b. Plus, C’ covers all

elements in U since C “covers” all edges in G. To see this,

consider any element of U. Such an element is an edge in

G. Since C is a vertex cover, at least endpoint of this edge is

in C.

Page 31: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

31

(←) Suppose there is a set cover C’ of size at most b in our constructed instance. Since each set in C’ is associated with a vertex in G, let C be the set of these vertices. Then |C| = |C’| ≤ b = j. Plus, C is a vertex cover of G since C’ is a set cover. To see this, consider any edge e. Since e is in U, C’ must contain at least one set that includes e. By our construction, the only set that include e correspond to nodes that are endpoints of e. Thus C must contain at least one endpoints of e.

Page 32: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

32

Solutions

Algorithm 1: (in the case of uniform cost)

1: C = empty

2: while U is not empty

3: pick a set Si such that Si covers the most

elements in U

4: remove the new covered elements from U

5: C = C union Si

6: return C

Page 33: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

33

Solutions (cont)

In the case of non-uniform cost

Similar method. At each iteration, instead of picking a

set Si such that Si covers the most uncovered elements,

we will pick a set Si whose cost-effectiveness α is

smallest, where α is defined as:

Questions: Why choose smallest α? Why define α as

above

||/)( USSc ii

Page 34: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

34

Solutions (cont)

Algorithm 2: (in the case of non-uniform cost)

1: C = empty

2: while U is not empty

3: pick a set Si such that Si has the smallest α

4: for each new covered elements e in U

5: set price(e) = α

6: remove the new covered elements from U

7: C = C union Si

8: return C

Page 35: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

35

Approximation Ratio Analysis

Let ek, k = 1…n, be the elements of U in the order in which

they were covered by Alg 2. We have:

Lemma 1:

Proof: Let Uj be the set the remaining set U at iteration j.

That is, Uj contains all the uncovered elements at

iteration j. At any iteration j, the leftover sets of the

optimal solution can cover the remaining elements at a

cost of at most opt. (Why?)

solution optimal theofcost theis where

)1/()(price },,...,1{each For

opt

knoptenk k

Page 36: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

36

Proof of Lemma 1 (cont)

Thus, among these leftover sets, there must exist

one set where its α value is at most opt/|Uj|. Let

ek be the element covered at this iteration, |Uj| ≥

n – k + 1. Since ek was covered by the most

cost-effective set in this iteration, we have:

price(ek) ≤ opt/|Uj| ≤ opt/(n-k+1)

Page 37: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

37

Approximation Ratio

Theorem 1: The set cover obtained form Alg 2

(also Alg 1) has a factor of Hn where Hn is a

harmonic series Hn = 1 + 1/2 + … + 1/n

Proof: It follows directly from Lemma 1

Page 38: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

Examples of NP-complete problems

Independent set

- independent set: a set of vertices in the graph with no

edges between each pair of nodes.

- given a graph G=(V,E), find the largest independent set

- reduction from vertex cover:

smallest vertex cover S largest independent set V/S

Page 39: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

Independent Set

Independent set

- if G has a vertex cover S, then V \ S is an independent set

proof: consider two nodes in V \ S:

if there is an edge connecting them, then one of them must be in

S, which means one of them is not in V \ S

- if G has an independent set I, then V \ I is a vertex cover

proof: consider one edge in G:

if it is not covered by any node in V \ I, then its two end vertices

must be both in I, which means I is not an independent set

Page 40: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

Steiner Tree

Steiner tree

- given a graph G=(V,E), and a subset C of V

- find the minimum tree to connect each vertex in C

- reduction

Vertex cover for Graph G Steiner tree for graph G’

vertex

(u,v)

edge

(u,v)-u

edge

(u,v)-v

G’ (only edges with distance 1 are shown)

G

Page 41: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

Steiner Tree

Construction

- G’ is a complete graph

- for every node u in G, create a node u in G’

- for every edge (u,v) in G, create a node (u,v) in G’

- in G’, every node (u,v) is connected to u and v with distance 1

- in G’, every node u and v is connected with distance 1

- other edges in G’ are of distance 2 vertex

(u,v)

edge

(u,v)-u

edge

(u,v)-v

G’ (only edges with distance 1 are shown)

G

Page 42: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

Sketch of Proof:

- in the Steiner tree problem for G’, choose C to be the set of all

nodes (u,v)

- G’ has a minimum Steiner tree of cost m+k-1 iff G has a minimum

vertex cover of size k

vertex

(u,v)

edge

(u,v)-u

edge

(u,v)-v

G’ (only edges with distance 1 are shown)

G

Page 43: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

Summary of some NPc problems

SAT

3SAT

Vertex cover

Independent set

Set cover

Graph coloring

Maximum clique size

Minimum Steiner tree

Hamiltonian cycle

Maximum cut

find more NP-complete problems in http://en.wikipedia.org/wiki/List_of_NP-complete_problems

Page 44: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

Approximation Algorithms

Bin Packing

Page 45: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

45

Definition

Page 46: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

46

Theorem

Page 47: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

47

An Easy Solution: First Fit

Page 48: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

48

Asymptotic PTAS

Page 49: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

49

Page 50: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

50

Page 51: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

Approximation Algorithms

k-Center

Page 52: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

52

Definition

Page 53: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

53

2-Approx

Page 54: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

54

Page 55: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

55

Page 56: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

56

Analysis

Page 57: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

57

Obtain Better Ratio?

Page 58: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

58

Weighted k-Center

Page 59: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

59

Notations

Page 60: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

60

Algorithm

Page 61: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

61

Algorithm 2

Page 62: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

62

Analysis

Theorem: Alg 2 has an approx ratio of 3.

Page 63: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

Approximation Algorithms

Multiway Cut and k-Cut

My T. Thai

[email protected]

63

Page 64: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

Definition

My T. Thai

[email protected]

64

Page 65: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

Example

My T. Thai

[email protected]

65

Page 66: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

66

Can you prove it???

Page 67: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

Approximation

My T. Thai

[email protected]

67

Page 68: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

Analysis

My T. Thai

[email protected]

68

Page 69: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

Minimum k-cut Problem

My T. Thai

[email protected]

69

Page 70: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

Example

My T. Thai

[email protected]

70

Page 71: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

Construct a Gomory-Hu Tree

My T. Thai

[email protected]

71

Page 72: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

My T. Thai

[email protected]

72

Page 73: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

Properties of Gomory-Hu Tree wrt

k-cut

My T. Thai

[email protected]

73

Page 74: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

Approximation Algorithm

My T. Thai

[email protected]

74

Page 75: Introduction to Algorithms - University of Florida · Introduction to Algorithms ... Algorithms . My T. Thai 2 mythai@cise.ufl.edu Why Approximation Algorithms ... solutions in polynomial

Analysis

My T. Thai

[email protected]

75