Docsity

Approximating MAX-SAT and Generating Irreducible Polynomials, Assignments of Computer Science

Toggle sidebar
bg1
CS 6505: Algorithms, Computability and
Complexity
Problem Set 4 Solutions
Problem 1: 2-Approximating MAX-SAT
In the MAX-SAT problem, one is give a Boolean formula Φ in the conjunctive
normal form (CNF), and wants to find an assignment that satisfies the
maximum number of clauses in Φ. Give a simple, linear-time deterministic
algorithm that 2-approximates MAX-SAT.
Solution: Let Φ be any Boolean formula in the conjunctive normal form.
Let Abe an arbitrary assignment of {0,1}to the variables of Φ, and let A
be the negation of A, that is, for each variable x,A(x) = ¬A(x). Note that
Asatisfies at least all the clauses that are not satisfied by A. Therefore, at
least one of Aor Amust satisfy at least 1/2 of the clauses of Φ, which is
clearly at least 1/2 of the maximum number of clauses that are simultane-
ously satisfiable. This yields the following linear-time algorithm that that
2-approximates MAX-SAT:
Algorithm: On input Φ,
1. Let Abe the assignment that assigns 1 to each variable.
2. Evaluate each clause of Φ under the assignment A.
3. If Asatisfies at least 1/2 of the clauses of Φ, then output A;
else output A.
Problem 2: On Approximating MAX-CLIQUE
1. Give a simple, polynomial-time algorithm that n
log n-approximates MAX-CLIQUE.
Solution: Let G= (V, E ) be any given graph. Arbitrarily partition
the set Vof vertices into ℓ=n
log2ndisjoint subsets V1,...,Vℓof log2n
vertices each. Let Cbe a maximum clique in Gand let K=|C|. By
the pigeonhole principle, for some ithe set Vimust contain at least
1
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download Approximating MAX-SAT and Generating Irreducible Polynomials and more Assignments Computer Science in PDF only on Docsity!

CS 6505: Algorithms, Computability and

Complexity

Problem Set 4 Solutions

Problem 1: 2-Approximating MAX-SAT

In the MAX-SAT problem, one is give a Boolean formula Φ in the conjunctive normal form (CNF), and wants to find an assignment that satisfies the maximum number of clauses in Φ. Give a simple, linear-time deterministic algorithm that 2-approximates MAX-SAT.

Solution: Let Φ be any Boolean formula in the conjunctive normal form. Let A be an arbitrary assignment of { 0 , 1 } to the variables of Φ, and let A be the negation of A, that is, for each variable x, A(x) = ¬A(x). Note that A satisfies at least all the clauses that are not satisfied by A. Therefore, at least one of A or A must satisfy at least 1/2 of the clauses of Φ, which is clearly at least 1/2 of the maximum number of clauses that are simultane- ously satisfiable. This yields the following linear-time algorithm that that 2-approximates MAX-SAT:

Algorithm: On input Φ,

  1. Let A be the assignment that assigns 1 to each variable.
  2. Evaluate each clause of Φ under the assignment A.
  3. If A satisfies at least 1/2 of the clauses of Φ, then output A; else output A.



Problem 2: On Approximating MAX-CLIQUE

  1. Give a simple, polynomial-time algorithm that (^) logn n -approximates MAX-CLIQUE. Solution: Let G = (V, E) be any given graph. Arbitrarily partition the set V of vertices into ℓ = (^) logn 2 n disjoint subsets V 1 ,... , Vℓ of log 2 n vertices each. Let C be a maximum clique in G and let K = |C|. By the pigeonhole principle, for some i the set Vi must contain at least

K/ℓ vertices in C. This yields the following algorithm that (^) logn 2 n - approximates MAX-CLIQUE.

Algorithm: On input G = (V, E),

(a) Arbitrarily partition V into ℓ = (^) logn 2 n disjoint subsets V 1 ,... , Vℓ of log 2 n vertices each. (b) For each i, by exhaustive search, find a maximum clique Ci of the subgraph Gi induced by Vi. (c) Output the largest Ci found in the previous phase.

