• 沒有找到結果。

A 0.5-Approximation Algorithm for max cut

N/A
N/A
Protected

Share "A 0.5-Approximation Algorithm for max cut"

Copied!
45
0
0

(1)

Back to maxsat

In maxsat, the φi’s are clauses.

Hence p(φi) ≥ 1/2, which happens when φi contains a single literal.

And the heuristic becomes a polynomial-time

²-approximation algorithm with ² = 1/2.a

If the clauses have k distinct literals, p(φi) = 1 − 2−k.

And the heuristic becomes a polynomial-time

²-approximation algorithm with ² = 2−k.

This is the best possible for k ≥ 3 unless P = NP.

aJohnson (1974).

(2)

max cut Revisited

The NP-complete max cut seeks to partition the nodes of graph G = (V, E) into (S, V − S) so that there are as many edges as possible between S and V − S (p. 318).

Local search starts from a feasible solution and

performs “local” improvements until none are possible.

Next we present a local search algorithm for max cut.

(3)

A 0.5-Approximation Algorithm for max cut

1: S := ∅;

2: while ∃v ∈ V whose switching sides results in a larger cut do

3: Switch the side of v;

4: end while

5: return S;

A 0.12-approximation algorithm exists.a

0.059-approximation algorithms do not exist unless NP = ZPP.

aGoemans and Williamson (1995).

(4)

V3 V4

V2 V1

Optimal cut

Our cut

e12

e13

e24

e34 e14 e23

(5)

Analysis (continued)

Partition V = V1 ∪ V2 ∪ V3 ∪ V4, where

Our algorithm returns (V1 ∪ V2, V3 ∪ V4).

The optimum cut is (V1 ∪ V3, V2 ∪ V4).

Let eij be the number of edges between Vi and Vj.

For each node v ∈ V1, its edges to V1 ∪ V2 are outnumbered by those to V3 ∪ V4.

Otherwise, v would have been moved to V3 ∪ V4 to improve the cut.

(6)

Analysis (continued)

Considering all nodes in V1 together, we have 2e11 + e12 ≤ e13 + e14

It is 2e11 is because each edge in V1 is counted twice.

The above inequality implies

e12 ≤ e13 + e14.

(7)

Analysis (concluded)

Similarly,

e12 ≤ e23 + e24 e34 ≤ e23 + e13 e34 ≤ e14 + e24

Add all four inequalities, divide both sides by 2, and add the inequality e14 + e23 ≤ e14 + e23 + e13 + e24 to obtain

e12 + e34 + e14 + e23 ≤ 2(e13 + e14 + e23 + e24).

The above says our solution is at least half the optimum.

(8)

Approximability, Unapproximability, and Between

knapsack, node cover, maxsat, and max cut have approximation thresholds less than 1.

– knapsack has a threshold of 0 (p. 664).

– But node cover and maxsat have a threshold larger than 0.

The situation is maximally pessimistic for tsp: It cannot be approximated unless P = NP (p. 662).

– The approximation threshold of tsp is 1.

The threshold is 1/3 if the tsp satisfies the triangular inequality.

– The same holds for independent set.

(9)

Unapproximability of tsp

a

Theorem 77 The approximation threshold of tsp is 1 unless P = NP.

Suppose there is a polynomial-time ²-approximation algorithm for tsp for some ² < 1.

We shall construct a polynomial-time algorithm for the NP-complete hamiltonian cycle.

Given any graph G = (V, E), construct a tsp with | V | cities with distances

dij =



1, if { i, j } ∈ E

|V |

1−², otherwise

aSahni and Gonzales (1976).

(10)

The Proof (concluded)

Run the alleged approximation algorithm on this tsp.

Suppose a tour of cost |V | is returned.

– This tour must be a Hamiltonian cycle.

Suppose a tour with at least one edge of length 1−²|V | is returned.

The total length of this tour is > 1−²|V | .

Because the algorithm is ²-approximate, the optimum is at least 1 − ² times the returned tour’s length.

The optimum tour has a cost exceeding | V |.

Hence G has no Hamiltonian cycles.

(11)

knapsack Has an Approximation Threshold of Zero

a

Theorem 78 For any ², there is a polynomial-time

²-approximation algorithm for knapsack.

We have n weights w1, w2, . . . , wn ∈ Z+, a weight limit W , and n values v1, v2, . . . , vn ∈ Z+.b

We must find an S ⊆ {1, 2, . . . , n} such that P

i∈S wi ≤ W and P

