Algorithms for SAT and k-sat problems

Similar documents
Boolean Functions (Formulas) and Propositional Logic

8.1 Polynomial-Time Reductions

NP-Complete Reductions 2

Best known solution time is Ω(V!) Check every permutation of vertices to see if there is a graph edge between adjacent vertices

Computability Theory

2SAT Andreas Klappenecker

Notes on CSP. Will Guaraldi, et al. version /13/2006

! Greed. O(n log n) interval scheduling. ! Divide-and-conquer. O(n log n) FFT. ! Dynamic programming. O(n 2 ) edit distance.

Chapter 8. NP and Computational Intractability. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

NP-Completeness. Algorithms

! Greed. O(n log n) interval scheduling. ! Divide-and-conquer. O(n log n) FFT. ! Dynamic programming. O(n 2 ) edit distance.

Computational problems. Lecture 2: Combinatorial search and optimisation problems. Computational problems. Examples. Example

Homework 4 Solutions

CSc Parallel Scientific Computing, 2017

Propositional Calculus: Boolean Algebra and Simplification. CS 270: Mathematical Foundations of Computer Science Jeremy Johnson

Exercises Computational Complexity

Example of a Demonstration that a Problem is NP-Complete by reduction from CNF-SAT

P -vs- NP. NP Problems. P = polynomial time. NP = non-deterministic polynomial time

Notes on CSP. Will Guaraldi, et al. version 1.7 4/18/2007

NP and computational intractability. Kleinberg and Tardos, chapter 8

EECS 219C: Computer-Aided Verification Boolean Satisfiability Solving. Sanjit A. Seshia EECS, UC Berkeley

Chapter 10 Part 1: Reduction

Lecture 14: Lower Bounds for Tree Resolution

Mixed Integer Linear Programming

CMPSCI611: The SUBSET-SUM Problem Lecture 18

8 NP-complete problem Hard problems: demo

8.1 Polynomial-Time Reductions

The Satisfiability Problem [HMU06,Chp.10b] Satisfiability (SAT) Problem Cook s Theorem: An NP-Complete Problem Restricted SAT: CSAT, k-sat, 3SAT

Complexity Classes and Polynomial-time Reductions

9.1 Cook-Levin Theorem

1 Definition of Reduction

Reductions and Satisfiability

Introduction to Algorithms / Algorithms I Lecturer: Michael Dinitz Topic: Approximation algorithms Date: 11/18/14

EECS 219C: Formal Methods Boolean Satisfiability Solving. Sanjit A. Seshia EECS, UC Berkeley

CS446: Machine Learning Fall Problem Set 4. Handed Out: October 17, 2013 Due: October 31 th, w T x i w

Where Can We Draw The Line?

P and NP CISC4080, Computer Algorithms CIS, Fordham Univ. Instructor: X. Zhang

P and NP CISC5835, Algorithms for Big Data CIS, Fordham Univ. Instructor: X. Zhang

CS 580: Algorithm Design and Analysis

3/7/2018. CS 580: Algorithm Design and Analysis. 8.1 Polynomial-Time Reductions. Chapter 8. NP and Computational Intractability

6.006 Final Exam Name 2. Problem 1. True or False [30 points] (10 parts) For each of the following questions, circle either True, False or Unknown.

NP-Completeness of 3SAT, 1-IN-3SAT and MAX 2SAT

P and NP (Millenium problem)

Introduction to Parameterized Complexity

CS 512, Spring 2017: Take-Home End-of-Term Examination

Example: Map coloring

SAT-CNF Is N P-complete

Reductions. Linear Time Reductions. Desiderata. Reduction. Desiderata. Classify problems according to their computational requirements.

(a) (4 pts) Prove that if a and b are rational, then ab is rational. Since a and b are rational they can be written as the ratio of integers a 1

Decision Procedures. An Algorithmic Point of View. Decision Procedures for Propositional Logic. D. Kroening O. Strichman.

ALGORITHMS EXAMINATION Department of Computer Science New York University December 17, 2007

Randomness and Computation March 25, Lecture 5

NP-Hardness. We start by defining types of problem, and then move on to defining the polynomial-time reductions.

