Approximations for MAX-SAT Problem Chihao Zhang BASICS, Shanghai Jiao Tong University Oct. 23, 2012 Chihao Zhang (BASICS@SJTU) Approximations for MAX-SAT Problem Oct. 23, 2012 1 / 16
The Weighted MAX-SAT Problem Input: n Boolean variables x 1,...,x n, a CNF ϕ = m j=1 C j and a nonnegative weight w j for each C j. Problem: Find an assignment to x i -s that maximizes the weight of satisfied clauses. Chihao Zhang (BASICS@SJTU) Approximations for MAX-SAT Problem Oct. 23, 2012 2 / 16
The Weighted MAX-SAT Problem Input: n Boolean variables x 1,...,x n, a CNF ϕ = m j=1 C j and a nonnegative weight w j for each C j. Problem: Find an assignment to x i -s that maximizes the weight of satisfied clauses. Obviously NP-hard. Chihao Zhang (BASICS@SJTU) Approximations for MAX-SAT Problem Oct. 23, 2012 2 / 16
Flipping a Coin A very straightforawrd randomized approximation algorithm is to set each x i to true independently with probability 1/2. Chihao Zhang (BASICS@SJTU) Approximations for MAX-SAT Problem Oct. 23, 2012 3 / 16
Flipping a Coin A very straightforawrd randomized approximation algorithm is to set each x i to true independently with probability 1/2. Theorem Setting each x i to true with probability 1/2 independently gives a randomized 1 2-approximation algorithm for weighted MAX-SAT. Chihao Zhang (BASICS@SJTU) Approximations for MAX-SAT Problem Oct. 23, 2012 3 / 16
Proof Proof. Let W be a random variable that is equal to the total weight of the satisfied clauses. Define an indicator random variable Y j for each clause C j such that Y j = 1 if and only if C j is satisfied. Then W = m w j Y j j=1 We use OPT to denote value of optimum solution, then E[W] = m w j E[Y j ] = j=1 m w j Pr[clause C j satisfied] j=1 Chihao Zhang (BASICS@SJTU) Approximations for MAX-SAT Problem Oct. 23, 2012 4 / 16
Proof (cont d) Since each variable is set to true independently, we have ( ( ) ) 1 lj Pr[clause C j satisfied] = 1 1 2 2 where l j is the number of literals in clause C j. Hence, E[W] 1 2 m w j 1 2 OPT. j=1 Chihao Zhang (BASICS@SJTU) Approximations for MAX-SAT Problem Oct. 23, 2012 5 / 16
Proof (cont d) Since each variable is set to true independently, we have ( ( ) ) 1 lj Pr[clause C j satisfied] = 1 1 2 2 where l j is the number of literals in clause C j. Hence, E[W] 1 2 m w j 1 2 OPT. j=1 From the analysis, we can see that the performance of the algorithm is better on instances consisting of long clauses. Chihao Zhang (BASICS@SJTU) Approximations for MAX-SAT Problem Oct. 23, 2012 5 / 16
Derandomization by Conditional Expectation The previous randomized algorithm can be derandomized. Note that E[W] = E[W x 1 true] Pr[x 1 true] +E[W x 1 false] Pr[x 1 false] = 1 2 (E[W x 1 true]+e[w x 1 false]) Chihao Zhang (BASICS@SJTU) Approximations for MAX-SAT Problem Oct. 23, 2012 6 / 16
Derandomization by Conditional Expectation The previous randomized algorithm can be derandomized. Note that E[W] = E[W x 1 true] Pr[x 1 true] +E[W x 1 false] Pr[x 1 false] = 1 2 (E[W x 1 true]+e[w x 1 false]) We set b 1 true if E[W x 1 true] E[W x 1 false] and set b 1 false otherwise. Let the value of x 1 be b 1. Chihao Zhang (BASICS@SJTU) Approximations for MAX-SAT Problem Oct. 23, 2012 6 / 16
Derandomization by Conditional Expectation The previous randomized algorithm can be derandomized. Note that E[W] = E[W x 1 true] Pr[x 1 true] +E[W x 1 false] Pr[x 1 false] = 1 2 (E[W x 1 true]+e[w x 1 false]) We set b 1 true if E[W x 1 true] E[W x 1 false] and set b 1 false otherwise. Let the value of x 1 be b 1. Continue this process until all b i are found, i.e., all n variables have been set. Chihao Zhang (BASICS@SJTU) Approximations for MAX-SAT Problem Oct. 23, 2012 6 / 16
Derandomization by Conditional Expectation This is a deterministic 1 2-approximation algorithm because of the following two facts: 1. E[W x 1 b 1,...,x i b i ] can be computed in polynomial time for fixed b 1,...,b i. 2. E[W x 1 b 1,...,x i b i,x i+1 b i+1 ] E[W x 1 b 1,...,x i b i ] for all i. Chihao Zhang (BASICS@SJTU) Approximations for MAX-SAT Problem Oct. 23, 2012 7 / 16
Flipping biased coins Previously, we set each x i true or false with probability 1 2 1 independently. 2 is nothing special here. Chihao Zhang (BASICS@SJTU) Approximations for MAX-SAT Problem Oct. 23, 2012 8 / 16
Flipping biased coins Previously, we set each x i true or false with probability 1 2 1 independently. 2 is nothing special here. In the following, we set each x i true with probability p 1 2. Chihao Zhang (BASICS@SJTU) Approximations for MAX-SAT Problem Oct. 23, 2012 8 / 16
Flipping biased coins Previously, we set each x i true or false with probability 1 2 1 independently. 2 is nothing special here. In the following, we set each x i true with probability p 1 2. We first consider the case that no clause is of the form C j = x i. Chihao Zhang (BASICS@SJTU) Approximations for MAX-SAT Problem Oct. 23, 2012 8 / 16
Flipping biased coins Previously, we set each x i true or false with probability 1 2 1 independently. 2 is nothing special here. In the following, we set each x i true with probability p 1 2. We first consider the case that no clause is of the form C j = x i. Lemma If each x i is set to true with probability p 1/2 independently, then the probability that any given clause is satisfied is at least min(p,1 p 2 ) for instances with no negated unit clauses. Chihao Zhang (BASICS@SJTU) Approximations for MAX-SAT Problem Oct. 23, 2012 8 / 16
Flipping biased coins (cont d) Armed with previous lemma, we then maximize min(p,1 p 2 ), which is achieved when p = 1 p 2, namely p = 1 2 ( 5 1) 0.618. Chihao Zhang (BASICS@SJTU) Approximations for MAX-SAT Problem Oct. 23, 2012 9 / 16
Flipping biased coins (cont d) Armed with previous lemma, we then maximize min(p,1 p 2 ), which is achieved when p = 1 p 2, namely p = 1 2 ( 5 1) 0.618. We need more effort to deal with negated unite clauses, i.e., C j = x i for some j. Chihao Zhang (BASICS@SJTU) Approximations for MAX-SAT Problem Oct. 23, 2012 9 / 16
Flipping biased coins (cont d) Armed with previous lemma, we then maximize min(p,1 p 2 ), which is achieved when p = 1 p 2, namely p = 1 2 ( 5 1) 0.618. We need more effort to deal with negated unite clauses, i.e., C j = x i for some j. We distinguish between two cases: Chihao Zhang (BASICS@SJTU) Approximations for MAX-SAT Problem Oct. 23, 2012 9 / 16
Flipping biased coins (cont d) Armed with previous lemma, we then maximize min(p,1 p 2 ), which is achieved when p = 1 p 2, namely p = 1 2 ( 5 1) 0.618. We need more effort to deal with negated unite clauses, i.e., C j = x i for some j. We distinguish between two cases: 1. Assume C j = x i and there is no clause such that C = x i. In this case, we can introduce a new variable y and replace the appearance of x i in ϕ by y and the appearance of x i by ȳ. Chihao Zhang (BASICS@SJTU) Approximations for MAX-SAT Problem Oct. 23, 2012 9 / 16
Flipping biased coins (cont d) 2. C j = x i and some clause C k = x i. W.L.O.G we assume w(c j ) w(c k ). Note that for any assignment, C j and C k cannot be satisfied simultaneously. Let v i be the weight of the unit clause x i if it exists in the instance, and let v i be zero otherwise, we have m n OPT w j j=1 i=1 v i Chihao Zhang (BASICS@SJTU) Approximations for MAX-SAT Problem Oct. 23, 2012 10 / 16
Flipping biased coins (cont d) 2. C j = x i and some clause C k = x i. W.L.O.G we assume w(c j ) w(c k ). Note that for any assignment, C j and C k cannot be satisfied simultaneously. Let v i be the weight of the unit clause x i if it exists in the instance, and let v i be zero otherwise, we have m n OPT w j j=1 i=1 We set each x i true with probability p = 1 2 ( 5 1), then m E[W] = w je[y j] j=1 ( m p w j j=1 p OPT v i ) n v i i=1 Chihao Zhang (BASICS@SJTU) Approximations for MAX-SAT Problem Oct. 23, 2012 10 / 16
The Use of Linear Program Integer Program Characterization: maximize subject to m j=1 wjzj i P j y i + i N j (1 y i) z j, C j = i P j x i i N j x i, y i {0,1}, z j {0,1}, i = 1,...,n, j = 1,...,m. where y i indicate the assignment of variable x i and z j indicates whether clause C j is satisfied. Chihao Zhang (BASICS@SJTU) Approximations for MAX-SAT Problem Oct. 23, 2012 11 / 16
The Use of Linear Program Linear Program Relaxation: maximize subject to m j=1 wjzj i P j y i + i N j (1 y i) z j, C j = i P j x i i N j x i, 0 y i 1, i = 1,...,n, 0 z j 1, j = 1,...,m. where y i indicate the assignment of variable x i and z j indicates whether clause C j is satisfied. Chihao Zhang (BASICS@SJTU) Approximations for MAX-SAT Problem Oct. 23, 2012 11 / 16
Flipping Different Coins Let (y,z ) be an optimal solution of the linear program. Chihao Zhang (BASICS@SJTU) Approximations for MAX-SAT Problem Oct. 23, 2012 12 / 16
Flipping Different Coins Let (y,z ) be an optimal solution of the linear program. We set x i to true with probability y i. Chihao Zhang (BASICS@SJTU) Approximations for MAX-SAT Problem Oct. 23, 2012 12 / 16
Flipping Different Coins Let (y,z ) be an optimal solution of the linear program. We set x i to true with probability y i. This can be viewed as flipping different coins for every variable. Chihao Zhang (BASICS@SJTU) Approximations for MAX-SAT Problem Oct. 23, 2012 12 / 16
Flipping Different Coins Let (y,z ) be an optimal solution of the linear program. We set x i to true with probability y i. This can be viewed as flipping different coins for every variable. Theorem Randomized rounding gives a randomized (1 1 e )-approximation algorithm for MAX SAT. Chihao Zhang (BASICS@SJTU) Approximations for MAX-SAT Problem Oct. 23, 2012 12 / 16
Analysis Pr[clause C j not satisfied] = (1 yi ) i i P j i N j y [ ( 1 )] l j i P j (1 yi )+ i N j yi lj = 1 1 yi + (1 y l j i Pj i N j i ) l j ( 1 z j l j l j ) Chihao Zhang (BASICS@SJTU) Approximations for MAX-SAT Problem Oct. 23, 2012 13 / 16
Analysis Pr[clause C j not satisfied] = (1 yi ) i i P j i N j y [ ( 1 )] Arithmeticl j i P j (1 yi )+ i N j yi lj Geometric Mean Inequality = 1 1 yi + (1 y l j i Pj i N j i ) l j ( 1 z j l j l j ) Chihao Zhang (BASICS@SJTU) Approximations for MAX-SAT Problem Oct. 23, 2012 13 / 16
Analysis (cont d) Pr[clause C j satisfied] ( ) lj 1 1 z j l j [ ) ] lj 1 (1 1lj zj Chihao Zhang (BASICS@SJTU) Approximations for MAX-SAT Problem Oct. 23, 2012 14 / 16
Analysis (cont d) Pr[clause C j satisfied] ( ) lj 1 1 z j l j [ ) ] lj 1 (1 1lj zj Jensen s Inequality Chihao Zhang (BASICS@SJTU) Approximations for MAX-SAT Problem Oct. 23, 2012 14 / 16
Analysis (cont d) Pr[clause C j satisfied] ( ) lj 1 1 z j l j [ ) ] lj 1 (1 1lj zj Jensen s Inequality Therefore, we have E[W] = m w j Pr[clause C j satisfied] j=1 [ m ) ] lj w jzj 1 (1 1lj j=1 ( 1 1 ) OPT e Chihao Zhang (BASICS@SJTU) Approximations for MAX-SAT Problem Oct. 23, 2012 14 / 16
Choosing the better of two The randomized rounding algorithm performs better when l j -s are small.( ( 1 1 k) k is nondecreasing). Chihao Zhang (BASICS@SJTU) Approximations for MAX-SAT Problem Oct. 23, 2012 15 / 16
Choosing the better of two The randomized rounding algorithm performs better when l j -s are small.( ( 1 1 k) k is nondecreasing) The unbiased randomized algorithm performs better when l j -s are large.. Chihao Zhang (BASICS@SJTU) Approximations for MAX-SAT Problem Oct. 23, 2012 15 / 16
Choosing the better of two The randomized rounding algorithm performs better when l j -s are small.( ( 1 1 k) k is nondecreasing) The unbiased randomized algorithm performs better when l j -s are large. We will combine them together. Chihao Zhang (BASICS@SJTU) Approximations for MAX-SAT Problem Oct. 23, 2012 15 / 16
Choosing the better of two The randomized rounding algorithm performs better when l j -s are small.( ( 1 1 k) k is nondecreasing) The unbiased randomized algorithm performs better when l j -s are large. We will combine them together. Theorem Choosing the better of the two solutions given by the two algorithms yields a randomized 3 4-approximation algorithm for MAX SAT. Chihao Zhang (BASICS@SJTU) Approximations for MAX-SAT Problem Oct. 23, 2012 15 / 16
Analysis Let W 1 and W 2 be the r.v. of value of solution of randomize rounding algorithm and unbiased randomized algorithm respectively. Then E[max(W 1,W 2 )] E[ 1 2 W 1 + 1 2 W 2] [ 1 m ) ] w j zj 1 (1 1lj lj + 1 2 2 j=1 [ ( m ) ) w j zj 1 1 (1 1lj lj + 1 2 2 j=1 3 4 OPT m j=1 ) w j (1 2 l j ( 1 2 l j ) ] Chihao Zhang (BASICS@SJTU) Approximations for MAX-SAT Problem Oct. 23, 2012 16 / 16