By the above analysis, this algorithm outputs a clique whose size is at least log n^2 ntimes the maximum clique size, thus (^) logn 2 n -approximates MAX-CLIQUE. It remains to show that the algorithm takes polynomial- time. Clearly Phase 1 and Phase 3 of the algorithm take linear time. For each i, since |Vi| = log 2 n, Vi has 2log^2 n^ = n subsets. Thus exhaus- tive search is feasible and Phase 2 takes polynomial time. 

  1. In class a reduction from CLIQUE to VERTEX-COVER was given. Also given was a polynomial-time algorithm that 2-approximates MIN-VERTEX-COVER. Do these results imply that there is a polynomial-time algorithm that α-approximates MAX-CLIQUE for some constant α > 1? Justify your answer. Answer: No. Let G = (V, E). Let A be a minimal vertex cover in the complement graph G, and let A′^ a vertex cover in G given by the 2-approximation algorithm, so that |A′| ≤ 2 |A|. Then I := V − A and I′^ := V − A′^ are independent sets in G. Furthermore C := I and C′^ := I′^ are cliques in G. Then |C′| = |I′| = n − |A′| ≥ n − 2 |A| = n−2(n−|C|) = 2|C|−n. This is clearly not a constant approximation.
  2. For a graph G = (V, E), its k-th power Gk^ = (V k, Ek^ ) is the graph where the set of vertices V k^ consists of all ordered k-tuples of vertices in V , and two distinct vertices (v 1 ,... , vk ) and (w 1 ,... , wk ) are adjacent if and only if for each 1 ≤ i ≤ k, {vi, wi} ∈ E or vi = wi.^1 Prove that the maximum clique size in Gk^ equals the k-th power of the maximum clique size in G. Proof: If a subset C ⊂ V forms a clique of size s in G, then from the construction of Gk^ it follows that Ck^ forms a clique of size sk^ in Gk.

(^1) Note that (v 1 ,... , vk) 6 = (w 1 ,... , wk) guarantees that for some i, vi 6 = wi.

(a) Find the integer k such that 2k−^1 < N ≤ 2 k. (b) Choose a random integer m ∈ [1, 2 k^ ] by flipping k independent fair coins. (c) If m ≤ N , then output m and halt; else goto 1 and repeat.

For each ℓ ∈ { 1 ,... , N },

Pr [ℓ is output] = Pr [m = ℓ | m ∈ [1, N ]]

=

Pr [m = ℓ] Pr [m ∈ [1, N ]]

=

1 / 2 k N/ 2 k^

N

Thus each integer in the interval [1, N ] is chosen with equal probability. To analyze the running time, note that

Pr [m ∈ [1, N ]] =

N

2 k^

Thus the expected number of iterations is at most 2. Since each iter- ation takes O(k) = O(log N ) steps, the expected running time of the algorithm is O(log N ). 

  1. Show how to efficiently simulate, for any rational number 0 ≤ p ≤ 1, a (biased) coin that assumes value 1 with probability p, and 0 with probability 1 − p. Solution: Let p = m n , where m ≤ n. Using the algorithm in Part (1), choose a random integer ℓ ∈ [1, n]. If ℓ ≤ m, then output 1; else output 0. 

Problem 4: Fingerprints by Random Irreducible Polynomials

Let F be a field. A non-constant polynomial f (x) ∈ F[x] is said to be irreducible if f (x) does not have a non-constant factor g(x) ∈ F[x] with 0 < deg g < deg f. The roles played by irreducible polynomials among polynomials are similar to those played by prime numbers among integers. The following are some basic yet fundamental facts about polynomials and irreducible polynomials over a field F:

  • Division with Reminader: For every f (x), g(x) ∈ F[x], there exist unique q(x), r(x) ∈ F[x] with 0 ≤ deg r(x) < deg g(x) such that f (x) = q(x)g(x) + r(x). The remainder r(x) is denoted r(x) = f (x) mod g(x). The quotient q(x) and remainder r(x) can be determined by long division.
  • Unique Factorization: Every monic^2 polynomial f (x) ∈ F[x] with deg f > 1 can be decomposed into a product of monic irreducible polynomials in F, and moreover the decomposition is unique up to the order of the irreducible factors.