Linear Time Unit Propagation, Horn-SAT and 2-SAT

Deductive Methods, Bounded Model Checking

W4231: Analysis of Algorithms

Chapter 8. NP-complete problems

Steven Skiena. skiena

Standard Boolean Forms

1 Probability Review. CS 124 Section #8 Hashing, Skip Lists 3/20/17. Expectation (weighted average): the expectation of a random quantity X is:

Chapter 2 PRELIMINARIES

CPSC 320 Notes: What's in a Reduction?

Logic: TD as search, Datalog (variables)

(QiuXin Hui) 7.2 Given the following, can you prove that the unicorn is mythical? How about magical? Horned? Decide what you think the right answer

CS 151 Complexity Theory Spring Final Solutions. L i NL i NC 2i P.

Acknowledgements. Outline

Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Chapter 6 Outline. Unary Relational Operations: SELECT and

CS521 \ Notes for the Final Exam

New Encodings of Pseudo-Boolean Constraints into CNF

Notes for Lecture 24

4.1 Review - the DPLL procedure

1.4 Normal Forms. We define conjunctions of formulas as follows: and analogously disjunctions: Literals and Clauses

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Approximation algorithms Date: 11/27/18

Introduction. The Quine-McCluskey Method Handout 5 January 24, CSEE E6861y Prof. Steven Nowick

PROPOSITIONAL LOGIC (2)

Parallelizing SAT Solver With specific application on solving Sudoku Puzzles

The Resolution Algorithm

NP-complete Reductions

SAT Solvers. Ranjit Jhala, UC San Diego. April 9, 2013

Normal Forms for Boolean Expressions

Informatics 1 - Computation & Logic: Tutorial 3

1. Suppose you are given a magic black box that somehow answers the following decision problem in polynomial time:

Copyright 2000, Kevin Wayne 1

SAT Solver. CS 680 Formal Methods Jeremy Johnson

Satisfiability Coding Lemma

Lecture 7: Counting classes

(p 300) Theorem 7.27 SAT is in P iff P=NP

Lecture 2: NP-Completeness

On Computing Minimum Size Prime Implicants

A Simplied NP-complete MAXSAT Problem. Abstract. It is shown that the MAX2SAT problem is NP-complete even if every variable

1. [5 points each] True or False. If the question is currently open, write O or Open.

Unit 8: Coping with NP-Completeness. Complexity classes Reducibility and NP-completeness proofs Coping with NP-complete problems. Y.-W.

Implementation of a Sudoku Solver Using Reduction to SAT

Motivation. CS389L: Automated Logical Reasoning. Lecture 17: SMT Solvers and the DPPL(T ) Framework. SMT solvers. The Basic Idea.

Heuristic Search for Planning

Massively Parallel Seesaw Search for MAX-SAT

Seminar decision procedures: Certification of SAT and unsat proofs

Satisfiability (SAT) Applications. Extensions/Related Problems. An Aside: Example Proof by Machine. Annual Competitions 12/3/2008

Some Hardness Proofs

Prove, where is known to be NP-complete. The following problems are NP-Complete:

Transcription:

Algorithms for SAT and k-sat problems On solutions that don t require bounded treewidth Pauli Miettinen Pauli.Miettinen@cs.Helsinki.FI Department of Computer Science - p. 1/23

- p. 2/23

Problem definitions Problem definitions Hamming balls Codes and Covering codes Example of covering codes Summarization of notations The propositional satifiability problem for Boolean formulas in conjunctive normal form ([CNF-]SAT) is as follows. Problem 1 ([CNF-]SAT). Given a boolean formula F in conjunctive normal form, is there an assignment A for F such that A satisfies F? A variation of this is the k satisfiability problem (k-sat). Problem 2 (k-sat). Given a boolean formula F in k conjunctive normal form, is there an assignment A for F such that A satisfies F? Both problems (with k > 2) are well known to be NP-complete. - p. 3/23

