• Aucun résultat trouvé

Searching Balls and Cover Codes

In this section we describe a deterministic algorithm solvingk-SATwhich has run-ning time O( k+12k n

). In previous section, we chose balls at random and then searched balls for a satisfying assignment. In this section the strategy is to (de-terministically) cover the Hamming space of all assignments by a sufficiently small amount of balls of small radius.

The following lemma gives a deterministic algorithm searching a ball of radius r.

Lemma 8.4.Given a k-CNF formula F and a truth assignment a of F, it can be decided in time krnO(1) whether there is a satisfying assignment of F which is at Hamming distance at most r from the assignment a.

Proof. Ifais not a satisfying assignment, the algorithm chooses an arbitrary unsat-isfied clauseCofF. Then it generates at mostknew assignments by flipping the value of each variable inC. Each of the new assignments is at Hamming distance one froma. Moreover, if there is a satisfying assignmenta, then the distance from at least one new assignment toais smaller than the distance from a toa. The algorithm proceeds recursively. At every step of the recursion it creates at mostk new assignments and the depth of the recursion is at mostr. Thus in the search tree corresponding to an execution of the branching algorithm all interior nodes have at mostkchildren and its height is at mostr. Consequently the search tree has at most kr leaves and thus the running time isO(kr). Consequently the algorithm finds in timeO(kr)either a satisfying assignment, or it correctly concludes that there is no satisfying assignment within Hamming distance at mostrfroma. ut Let 0nbe the truth assignment with all variables set to 0 (false) and 1nthat with all variables set to 1 (true). Then every assignment, including a satisfying assignment, belongs to one of the ballsH(0n,n/2)andH(1n,n/2). Then by Lemma8.4, we can (deterministically) solvek-SATin time(√

k)n·nO(1). While fork=3 this is better than the brute force search, fork≥4 the result is not so exciting. What happens if we try to use balls of smaller sizes?

Let us study the following randomized algorithm. Choose uniformly at random a truth assignmentaand search for a satisfying assignment at distance at mostαn froma. The probability that a satisfying assignment is inH(a,αn)is at least

αni=1 ni 2n

(the ratio of|H(a,αn)|and the total number of assignments). The expected number of steps the algorithm runs until it finds a satisfying assignment, assuming there is one, is

O 2n

αni=1 ni·kαn

!

=O(2(1−h(α))n·kαn),

8.2 Searching Balls and Cover Codes 147 whereh(·)is the binary entropy function. Straightforward differentiation shows that we can minimize the exponential part of the product by choosingα=k+11 . Thus the expected number steps of the algorithm is

O 2k

k+1 n

.

Now, as in the proof of Theorem8.3, it is easy to obtain a Monte Carlo algorithm solvingk-SATwhich has running timeO

2k k+1

n .

In what follows, we show how to make this algorithm deterministic without changing its exponential running time.

Acode of length nis a subset ofHn. Acovering codeC of radius dis a code such that every truth assignment is within distance at mostdfrom some assignment inC. We start with the bounds on the size of a covering code.

What is the size of a covering code of radiusαn? The following lemma answers this question.

Lemma 8.5.LetCbe a covering code of radiusαn,0<α≤1/2. Then

|C| ≥ 2n

|H(0n,αn)| ≥2(1−h(α))n.

Proof. Every ball of radiusαncovers at most|H(0n,αn)|truth assignments. Thus to cover 2nassignments, one needs at least

2n

|H(0n,αn)|

balls. ut

The bound of Lemma8.5is tight up to polynomial factor.

Lemma 8.6.For every0<α≤1/2 there exists a covering codeC of radiusαn such that Proof. Let us choose uniformly at randoml

n|H(02nn,αn)|m

assignments (with possible repetitions). We want to show that with a positive probability this is a covering code.

Letabe an assignment. The probability that the first chosen element is at distance more thanαnfroma, or is not inH(a,αn)is

1−H(a,αn)

2n =1−H(0n,αn) 2n . Thus the probability thatais not covered byl

n|H(02nn,αn)|

m

assignments is

1−H(0n,αn) 2n

l

n|H(02nn,αn)|

m

≤e−n, wheree=limn→+∞(1+1n)n∼2.718282.

Therefore, the probability that there is a non-covered assignment is at most 2ne−n, and we conclude that the probability that the chosen assignment is a cov-ering code is at least

1−2 e >0.

We have shown that a randomly chosen assignment set of sizel

n|H(02nn,αn)|m with positive probability covers all assignments, which yields that a covering code of

such cardinality exists. ut

Lemma8.6does not provide an algorithm to compute a covering code of given radius. This can be done by treating the problem as a set cover problem and running a greedy algorithm to find a set cover.

Lemma 8.7.For every0<α≤1/2a covering codeCof radiusαn of size at most n2p

nα(1−α)·2(1−h(α))n can be computed in timeO(8n).

Proof. It is well known that a greedy algorithm for the MINIMUM SET COVER

problem (the algorithm which always selects a set which covers the maximum num-ber of yet uncovered elements) is a logM-approximation algorithm, whereMis the number of sets. In our case, we can view the covering code as an instance of the MINIMUMSETCOVERproblem with 2nsets, each consisting of a ball of radiusαn centered in some truth assignment. Thus the greedy approach provides a solution within a factornof the optimal one. By Lemma8.6, the size of the solution found is at most