If the field F is finite, then the following hold:

  • There is a simple deterministic polynomial time algorithm that tests whether a polynomial over F is irreducible.
  • For any positive integer d, there exist irreducible polynomials of de- gree d over F.^3 Furthermore, irreducible polynomials abound.^4 Let F = Fq where q is a prime power. The number of monic irreducible polynomials of degree d in Fq[x] is ∼ qd/d – a rough estimate shows that the number of such irreducible polynomials is at least

qd^ − qd/^2 log 2 d d

Answer the following questions using the above facts.

  1. Give an efficient randomized algorithm that given a prime power q and a positive integer d, generates a random monic irreducible polynomial of degree d over Fq. Algorithm:

(a) Choose a random monic degree-d polynomial f (x) = xd+ad− 1 xd−^1 + · · · + a 1 x + a 0 ∈ Fq[x] by choosing the coefficients a 0 , a 1 ,... , ad− 1 randomly from Fq. (b) Test if f is irreducible. If so, then output f and halt; else goto 1 and repeat. (^2) A polynomial is monic if its leading coefficient is 1. (^3) Note that this is not true in general when F is infinite. (^4) The exact number of irreducible polynomials can be expressed using the so called Mobius Inversion Formula. The formula however does not give the number in a closed form.

for each i and deg C ≤ N −1, we have that rd < N , and thus r < N/d. Therefore, A(x) − B(x) has at most N/d distinct irreducible factors of degree d, while there are ∼ 2 d/d polynomials of degree d over F 2. Therefore,

Pr [The Protocol is Incorrect] = Pr [f (x) | (A(x) − B(x))]

< N/d 2 d/d

N

2 d^

Hence, setting d = (c + 1) log 2 N , the probability of error is at most N/N c+1^ = N −c, and the number of bits exchanged between Alice and Bob is 2d + 1 = 2(c + 1) log 2 N + 1 = O(log 2 N ). 

Problem 5: Protocols for Hamming Distance

For strings x, y ∈ { 0 , 1 }N^ , the relative Hamming distance ∆(x, y) between x and y is the fraction of positions at which x and y differ. That is,

∆(x, y) = | {i : 1 ≤ i ≤ N and xi 6 = yi} | N

Suppose that two parties Alice and Bob hold strings x, y ∈ { 0 , 1 }N^ respec- tively.

  1. Give a simple deterministic protocol for Alice and Bob to determine the exactly value of ∆(x, y) by sending N + log N bits, and prove that every deterministic protocol for this problem requires N bits of communication. Solution: In a straightforward protocol, Alice sends the entire string x to Bob, Bob then computes | {i : 1 ≤ i ≤ N and xi 6 = yi} | and sends the answer to Alice. The number of bits exchanged is N + log N. To show that every deterministic protocol requires N bits of communi- cation, note that there are 2N^ N -bit strings. If in a deterministic pro- tocol Alice and Bob exchange at most N − 1 bits, then the pigeonhole principle implies that there are two distinct strings x, y ∈ { 0 , 1 }N^ such that inputs (x, x) and (y, y) have the same communication pattern. It follows that input (x, y) would also have the same communication pattern as (x, x) and (y, y). This means that when the inputs of Al- ice and Bob are x and y repectively, Alice and Bob would output the

same answer as they do when their inputs are x and x respectively. This implies that the protocol must be incorrect, since ∆(x, x) = 0 and ∆(x, y) 6 = 0. Therefore, N bits of communication are necessary for every deterministic protocol that computes ∆(x, y) exactly. 

  1. Give a communication-efficient randomized protocol for Alice and Bob to approximate ∆(x, y) within an arbitrarily small ε > 0. Analyze the error probability and communication complexity of your protocol.