Hamming balls Problem definitions Hamming balls Codes and Covering codes Example of covering codes Summarization of notations A Hamming distance between two vectors u and v in H n = {0, 1} n is n d(u, v) = u i v i, i=1 i.e., the number of positions where u and v differ. The Hamming ball of radius R around an assignment A is the set of all assignments whose Hamming distance to A is at most R, i.e., B(A, R) = {A H n d(a, A ) R}. The volume of some ball with radius R in H n is R ( ) n V (n, R) =. i i=0 - p. 4/23

Codes and Covering codes Problem definitions Hamming balls Codes and Covering codes Example of covering codes Summarization of notations A code of length n is just a subset of H n. The covering radius R of a code C is R = max min d(u, v), u H n v C i.e., how far are the furthest assignments from this code. The normalized covering radius ρ is R/n. The covering code of radius R is a code C s.t. B(v, R) = H n. v C - p. 5/23

Example of covering codes Problem definitions Hamming balls Codes and Covering codes Example of covering codes Summarization of notations B(A 1, R) H n B(A 4, R) B(A 2, R) R B(A 3, R) - p. 6/23

Summarization of notations Problem definitions Hamming balls Codes and Covering codes Example of covering codes Summarization of notations n is the number of variables and m is the number of clauses in given formula F. k is the number of variables per clause in formulas in k-cnf, k > 2. H n = {0, 1} n is a Hamming space; A = (a i ) {0, 1} n is an assignment; d(, ) is the Hamming distance; B(A, R) H n is a (Hamming) ball of radius R and V (n, R) is the volume of such ball. C H n is a code and ρ is its normalized covering radius. h( ) is the binary entropy function, h(x) = x log 2 x (1 x) log 2 (1 x). - p. 7/23

- p. 8/23

Other work Hey, where s sums of products? of this presentation is to introduce some algoritmic techniques for SAT randomized local search deterministic local search to present following algorithms: a deterministic O((2 2/(k + 1)) n ) local search algorithm for k-sat; a randomized algorithm for SAT that runs in expected time O(m 2 2 n 0.712 n ); a deterministic O(m 2 2 n 2 n/ log 2 n ) local search algorithm for SAT. - p. 9/23

Other work A related work done by other people is listed below. The means that we are going to see a faster algorithm and the means that we are going to see a slower algorithm. Problem Deter./Rand. (Expt.) time Faster? Misc. 3-SAT Rand. O(1.324 n ) 4-SAT Rand. O(1.474 n ) k-sat Rand. O(2 (1 µ k k 1 )n+o(n) ) k > 4, µ k k 3-SAT Deter. O(1.505 n ) k-sat Deter. O(2 (1 1 2k )n ) k 5, limit SAT Rand. O(m2 n n 1+log 2 m ) SAT Deter. O(2 n ) trivial π2 6 - p. 10/23

Hey, where s sums of products? Other work Hey, where s sums of products? What are the relations to the previous presentations? this is not exactly a sums-of-products-type of thing [Mikko Koivisto, initial lecture] complexity is not related to some hard-to-measure quality of input formula Then why? algorithmic techniques can be generalized to other problems as well - p. 11/23

- p. 12/23

Local search within Hamming balls Local search within Hamming balls Local search cont d An example of BALL-CHECKING Multistart local search Covering codes Given a formula F, an assignment A H n and a radius R. Does F have a satisfying assignment within B(A, R)? Check all assignments A B(A, R). But it takes O(mV (n, R)) time, which is quite much. Let s call this naïve method a FULL-BALL-CHECKING procedure - p. 13/23

Local search cont d Given a formula F and an assignment A H n, can we solve efficiently does F have a satisfying assignment within a Hamming ball of radius R centered in A? Yes, we can! In time O(mk R ). The simple algorithm BALL-CHECKING(F, A, R) is as follows: 1. If A satisfies F, return A; if R 0 or F contains an empty clause, return no. 2. Choose a shortest clause (l 1 l k ) in F that is falsified by A. 3. For i = 1... k Call BALL-CHECKING(F i, A i, R 1) where F i is F with l i set to and A i is obtained from A by flipping the value of l i. If this call returns an assignment, return it. 4. return no. - p. 14/23