n2p

nα(1−α)·2(1−h(α))n.

To implement the greedy approach, we keep for every ball the set of assignments already covered by the selected balls. Every time we select a new ball, we recompute these sets. The number of such selections is at most 2nand for every selection a re-computation of covered assignments takes timeO(4n). Thus the total running time

isO(8n). ut

The following lemma trades off the size of the covering code and the time re-quired for its computation.

Lemma 8.8.Let`≥2be a divisor of n. For every0<α≤1/2a covering codeC of radiusαn of size at most

n2p

nα(1−α)`

·2(1−h(α))n

8.2 Searching Balls and Cover Codes 149 can be computed in time(23n/`+2(1−h(α))n)·nO(1).

Proof. We partition the set ofn variables into `groups of size n/`. All possible truth assignments for each of these groups form a Hamming space Hn/`. Every truth assignment inHnis a concatenation of`assignments inHn/`. Moreover, every covering code inHnwith radiusαn is a concatenation of covering codes inHn/`

with radiusαn/`.

By Lemma8.7, a covering code of radiusαn/`inHn/`of size at most n2p

nα(1−α)·2(1−h(α))n` can be computed in time 23n/`·nO(1).

By trying all possible concatenations of codes obtained forHn/`, we obtain the code forHnand the size of this code is at most

n2p

nα(1−α)`

·2(1−h(α))n.

u t We are ready to prove the main result of this section.

Theorem 8.9.The deterministic algorithmk-sat5solves the k-SATproblem with n variables in time

O(

2− 2 k+1

n

).

Algorithmk-sat5(F).

Input: Ak-CNF formulaFwithnvariables andmclauses.

Output: Either a satisfying assignment ofFor a report thatFis unsatisfiable.

α=1/(k+1)

use Lemma8.8with`=6 to construct a covering codeCof lengthnand radiusαn forallassignmentsaCdo

use Lemma8.4to search for a satisfying assignment in the ballH(a,αn) ifsatisfying assignmentais foundthen

returna else

returnFis unsatisfiable

Fig. 8.4 Algorithmk-sat5fork-SATISFIABILITY

Proof. Algorithmk-sat5given in Fig.8.4is based on local search. It first con-structs a covering code Cand then it searches all balls around the assignments of the code for a satisfying assignment. Without loss of generality we assume here that n is divisible by 6, otherwise we can add at most 5 fake variables, increasing the complexity by a polynomial factor. BecauseCis a covering code, clearly, the algo-rithm either finds a satisfying assignment or correctly reports that the formula is not satisfiable.

The running time of the algorithm is the sum of the following running times:

Thus the total running time of the algorithm is T1(n, n

Theorem8.3is due to Sch¨oning [199,200]. This approach is based on a randomized polynomial time algorithm for 2-SATof Papadimitriou [169]. Our exposition of the algorithm follows the book of Mitzenmacher and Upfal [157]. For an introductory book on Probability Theory, we refer to the book of Feller [76].

A different randomized approach to solving k-SATis given by Paturi, Pudl´ak, Saks and Zane [172]. They obtain an algorithm solvingk-SATwith error probability o(1)in time

O(2n(1−k−1µk+o(1))),

8.2 Searching Balls and Cover Codes 151 whereµk is an increasing sequence with µ3≈1.227 and limk→∞µk2/6. See also [173].

For k=3, the randomized Sch¨oning’s algorithm runs in time O(1.334n). It is possible to improve this bound by combining the algorithms of Sch¨oning and Paturi, Pudl´ak, Saks and Zane [124], see also [116]. Rolf reduced the running time toO(1.323n)[186]. The surveys of Sch¨oning [201] and Iwama [122] contain more information on probabilistic algorithms forSAT.

Theorem 8.9is due to Dantsin, Goerdt, Hirsch, Kannan, Kleinberg, Papadim-itriou, Raghavan and Sch¨oning [59]. Since the algorithm of Lemma8.8 requires exponential space, the algorithm of Theorem8.9also needs exponential space. This can be fixed (at the price of more running time) if in the proof of Lemma8.8we choose`of sizeεn, for someε>0. Then for everyδ >0 the algorithm from The-orem8.9can be modified to run in polynomial space and time

O

2− 2 k+1+δ

n .

The proof that an approximation for MINIMUMSET COVERcan be obtained by a greedy algorithm can be found in [114].

For 3-SAT the deterministic algorithm with running time O(1.5n)was sped up toO(1.473n)[41] and toO(1.465n)[196] by improving the running time of Lemma8.4. Dantsin and Hirsch provide a nice overview of known techniques in [60]. Feder and Motwani obtained randomized algorithms for Constraint Satisfac-tion Problem (CSP) [74].

Chapter 9

Split and List

In this chapter we discuss several algorithms based on the following approach. There is a number of efficient algorithms for many problems in P. To apply these algo-rithms on hard problems, we (exponentially) enlarge the size of a hard problem and apply fast polynomial time algorithm on an input of exponential size. The com-mon way to enlarge the problem is to split the input into parts, and for each part to enumerate (or list) all possible solutions to subproblems corresponding to the part.

Then we combine solutions of subproblems to solutions of the input of the original problem by making use of a fast polynomial time algorithm.