The.Algorithm.Design.Manual.Springer-Verlag.1998

The.Algorithm.Design.Manual.Springer-Verlag.1998 The.Algorithm.Design.Manual.Springer-Verlag.1998

18.04.2013 Views

Satisfiability Next: Graph Problems: Polynomial-Time Up: Combinatorial Problems Previous: Job Scheduling Satisfiability Input description: A set of clauses in conjunctive normal form. Problem description: Is there a truth assignment to the Boolean variables such that every clause is simultaneously satisfied? Discussion: Satisfiability arises whenever we seek a configuration or object that must be consistent with (i.e. satisfy) a given set of constraints. For example, consider the problem of drawing name labels for cities on a map. For the labels to be legible, we do not want the labels to overlap, but in a densely populated region many labels need to be drawn in a small space. How can we avoid collisions? For each of the n cities, suppose we identify two possible places to position its label, say right above or right below each city. We can represent this choice by a Boolean variable , which will be true if city 's label is above , otherwise . Certain pairs of labels may be forbidden, such as when 's above label would obscure 's below label. This pairing can be forbidden by the two-element clause , where means ``not v''. Finding a satisfying truth assignment for the resulting set of clauses yields a mutually legible map labeling if one exists. Satisfiability is the original NP-complete problem. Despite its applications to constraint satisfaction, file:///E|/BOOK/BOOK4/NODE157.HTM (1 of 4) [19/1/2003 1:30:52]

Satisfiability logic, and automatic theorem proving, it is perhaps most important theoretically as the root problem from which all other NP-completeness proofs originate. ● Is your formula in CNF or DNF? - In satisfiability, the constraints are specified as a logical formula. There are two primary ways of expressing logical formulas, conjunctive normal form (CNF) and disjunctive normal form (DNF). In CNF formulas, we must satisfy all clauses, where each clause is constructed by and-ing or's of literals together, such as In DNF formulas, we must satisfy any one clause, where each clause is constructed by or-ing ands of literals together. The formula above can be written in DNF as Solving DNF-satisfiability is trivial, since any DNF formula can be satisfied unless every clause contains both a literal and its complement (negation). However, CNF-satisfiability is NPcomplete. This seems paradoxical, since we can use De Morgan's laws to convert CNF-formulae into equivalent DNF-formulae and vice versa. The catch is that an exponential number of terms might be constructed in the course of translation, so that the translation itself might not run in polynomial time. ● How big are your clauses? - k-SAT is a special case of satisfiability when each clause contains at most k literals. The problem of 1-SAT is trivial, since we must set true any literal appearing in any clause. The problem of 2-SAT is not trivial, but it can still be solved in linear time. This is very interesting, because many problems can be modeled as 2-SAT using a little cleverness. Observe that the map labeling problem described above is an instance of 2-SAT and hence can be solved in time linear in the number of clauses, which might be quadratic in the number of variables. The good times end as soon as clauses contain three literals each, i.e. 3-SAT, for 3-SAT is NPcomplete. Thus in general it will not be helpful to model a problem as satisfiability unless we can do it with two-element clauses. ● Does it suffice to satisfy most of the clauses? - Given an instance of general satisfiability, there is not much you can do to solve it except by backtracking algorithms such as the Davis-Putnam procedure. In the worst case, there are truth assignments to be tested, but fortunately, there are lots of ways to prune the search. Although satisfiability is NP-complete, how hard it is in practice depends on how the instances are generated. Naturally defined ``random'' instances are often surprisingly easy to solve, and in fact it is nontrivial to generate instances of the problem that are truly hard. Still, we would likely benefit by relaxing the problem so that the goal is to satisfy as many clauses as possible. Here optimization techniques such as simulated annealing can be put to work to refine random or heuristic solutions. Indeed, any random truth assignment to the variables will satisfy file:///E|/BOOK/BOOK4/NODE157.HTM (2 of 4) [19/1/2003 1:30:52]

Satisfiability<br />

Next: Graph Problems: Polynomial-Time Up: Combinatorial Problems Previous: Job Scheduling<br />

Satisfiability<br />

Input description: A set of clauses in conjunctive normal form.<br />

Problem description: Is there a truth assignment to the Boolean variables such that every clause is<br />

simultaneously satisfied?<br />

Discussion: Satisfiability arises whenever we seek a configuration or object that must be consistent with<br />

(i.e. satisfy) a given set of constraints. For example, consider the problem of drawing name labels for<br />

cities on a map. For the labels to be legible, we do not want the labels to overlap, but in a densely<br />

populated region many labels need to be drawn in a small space. How can we avoid collisions?<br />

For each of the n cities, suppose we identify two possible places to position its label, say right above or<br />

right below each city. We can represent this choice by a Boolean variable , which will be true if city<br />

's label is above , otherwise . Certain pairs of labels may be forbidden, such as when 's<br />

above label would obscure 's below label. This pairing can be forbidden by the two-element clause<br />

, where means ``not v''. Finding a satisfying truth assignment for the resulting set of clauses<br />

yields a mutually legible map labeling if one exists.<br />

Satisfiability is the original NP-complete problem. Despite its applications to constraint satisfaction,<br />

file:///E|/BOOK/BOOK4/NODE157.HTM (1 of 4) [19/1/2003 1:30:52]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!