An example of BALL-CHECKING Initial values: Local search within Hamming balls Local search cont d An example of BALL-CHECKING Multistart local search Covering codes F = (x 1 x 2 x 3 ) (x 4 x 5 x 6 ) ( x 1 x 2 x 6 ), A = (0, 0, 0, 0, 0, 0), R = 2 Select the first clause and make a recursive call Values after setting x 1 = : F 1 = ( x 2 x 3 ) (x 4 x 5 x 6 ) ( x 2 x 6 ) = (x 4 x 5 x 6 ) (x 2 x 6 ), A = (1, 0, 0, 0, 0, 0), R = 1 Set x 4 = and make a recursive call F 1,4 = ( x 5 x 6 ) (x 2 x 6 ) = (x 2 x 6 ) A 1,4 = (1, 0, 0, 1, 0, 0), R = 0 - p. 15/23

Multistart local search Local search within Hamming balls Local search cont d An example of BALL-CHECKING Multistart local search Covering codes Multistart local search is a simple technique: select a random initial solution perform a local search from that solution if, after some amount of steps, the algorithm has not found an answer, select another random initial solution iterate this for a fixed number of times or until an answer is found It is a common method if the local search may go further from the answer. Quality can be improved if the initial solutions are chosen cleverly. - p. 16/23

Covering codes What would be a clever initial solution for SAT? Local search within Hamming balls Local search cont d An example of BALL-CHECKING Multistart local search Covering codes Covering codes might do well Take a covering code C s.t. its radius R is small enough and it has few enough codes in it. Alas, such a covering code is a bit contradictory. But, for any n 1 and r, there exists a covering code C of length n, covering radius at most r, and size at most n2 n /V (n, r) n nρ(1 ρ) 2 (1 h(ρ))n Such covering code gives quite good initial solutions! Let s leave the construction of such codes (fast enough) as a homework but it can be done! - p. 17/23

- p. 18/23

An algorithm for k-sat An algorithm for k-sat A randomized algorithm for SAT A deterministic algorithm for SAT A figurative example The algorithm is as follows 1. Set ρ = 1/(k + 1) 2. Generate a covering code C of length n and radius at most ρn. 3. For each A C, run BALL-CHECKING(F, A, ρn). Return true if at least one call returns an assignment; otherwise return false. Generating C takes p(n) (2 3n/6 + 2 (1 h(ρ))n ) time, where p is a polynomial depending only on n. C consists of p(n) 2 (1 h(ρ))n balls with radius ρn. BALL-CHECKING takes p(n) k ρn time per ball. The algorithm works in time p(n) (2 2/(k + 1)) n. - p. 19/23

A randomized algorithm for SAT An algorithm for k-sat A randomized algorithm for SAT A deterministic algorithm for SAT A figurative example Given formula F and two numbers R and l such that 0 R l n, a random algorithm is 1. N = 8R(1 R/n) 2 n(1 h(r/n)). 2. Repeat N times: (a) Choose an assignment A uniformly at random. (b) If F contains a clause that has at least l literals falsified by A and at most R literals satisfied by A, invoke FULL-BALL-CHECKING(F, A, R); otherwise invoke BALL-CHECKING(F, A, R). If the invoked procedure finds a satisfying assignment, return yes. 3. Return no. With R = 0.339 n and l = 1.87 n, the expected running time of algorithm is at most p(n) m 2 2 n 0.712 n. - p. 20/23

A deterministic algorithm for SAT An algorithm for k-sat A randomized algorithm for SAT A deterministic algorithm for SAT A figurative example Given formula F and two numbers R and l such that 0 R l n, a deterministic algorithm is 1. Generate a covering code C of length n and radius at most R. 2. For each A C: (a) If F contains a clause that has at least l literals falsified by A and at most R literals satisfied by A, invoke FULL-BALL-CHECKING(F, A, R); otherwise invoke BALL-CHEKCING(F, A, R). If the invoked procedure finds a satisfying assignment, return yes. 3. return no. With R = 2 n and l = log 2 e log 2 e log 2 n 2 n log2 n, algorithm runs in time at most p(n) m 2 2 n 2 n/ log 2 n. - p. 21/23

A figurative example An algorithm for k-sat A randomized algorithm for SAT A deterministic algorithm for SAT A figurative example - p. 22/23

Thank You! - p. 23/23