i∈S vi is the largest possible.

aIbarra and Kim (1975).

bIf the values are fractional, the result is slightly messier but the main conclusion remains correct. Contributed by Mr. Jr-Ben Tian (R92922045) on December 29, 2004.

(12)

The Proof (continued)

Let

V = max{v1, v2, . . . , vn}.

Clearly, P

i∈S vi ≤ nV .

Let 0 ≤ i ≤ n and 0 ≤ v ≤ nV .

W (i, v) is the minimum weight attainable by selecting some of the first i items with a total value of v.

Set W (0, v) = ∞ for v ∈ { 1, 2, . . . , nV } and W (i, 0) = 0 for i = 0, 1, . . . , n.a

aContributed by Mr. Ren-Shuo Liu (D98922016) and Mr. Yen-Wei Wu (D98922013) on December 28, 2009.

(13)

The Proof (continued)

Then, for 0 ≤ i < n,

W (i + 1, v) = min{W (i, v), W (i, v − vi+1) + wi+1}.

Finally, pick the largest v such that W (n, v) ≤ W .

The running time is O(n2V ), not polynomial time.

Key idea: Limit the number of precision bits.

(14)

The Proof (continued)

Define

vi0 = 2b j vi 2b

k .

This is equivalent to zeroing each vi’s last b bits.

From the original instance

x = (w1, . . . , wn, W, v1, . . . , vn), define the approximate instance

x0 = (w1, . . . , wn, W, v10 , . . . , vn0 ).

(15)

The Proof (continued)

Solving x0 takes time O(n2V /2b).

– The algorithm only performs subtractions on the vi-related values.

So the b last bits can be removed from the calculations.

That is, use vi0 = ¥v

2bi

¦ in the calculations.

– Then multiply the returned value by 2b.

The solution S0 is close to the optimum solution S:

X

i∈S0

vi X

i∈S0

vi0 X

i∈S

vi0 X

i∈S

(vi − 2b) ≥ X

i∈S

vi − n2b.

(16)

The Proof (continued)

Hence X

i∈S0

vi X

i∈S

vi − n2b.

Without loss of generality, assume wi ≤ W for all i.

Otherwise, item i is redundant.

V is a lower bound on opt.

Picking an item with value V is a legitimate choice.

The relative error from the optimum is ≤ n2b/V : P

i∈S vi P

i∈S0 vi P

i∈S vi

P

i∈S vi P

i∈S0 vi

V n2b

V .

(17)

The Proof (concluded)

Suppose we pick b = blog2 ²Vn c.

The algorithm becomes ²-approximate (see Eq. (10) on p. 640).

The running time is then O(n2V /2b) = O(n3/²), a polynomial in n and 1/².a

aIt hence depends on the value of 1/². Thanks to a lively class dis- cussion on December 20, 2006. If we fix ² and let the problem size increase, then the complexity is cubic. Contributed by Mr. Ren-Shan Luoh (D97922014) on December 23, 2008.

(18)

Pseudo-Polynomial-Time Algorithms

Consider problems with inputs that consist of a

collection of integer parameters (tsp, knapsack, etc.).

An algorithm for such a problem whose running time is a polynomial of the input length and the value (not length) of the largest integer parameter is a

pseudo-polynomial-time algorithm.a

On p. 666, we presented a pseudo-polynomial-time algorithm for knapsack that runs in time O(n2V ).

How about tsp (d), another NP-complete problem?

aGarey and Johnson (1978).

(19)

No Pseudo-Polynomial-Time Algorithms for tsp (d)

By definition, a pseudo-polynomial-time algorithm becomes polynomial-time if each integer parameter is limited to having a value polynomial in the input length.

Corollary 42 (p. 335) showed that hamiltonian path is reducible to tsp (d) with weights 1 and 2.

As hamiltonian path is NP-complete, tsp (d) cannot have pseudo-polynomial-time algorithms unless P = NP.

tsp (d) is said to be strongly NP-hard.

Many weighted versions of NP-complete problems are strongly NP-hard.

(20)

Polynomial-Time Approximation Scheme

Algorithm M is a polynomial-time approximation scheme (PTAS) for a problem if:

For each ² > 0 and instance x of the problem, M runs in time polynomial (depending on ²) in | x |.

Think of ² as a constant.

M is an ²-approximation algorithm for every ² > 0.

(21)

Fully Polynomial-Time Approximation Scheme

A polynomial-time approximation scheme is fully polynomial (FPTAS) if the running time depends polynomially on | x | and 1/².

– Maybe the best result for a “hard” problem.

– For instance, knapsack is fully polynomial with a running time of O(n3/²) (p. 664).

(22)

Square of G

Let G = (V, E) be an undirected graph.

G2 has nodes {(v1, v2) : v1, v2 ∈ V } and edges

{{ (u, u0), (v, v0) } : (u = v ∧ { u0, v0 } ∈ E) ∨ { u, v } ∈ E}.

1

2

3

(1,1)

G

(1,2) (1,3)

(2,1) (2,2) (2,3)

(3,1) (3,2) (3,3)

G2

(23)

Independent Sets of G and G

2

Lemma 79 G(V, E) has an independent set of size k if and only if G2 has an independent set of size k2.

Suppose G has an independent set I ⊆ V of size k.

{(u, v) : u, v ∈ I} is an independent set of size k2 of G2.

1

2

3

(1,1)

G

(1,2) (1,3)

(2,1) (2,2) (2,3)

(3,1) (3,2) (3,3)

G2

(24)

The Proof (continued)

Suppose G2 has an independent set I2 of size k2.

U ≡ {u : ∃v ∈ V (u, v) ∈ I2} is an independent set of G.

1

2

3

(1,1)

G

(1,2) (1,3)

(2,1) (2,2) (2,3)

(3,1) (3,2) (3,3)

G2

| U | is the number of “rows” that the nodes in I2 occupy.

(25)

The Proof (concluded)

a

If | U | ≥ k, then we are done.

Now assume | U | < k.

As the k2 nodes in I2 cover fewer than k “rows,” there must be a “row” in possession of > k nodes of I2.

Those > k nodes will be independent in G as each “row”

is a copy of G.

aThanks to a lively class discussion on December 29, 2004.

(26)

Approximability of independent set

The approximation threshold of the maximum independent set is either zero or one (it is one!).

Theorem 80 If there is a polynomial-time ²-approximation algorithm for independent set for any 0 < ² < 1, then there is a polynomial-time approximation scheme.

Let G be a graph with a maximum independent set of size k.

Suppose there is an O(ni)-time ²-approximation algorithm for independent set.

We seek a polynomial-time ²0-approximation algorithm with ²0 < ².

(27)

The Proof (continued)

By Lemma 79 (p. 676), the maximum independent set of G2 has size k2.

Apply the algorithm to G2.

The running time is O(n2i).

The resulting independent set has size ≥ (1 − ²) k2.

By the construction in Lemma 79 (p. 676), we can obtain an independent set of size ≥ p

(1 − ²) k2 for G.

Hence there is a (1 −

1 − ²)-approximation algorithm for independent set by Eq. (11) on p. 641.

(28)

The Proof (concluded)

In general, we can apply the algorithm to G2` to obtain an (1 − (1 − ²)2−`)-approximation algorithm for

independent set.

The running time is n2`i.a

Now pick ` = dlog log(1−²log(1−²)0)e.

The running time becomes nilog(1−²0)log(1−²) .

It is an ²0-approximation algorithm for independent set.

aIt is not fully polynomial.

(29)

independent set and node cover are reducible to each other (Corollary 39, p. 312).

node cover has an approximation threshold at most 0.5 (p. 646).

But independent set is unapproximable (see the textbook).

independent set limited to graphs with degree ≤ k is called k-degree independent set.

k-degree independent set is approximable (see the textbook).

(30)

On P vs. NP

(31)

Density

a

The density of language L ⊆ Σ is defined as densL(n) = |{x ∈ L : | x | ≤ n}|.

If L = {0, 1}, then densL(n) = 2n+1 − 1.

So the density function grows at most exponentially.

For a unary language L ⊆ {0},

densL(n) ≤ n + 1.

Because L ⊆ {², 0, 00, . . . ,

z }| {n

00 · · · 0, . . .}.

aBerman and Hartmanis (1977).

(32)

Sparsity

Sparse languages are languages with polynomially bounded density functions.

Dense languages are languages with superpolynomial density functions.

(33)

Self-Reducibility for sat

An algorithm exhibits self-reducibility if it finds a certificate by exploiting algorithms for the decision version of the same problem.

Let φ be a boolean expression in n variables x1, x2, . . . , xn.

t ∈ {0, 1}j is a partial truth assignment for x1, x2, . . . , xj.

φ[ t ] denotes the expression after substituting the truth values of t for x1, x2, . . . , x| t | in φ.

(34)

An Algorithm for sat with Self-Reduction

We call the algorithm below with empty t.

1: if | t | = n then

2: return φ[ t ];

3: else

4: return φ[ t0 ] ∨ φ[ t1 ];

5: end if

The above algorithm runs in exponential time, by visiting all the partial assignments (or nodes on a depth-n binary tree).

(35)

NP-Completeness and Density

a

Theorem 81 If a unary language U ⊆ {0} is NP-complete, then P = NP.

Suppose there is a reduction R from sat to U .

We use R to find a truth assignment that satisfies

boolean expression φ with n variables if it is satisfiable.

Specifically, we use R to prune the exponential-time exhaustive search on p. 687.

The trick is to keep the already discovered results φ[ t ] in a table H.

aBerman (1978).

(36)

1: if | t | = n then

2: return φ[ t ];

3: else

4: if (R(φ[ t ]), v) is in table H then

5: return v;

6: else

7: if φ[ t0 ] = “satisfiable” or φ[ t1 ] = “satisfiable” then

8: Insert (R(φ[ t ]), “satisfiable”) into H;

9: return “satisfiable”;

10: else

11: Insert (R(φ[ t ]), “unsatisfiable”) into H;

12: return “unsatisfiable”;

13: end if

14: end if

15: end if

(37)

The Proof (continued)

Since R is a reduction, R(φ[ t ]) = R(φ[ t0 ]) implies that φ[ t ] and φ[ t0 ] must be both satisfiable or unsatisfiable.

R(φ[ t ]) has polynomial length ≤ p(n) because R runs in log space.

As R maps to unary numbers, there are only polynomially many p(n) values of R(φ[ t ]).

How many nodes of the complete binary tree (of invocations/truth assignments) need to be visited?

If that number is a polynomial, the overall algorithm runs in polynomial time and we are done.

(38)

The Proof (continued)

A search of the table takes time O(p(n)) in the random access memory model.

The running time is O(M p(n)), where M is the total number of invocations of the algorithm.

The invocations of the algorithm form a binary tree of depth at most n.

(39)

The Proof (continued)

There is a set T = {t1, t2, . . .} of invocations (partial truth assignments, i.e.) such that:

1. |T | ≥ (M − 1)/(2n).

2. All invocations in T are recursive (nonleaves).

3. None of the elements of T is a prefix of another.

(40)

(41)

r

a c

d e f

g h i j

l k

1

2 3

4 5

T = { h, j }.

(42)

The Proof (continued)

All invocations t ∈ T have different R(φ[ t ]) values.

None of h, j ∈ T is a prefix of the other.

– The invocation of one started after the invocation of the other had terminated.

– If they had the same value, the one that was invoked second would have looked it up, and therefore would not be recursive, a contradiction.

The existence of T implies that there are at least (M − 1)/(2n) different R(φ[ t ]) values in the table.

(43)

The Proof (concluded)

We already know that there are at most p(n) such values.

Hence (M − 1)/(2n) ≤ p(n).

Thus M ≤ 2np(n) + 1.

The running time is therefore O(M p(n)) = O(np2(n)).

We comment that this theorem holds for any sparse language, not just unary ones.a

aMahaney (1980).

(44)

coNP-Completeness and Density

Theorem 82 (Fortung (1979)) If a unary language U ⊆ {0} is coNP-complete, then P = NP.

Suppose there is a reduction R from sat complement to U .

The rest of the proof is basically identical except that, now, we want to make sure a formula is unsatisfiable.

(45)

Finis

• Consider an algorithm that runs C for time kT (n) and rejects the input if C does not stop within the time bound.. • By Markov’s inequality, this new algorithm runs in time kT (n)

We then use Theorem 1 to show that a graph having neither articulation points nor similar pairs must have an induced subgraph isomorphic to some member of

Here, a deterministic linear time and linear space algorithm is presented for the undirected single source shortest paths problem with positive integer weights.. The algorithm

In particular, we present a linear-time algorithm for the k-tuple total domination problem for graphs in which each block is a clique, a cycle or a complete bipartite graph,

Piecewise polynomial interpolation: divide the interval into a collection of subintervals and construct different approximation on each subinterval. The simplest piecewise

Arbenz et al.[1] proposed a hybrid preconditioner combining a hierarchical basis preconditioner and an algebraic multigrid preconditioner for the correc- tion equation in the

If P6=NP, then for any constant ρ ≥ 1, there is no polynomial-time approximation algorithm with approximation ratio ρ for the general traveling-salesman problem...