CDCL SAT Solvers Joao Marques-Silva INESC-ID, IST, ULisbon, - - PowerPoint PPT Presentation

cdcl sat solvers
SMART_READER_LITE
LIVE PREVIEW

CDCL SAT Solvers Joao Marques-Silva INESC-ID, IST, ULisbon, - - PowerPoint PPT Presentation

CDCL SAT Solvers Joao Marques-Silva INESC-ID, IST, ULisbon, Portugal Theory and Practice of SAT Solving Dagstuhl Workshop April 2015 The Success of SAT Well-known NP-complete decision problem [C71] The Success of SAT Well-known


slide-1
SLIDE 1

CDCL SAT Solvers

Joao Marques-Silva

INESC-ID, IST, ULisbon, Portugal

Theory and Practice of SAT Solving Dagstuhl Workshop

April 2015

slide-2
SLIDE 2

The Success of SAT

  • Well-known NP-complete decision problem

[C71]

slide-3
SLIDE 3

The Success of SAT

  • Well-known NP-complete decision problem

[C71]

  • In practice, SAT is a success story of Computer Science

– Hundreds (even more?) of practical applications

slide-4
SLIDE 4

The Success of SAT

  • Well-known NP-complete decision problem

[C71]

  • In practice, SAT is a success story of Computer Science

– Hundreds (even more?) of practical applications

slide-5
SLIDE 5

SAT Solver Improvement

[Source: Le Berre&Biere 2011]

200 400 600 800 1000 1200 20 40 60 80 100 120 140 160 180 200 CPU Time (in seconds) Number of problems solved Results of the SAT competition/race winners on the SAT 2009 application benchmarks, 20mn timeout Limmat (2002) Zchaff (2002) Berkmin (2002) Forklift (2003) Siege (2003) Zchaff (2004) SatELite (2005) Minisat 2 (2006) Picosat (2007) Rsat (2007) Minisat 2.1 (2008) Precosat (2009) Glucose (2009) Clasp (2009) Cryptominisat (2010) Lingeling (2010) Minisat 2.2 (2010) Glucose 2 (2011) Glueminisat (2011) Contrasat (2011) Lingeling 587f (2011)

slide-6
SLIDE 6

SAT-Based Problem Solving

Problem Solving with SAT

Embeddings

PBO B&B Search Enumeration OPT SAT Lazy SMT LCG

Oracles

MaxSAT MUS MCS

  • Min. Mod-

els Backbones Enumeration CEGAR SMT CEGAR QBF MC: ic3

Encodings

MBD Eager SMT Planning BMC

slide-7
SLIDE 7

This Talk

  • Review key ideas in implementing CDCL SAT solvers

– Review standard concepts

◮ Unit propagation ◮ Resolution ◮ Proof traces ◮ ...

– Outline organization of DPLL/CDCL SAT solvers – Survey most effective techniques

◮ Clause learning & non-chronological bakctracking ◮ UIPs ◮ Clause minimization ◮ Search restarts ◮ Several heuristics ◮ ...

slide-8
SLIDE 8

Outline

Basic Definitions DPLL Solvers CDCL Solvers What Next in CDCL Solvers? CNF Encodings

slide-9
SLIDE 9

Outline

Basic Definitions DPLL Solvers CDCL Solvers What Next in CDCL Solvers? CNF Encodings

slide-10
SLIDE 10

Preliminaries

  • Variables: w, x, y, z, a, b, c, . . .
  • Literals: w, ¯

x, ¯ y, a, . . . , but also ¬w, ¬y, . . .

  • Clauses: disjunction of literals or set of literals
  • Formula: conjunction of clauses or set of clauses
  • Model (satisfying assignment): partial/total mapping from

variables to {0, 1} that satisfies formula

  • Formula can be SAT/UNSAT
slide-11
SLIDE 11

Preliminaries

  • Variables: w, x, y, z, a, b, c, . . .
  • Literals: w, ¯

x, ¯ y, a, . . . , but also ¬w, ¬y, . . .

  • Clauses: disjunction of literals or set of literals
  • Formula: conjunction of clauses or set of clauses
  • Model (satisfying assignment): partial/total mapping from

variables to {0, 1} that satisfies formula

  • Formula can be SAT/UNSAT
  • Example:

F (r) ∧ (¯ r ∨ s) ∧ ( ¯ w ∨ a) ∧ (¯ x ∨ b) ∧ (¯ y ∨ ¯ z ∨ c) ∧ (¯ b ∨ ¯ c ∨ d) – Example models:

◮ {r, s, a, b, c, d} ◮ {r, s, ¯

x, y, ¯ w, z, ¯ a, b, c, d}

slide-12
SLIDE 12

Resolution

  • Resolution rule:

[DP60,R65]

(α ∨ x) (β ∨ ¯ x) (α ∨ β) – Complete proof system for propositional logic

slide-13
SLIDE 13

Resolution

  • Resolution rule:

[DP60,R65]

(α ∨ x) (β ∨ ¯ x) (α ∨ β) – Complete proof system for propositional logic (x ∨ a) (¯ x ∨ a) (¯ y ∨ ¯ a) (y ∨ ¯ a) (a) (¯ a) ⊥ – Extensively used with (CDCL) SAT solvers

slide-14
SLIDE 14

Resolution

  • Resolution rule:

[DP60,R65]

(α ∨ x) (β ∨ ¯ x) (α ∨ β) – Complete proof system for propositional logic (x ∨ a) (¯ x ∨ a) (¯ y ∨ ¯ a) (y ∨ ¯ a) (a) (¯ a) ⊥ – Extensively used with (CDCL) SAT solvers

  • Self-subsuming resolution (with α′ ⊆ α):

[e.g. SP04,EB05]

(α ∨ x) (α′ ∨ ¯ x) (α) – (α) subsumes (α ∨ x)

slide-15
SLIDE 15

Unit Propagation

F = (r) ∧ (¯ r ∨ s)∧ ( ¯ w ∨ a) ∧ (¯ x ∨ ¯ a ∨ b) (¯ y ∨ ¯ z ∨ c) ∧ (¯ b ∨ ¯ c ∨ d)

slide-16
SLIDE 16

Unit Propagation

F = (r) ∧ (¯ r ∨ s)∧ ( ¯ w ∨ a) ∧ (¯ x ∨ ¯ a ∨ b) (¯ y ∨ ¯ z ∨ c) ∧ (¯ b ∨ ¯ c ∨ d)

  • Decisions / Variable Branchings:

w = 1, x = 1, y = 1, z = 1

slide-17
SLIDE 17

Unit Propagation

F = (r) ∧ (¯ r ∨ s)∧ ( ¯ w ∨ a) ∧ (¯ x ∨ ¯ a ∨ b) (¯ y ∨ ¯ z ∨ c) ∧ (¯ b ∨ ¯ c ∨ d)

  • Decisions / Variable Branchings:

w = 1, x = 1, y = 1, z = 1

Level Dec. Unit Prop. 1 2 3 4 ∅ w x y z a b c d r s

slide-18
SLIDE 18

Unit Propagation

F = (r) ∧ (¯ r ∨ s)∧ ( ¯ w ∨ a) ∧ (¯ x ∨ ¯ a ∨ b) (¯ y ∨ ¯ z ∨ c) ∧ (¯ b ∨ ¯ c ∨ d)

  • Decisions / Variable Branchings:

w = 1, x = 1, y = 1, z = 1

Level Dec. Unit Prop. 1 2 3 4 ∅ w x y z a b c d r s

  • Additional definitions:

– Antecedent (or reason) of an implied assignment

◮ (¯

b ∨ ¯ c ∨ d) for d

– Associate assignment with decision levels

◮ w = 1 @ 1, x = 1 @ 2, y = 1 @ 3, z = 1 @ 4 ◮ r = 1 @ 0, d = 1 @ 4, ...

slide-19
SLIDE 19

Resolution Proofs

  • Refutation of unsatisfiable formula by iterated resolution
  • perations produces resolution proof
  • An example:

F = (¯ c) ∧ (¯ b) ∧ (¯ a ∨ c) ∧ (a ∨ b) ∧ (a ∨ ¯ d) ∧ (¯ a ∨ ¯ d)

  • Resolution proof:

⊥ (¯ b) (b) (¯ c) (b ∨ c) (a ∨ b) (¯ a ∨ c)

  • A modern SAT solver can generate resolution proofs using clauses

learned by the solver

[ZM03]

slide-20
SLIDE 20

Unsatisfiable Cores & Proof Traces

  • CNF formula:

F = (¯ c) ∧ (¯ b) ∧ (¯ a ∨ c) ∧ (a ∨ b) ∧ (a ∨ ¯ d) ∧ (¯ a ∨ ¯ d)

Level Dec. Unit Prop. ∅ ¯ b ¯ c a ⊥

Implication graph with conflict

slide-21
SLIDE 21

Unsatisfiable Cores & Proof Traces

  • CNF formula:

F = (¯ c) ∧ (¯ b) ∧ (¯ a ∨ c) ∧ (a ∨ b) ∧ (a ∨ ¯ d) ∧ (¯ a ∨ ¯ d)

Level Dec. Unit Prop. ∅ ¯ b ¯ c a ⊥

Proof trace ⊥: (¯ a ∨ c) (a ∨ b) (¯ c) (¯ b)

slide-22
SLIDE 22

Unsatisfiable Cores & Proof Traces

  • CNF formula:

F = (¯ c) ∧ (¯ b) ∧ (¯ a ∨ c) ∧ (a ∨ b) ∧ (a ∨ ¯ d) ∧ (¯ a ∨ ¯ d)

Level Dec. Unit Prop. ∅ ¯ b ¯ c a ⊥ ⊥ (¯ b) (b) (¯ c) (b ∨ c) (a ∨ b) (¯ a ∨ c)

Resolution proof follows structure of conflicts

slide-23
SLIDE 23

Unsatisfiable Cores & Proof Traces

  • CNF formula:

F = (¯ c) ∧ (¯ b) ∧ (¯ a ∨ c) ∧ (a ∨ b) ∧ (a ∨ ¯ d) ∧ (¯ a ∨ ¯ d)

Level Dec. Unit Prop. ∅ ¯ b ¯ c a ⊥ ⊥ (¯ b) (b) (¯ c) (b ∨ c) (a ∨ b) (¯ a ∨ c)

Unsatisfiable subformula (core): (¯ c), (¯ b), (¯ a ∨ c), (a ∨ b)

slide-24
SLIDE 24

Outline

Basic Definitions DPLL Solvers CDCL Solvers What Next in CDCL Solvers? CNF Encodings

slide-25
SLIDE 25

The DPLL Algorithm

Assign value to variable Unassigned variables ? Unit propagation Conflict ? Can undo decision ? Backtrack & flip variable Unsatisfiable Satisfiable Y N Y N Y N

  • Optional: pure literal rule
slide-26
SLIDE 26

The DPLL Algorithm

Assign value to variable Unassigned variables ? Unit propagation Conflict ? Can undo decision ? Backtrack & flip variable Unsatisfiable Satisfiable Y N Y N Y N

  • Optional: pure literal rule

F = (x∨y)∧(a∨b)∧(¯ a∨b)∧(a∨¯ b)∧(¯ a∨¯ b)

slide-27
SLIDE 27

The DPLL Algorithm

Assign value to variable Unassigned variables ? Unit propagation Conflict ? Can undo decision ? Backtrack & flip variable Unsatisfiable Satisfiable Y N Y N Y N

  • Optional: pure literal rule

F = (x∨y)∧(a∨b)∧(¯ a∨b)∧(a∨¯ b)∧(¯ a∨¯ b)

Level Dec. Unit Prop. 1 2 3 ∅ x y a b ⊥ a ¯ a y a ¯ a ¯ y x a ¯ a ¯ x

slide-28
SLIDE 28

The DPLL Algorithm

Assign value to variable Unassigned variables ? Unit propagation Conflict ? Can undo decision ? Backtrack & flip variable Unsatisfiable Satisfiable Y N Y N Y N

  • Optional: pure literal rule

F = (x∨y)∧(a∨b)∧(¯ a∨b)∧(a∨¯ b)∧(¯ a∨¯ b)

Level Dec. Unit Prop. 1 2 3 ∅ x y ¯ a ¯ b ⊥ a ¯ a y a ¯ a ¯ y x a ¯ a ¯ x

slide-29
SLIDE 29

The DPLL Algorithm

Assign value to variable Unassigned variables ? Unit propagation Conflict ? Can undo decision ? Backtrack & flip variable Unsatisfiable Satisfiable Y N Y N Y N

  • Optional: pure literal rule

F = (x∨y)∧(a∨b)∧(¯ a∨b)∧(a∨¯ b)∧(¯ a∨¯ b)

Level Dec. Unit Prop. 1 2 3 ∅ x ¯ y a b ⊥ a ¯ a y a ¯ a ¯ y x a ¯ a ¯ x

slide-30
SLIDE 30

The DPLL Algorithm

Assign value to variable Unassigned variables ? Unit propagation Conflict ? Can undo decision ? Backtrack & flip variable Unsatisfiable Satisfiable Y N Y N Y N

  • Optional: pure literal rule

F = (x∨y)∧(a∨b)∧(¯ a∨b)∧(a∨¯ b)∧(¯ a∨¯ b)

Level Dec. Unit Prop. 1 2 3 ∅ x ¯ y ¯ a ¯ b ⊥ a ¯ a y a ¯ a ¯ y x a ¯ a ¯ x

slide-31
SLIDE 31

The DPLL Algorithm

Assign value to variable Unassigned variables ? Unit propagation Conflict ? Can undo decision ? Backtrack & flip variable Unsatisfiable Satisfiable Y N Y N Y N

  • Optional: pure literal rule

F = (x∨y)∧(a∨b)∧(¯ a∨b)∧(a∨¯ b)∧(¯ a∨¯ b)

Level Dec. Unit Prop. 1 2 ∅ ¯ x a y b ⊥ a ¯ a y a ¯ a ¯ y x a ¯ a ¯ x

slide-32
SLIDE 32

The DPLL Algorithm

Assign value to variable Unassigned variables ? Unit propagation Conflict ? Can undo decision ? Backtrack & flip variable Unsatisfiable Satisfiable Y N Y N Y N

  • Optional: pure literal rule

F = (x∨y)∧(a∨b)∧(¯ a∨b)∧(a∨¯ b)∧(¯ a∨¯ b)

Level Dec. Unit Prop. 1 2 ∅ ¯ x ¯ a y ¯ b ⊥ a ¯ a y a ¯ a ¯ y x a ¯ a ¯ x

slide-33
SLIDE 33

Outline

Basic Definitions DPLL Solvers CDCL Solvers What Next in CDCL Solvers? CNF Encodings

slide-34
SLIDE 34

What is a CDCL SAT Solver?

  • Extend DPLL SAT solver with:

[DP60,DLL62]

– Clause learning & non-chronological backtracking

[MSS96,BS97,Z97]

– Search restarts

[GSK98,BMS00,H07,B08]

– Lazy data structures – Conflict-guided branching – ...

slide-35
SLIDE 35

What is a CDCL SAT Solver?

  • Extend DPLL SAT solver with:

[DP60,DLL62]

– Clause learning & non-chronological backtracking

[MSS96,BS97,Z97] ◮ Exploit UIPs [MSS96,SSS12] ◮ Minimize learned clauses [SB09,VG09] ◮ Opportunistically delete clauses [MSS96,MSS99,GN02]

– Search restarts

[GSK98,BMS00,H07,B08]

– Lazy data structures

◮ Watched literals [MMZZM01]

– Conflict-guided branching

◮ Lightweight branching heuristics [MMZZM01] ◮ Phase saving [PD07]

– ...

slide-36
SLIDE 36

How Significant are CDCL SAT Solvers?

200 400 600 800 1000 1200 20 40 60 80 100 120 140 160 180 200 CPU Time (in seconds) Number of problems solved Results of the SAT competition/race winners on the SAT 2009 application benchmarks, 20mn timeout Limmat (2002) Zchaff (2002) Berkmin (2002) Forklift (2003) Siege (2003) Zchaff (2004) SatELite (2005) Minisat 2 (2006) Picosat (2007) Rsat (2007) Minisat 2.1 (2008) Precosat (2009) Glucose (2009) Clasp (2009) Cryptominisat (2010) Lingeling (2010) Minisat 2.2 (2010) Glucose 2 (2011) Glueminisat (2011) Contrasat (2011) Lingeling 587f (2011)

GRASP DPLL

? ?

slide-37
SLIDE 37

Outline

Basic Definitions DPLL Solvers CDCL Solvers Clause Learning, UIPs & Minimization Search Restarts & Lazy Data Structures What Next in CDCL Solvers? CNF Encodings

slide-38
SLIDE 38

Clause Learning

Level Dec. Unit Prop. 1 2 3 ∅ x x y z z a b ⊥

slide-39
SLIDE 39

Clause Learning

Level Dec. Unit Prop. 1 2 3 ∅ x x y z z a b ⊥

  • Analyze conflict
slide-40
SLIDE 40

Clause Learning

Level Dec. Unit Prop. 1 2 3 ∅ x y z a b ⊥

  • Analyze conflict

– Reasons: x and z

◮ Decision variable & literals assigned at lower decision levels

slide-41
SLIDE 41

Clause Learning

Level Dec. Unit Prop. 1 2 3 ∅ x y z a b ⊥

  • Analyze conflict

– Reasons: x and z

◮ Decision variable & literals assigned at lower decision levels

– Create new clause: (¯ x ∨ ¯ z)

slide-42
SLIDE 42

Clause Learning

Level Dec. Unit Prop. 1 2 3 ∅ x y z a b ⊥ (¯ a ∨ ¯ b) (¯ z ∨ b) (¯ x ∨ ¯ z ∨ a) (¯ a ∨ ¯ z) (¯ x ∨ ¯ z)

  • Analyze conflict

– Reasons: x and z

◮ Decision variable & literals assigned at lower decision levels

– Create new clause: (¯ x ∨ ¯ z)

  • Can relate clause learning with resolution
slide-43
SLIDE 43

Clause Learning

Level Dec. Unit Prop. 1 2 3 ∅ x y z a b ⊥ (¯ a ∨ ¯ b) (¯ z ∨ b) (¯ x ∨ ¯ z ∨ a) (¯ a ∨ ¯ z) (¯ x ∨ ¯ z)

  • Analyze conflict

– Reasons: x and z

◮ Decision variable & literals assigned at lower decision levels

– Create new clause: (¯ x ∨ ¯ z)

  • Can relate clause learning with resolution
slide-44
SLIDE 44

Clause Learning

Level Dec. Unit Prop. 1 2 3 ∅ x y z a b ⊥ (¯ a ∨ ¯ b) (¯ z ∨ b) (¯ x ∨ ¯ z ∨ a) (¯ a ∨ ¯ z) (¯ x ∨ ¯ z)

  • Analyze conflict

– Reasons: x and z

◮ Decision variable & literals assigned at lower decision levels

– Create new clause: (¯ x ∨ ¯ z)

  • Can relate clause learning with resolution
slide-45
SLIDE 45

Clause Learning

Level Dec. Unit Prop. 1 2 3 ∅ x y z a b ⊥ (¯ a ∨ ¯ b) (¯ z ∨ b) (¯ x ∨ ¯ z ∨ a) (¯ a ∨ ¯ z) (¯ x ∨ ¯ z)

  • Analyze conflict

– Reasons: x and z

◮ Decision variable & literals assigned at lower decision levels

– Create new clause: (¯ x ∨ ¯ z)

  • Can relate clause learning with resolution

– Learned clauses result from (selected) resolution operations

slide-46
SLIDE 46

Clause Learning – After Backtracking

Level Dec. Unit Prop. 1 2 3 ∅ x y z z a b ⊥ z

slide-47
SLIDE 47

Clause Learning – After Backtracking

Level Dec. Unit Prop. 1 2 3 ∅ x y z a b ⊥ z

  • Clause (¯

x ∨ ¯ z) is asserting at decision level 1

slide-48
SLIDE 48

Clause Learning – After Backtracking

Level Dec. Unit Prop. 1 2 3 ∅ x y z a b ⊥ z Level Dec. Unit Prop. 1 ∅ x ¯ z

  • Clause (¯

x ∨ ¯ z) is asserting at decision level 1

slide-49
SLIDE 49

Clause Learning – After Backtracking

Level Dec. Unit Prop. 1 2 3 ∅ x y z a b ⊥ z Level Dec. Unit Prop. 1 ∅ x ¯ z

  • Clause (¯

x ∨ ¯ z) is asserting at decision level 1

  • Learned clauses are always asserting

[MSS96,MSS99]

  • Backtracking differs from plain DPLL:

– Always bactrack after a conflict

[MMZZM01]

slide-50
SLIDE 50

Unique Implication Points (UIPs)

Level Dec. Unit Prop. 1 2 3 4 ∅ w w x y z a b ⊥ c

slide-51
SLIDE 51

Unique Implication Points (UIPs)

Level Dec. Unit Prop. 1 2 3 4 ∅ w x x y y z z a b ⊥ c (¯ b ∨ ¯ c) ( ¯ w ∨ ¯ a ∨ c) (¯ x ∨ ¯ a ∨ b) (¯ y ∨ ¯ z ∨ a) ( ¯ w ∨ ¯ a ∨ ¯ b) ( ¯ w ∨ ¯ x ∨ ¯ y ∨ ¯ z) ( ¯ w ∨ ¯ x ∨ ¯ a) ( ¯ w ∨ ¯ x ∨ ¯ a)

  • Learn clause ( ¯

w ∨ ¯ x ∨ ¯ y ∨ ¯ z)

slide-52
SLIDE 52

Unique Implication Points (UIPs)

Level Dec. Unit Prop. 1 2 3 4 ∅ w x x y y z z a a b ⊥ c (¯ b ∨ ¯ c) ( ¯ w ∨ ¯ a ∨ c) (¯ x ∨ ¯ a ∨ b) (¯ y ∨ ¯ z ∨ a) ( ¯ w ∨ ¯ a ∨ ¯ b) ( ¯ w ∨ ¯ x ∨ ¯ y ∨ ¯ z) ( ¯ w ∨ ¯ x ∨ ¯ a) ( ¯ w ∨ ¯ x ∨ ¯ a)

  • Learn clause ( ¯

w ∨ ¯ x ∨ ¯ y ∨ ¯ z)

  • But a is an UIP

– Dominator in DAG for level 4

slide-53
SLIDE 53

Unique Implication Points (UIPs)

Level Dec. Unit Prop. 1 2 3 4 ∅ w x y z a b ⊥ c (¯ b ∨ ¯ c) ( ¯ w ∨ ¯ a ∨ c) (¯ x ∨ ¯ a ∨ b) (¯ y ∨ ¯ z ∨ a) ( ¯ w ∨ ¯ a ∨ ¯ b) ( ¯ w ∨ ¯ x ∨ ¯ y ∨ ¯ z) ( ¯ w ∨ ¯ x ∨ ¯ a) ( ¯ w ∨ ¯ x ∨ ¯ a)

  • Learn clause ( ¯

w ∨ ¯ x ∨ ¯ y ∨ ¯ z)

  • But a is an UIP

– Dominator in DAG for level 4

  • Learn clause ( ¯

w ∨ ¯ x ∨ ¯ a)

slide-54
SLIDE 54

Multiple UIPs

Level Dec. Unit Prop. 1 2 3 4 ∅ w w x y z r s a a b ⊥ c

slide-55
SLIDE 55

Multiple UIPs

Level Dec. Unit Prop. 1 2 3 4 ∅ w x y y z r s a b ⊥ c

  • First UIP:

– Learn clause ( ¯ w ∨ ¯ x ∨ ¯ a)

slide-56
SLIDE 56

Multiple UIPs

Level Dec. Unit Prop. 1 2 3 4 ∅ w x x y y z r s a b ⊥ c

  • First UIP:

– Learn clause ( ¯ w ∨ ¯ x ∨ ¯ a)

  • But there can be more than 1

UIP

slide-57
SLIDE 57

Multiple UIPs

Level Dec. Unit Prop. 1 2 3 4 ∅ w x y z r s a b ⊥ c

  • First UIP:

– Learn clause ( ¯ w ∨ ¯ x ∨ ¯ a)

  • But there can be more than 1

UIP

  • Second UIP:

– Learn clause (¯ x ∨ ¯ z ∨ a)

slide-58
SLIDE 58

Multiple UIPs

Level Dec. Unit Prop. 1 2 3 4 ∅ w x y z r s a b ⊥ c

  • First UIP:

– Learn clause ( ¯ w ∨ ¯ x ∨ ¯ a)

  • But there can be more than 1

UIP

  • Second UIP:

– Learn clause (¯ x ∨ ¯ z ∨ a)

  • In practice smaller clauses more

effective

– Compare with ( ¯ w ∨ ¯ x ∨ ¯ y ∨ ¯ z)

slide-59
SLIDE 59

Multiple UIPs

Level Dec. Unit Prop. 1 2 3 4 ∅ w x y z r s a b ⊥ c

  • First UIP:

– Learn clause ( ¯ w ∨ ¯ x ∨ ¯ a)

  • But there can be more than 1

UIP

  • Second UIP:

– Learn clause (¯ x ∨ ¯ z ∨ a)

  • In practice smaller clauses more

effective

– Compare with ( ¯ w ∨ ¯ x ∨ ¯ y ∨ ¯ z)

  • Multiple UIPs proposed in GRASP

[MSS96]

– First UIP learning proposed in Chaff

[MMZZM01]

  • Not used in recent state of the art CDCL SAT solvers
slide-60
SLIDE 60

Multiple UIPs

Level Dec. Unit Prop. 1 2 3 4 ∅ w x y z r s a b ⊥ c

  • First UIP:

– Learn clause ( ¯ w ∨ ¯ x ∨ ¯ a)

  • But there can be more than 1

UIP

  • Second UIP:

– Learn clause (¯ x ∨ ¯ z ∨ a)

  • In practice smaller clauses more

effective

– Compare with ( ¯ w ∨ ¯ x ∨ ¯ y ∨ ¯ z)

  • Multiple UIPs proposed in GRASP

[MSS96]

– First UIP learning proposed in Chaff

[MMZZM01]

  • Not used in recent state of the art CDCL SAT solvers
  • Recent results show it can be beneficial on current instances

[SSS12]

slide-61
SLIDE 61

Clause Minimization I

Level Dec. Unit Prop. 1 2 3 ∅ x x y z c b b a ⊥

slide-62
SLIDE 62

Clause Minimization I

Level Dec. Unit Prop. 1 2 3 ∅ x y y z z c b a ⊥ (¯ a ∨ ¯ c) (¯ z ∨ ¯ b ∨ c) (¯ x ∨ ¯ y ∨ ¯ z ∨ a) (¯ z ∨ ¯ b ∨ ¯ a) (¯ x ∨ ¯ y ∨ ¯ z ∨ ¯ b)

  • Learn clause (¯

x ∨ ¯ y ∨ ¯ z ∨ ¯ b)

slide-63
SLIDE 63

Clause Minimization I

Level Dec. Unit Prop. 1 2 3 ∅ x y y z z c b a ⊥ (¯ a ∨ ¯ c) (¯ z ∨ ¯ b ∨ c) (¯ x ∨ ¯ y ∨ ¯ z ∨ a) (¯ z ∨ ¯ b ∨ ¯ a) (¯ x ∨ ¯ y ∨ ¯ z ∨ ¯ b) (¯ x ∨ b)

  • Learn clause (¯

x ∨ ¯ y ∨ ¯ z ∨ ¯ b)

  • Apply self-subsuming resolution (i.e. local minimization)

[SB09]

slide-64
SLIDE 64

Clause Minimization I

Level Dec. Unit Prop. 1 2 3 ∅ x y z c b a ⊥ (¯ a ∨ ¯ c) (¯ z ∨ ¯ b ∨ c) (¯ x ∨ ¯ y ∨ ¯ z ∨ a) (¯ z ∨ ¯ b ∨ ¯ a) (¯ x ∨ ¯ y ∨ ¯ z ∨ ¯ b) (¯ x ∨ b) (¯ x ∨ ¯ y ∨ ¯ z)

  • Learn clause (¯

x ∨ ¯ y ∨ ¯ z ∨ ¯ b)

  • Apply self-subsuming resolution (i.e. local minimization)
slide-65
SLIDE 65

Clause Minimization I

Level Dec. Unit Prop. 1 2 3 ∅ x y z c b a ⊥ (¯ a ∨ ¯ c) (¯ z ∨ ¯ b ∨ c) (¯ x ∨ ¯ y ∨ ¯ z ∨ a) (¯ z ∨ ¯ b ∨ ¯ a) (¯ x ∨ ¯ y ∨ ¯ z ∨ ¯ b) (¯ x ∨ b) (¯ x ∨ ¯ y ∨ ¯ z)

  • Learn clause (¯

x ∨ ¯ y ∨ ¯ z ∨ ¯ b)

  • Apply self-subsuming resolution (i.e. local minimization)
  • Learn clause (¯

x ∨ ¯ y ∨ ¯ z)

slide-66
SLIDE 66

Clause Minimization II

Level Dec. Unit Prop. 1 2 ∅ w w a b c c x e d ⊥

slide-67
SLIDE 67

Clause Minimization II

Level Dec. Unit Prop. 1 2 ∅ w a b c x x e d ⊥

  • Learn clause ( ¯

w ∨ ¯ x ∨ ¯ c)

slide-68
SLIDE 68

Clause Minimization II

Level Dec. Unit Prop. 1 2 ∅ w a b c x x e d ⊥

  • Learn clause ( ¯

w ∨ ¯ x ∨ ¯ c)

  • Cannot apply self-subsuming

resolution

– Resolving with reason of c yields ( ¯ w ∨ ¯ x ∨ ¯ a ∨ ¯ b)

slide-69
SLIDE 69

Clause Minimization II

Level Dec. Unit Prop. 1 2 ∅ w a b c x x e d ⊥

  • Learn clause ( ¯

w ∨ ¯ x ∨ ¯ c)

  • Cannot apply self-subsuming

resolution

– Resolving with reason of c yields ( ¯ w ∨ ¯ x ∨ ¯ a ∨ ¯ b)

  • Can apply recursive minimization
slide-70
SLIDE 70

Clause Minimization II

Level Dec. Unit Prop. 1 2 ∅ w a b c x x e d ⊥

  • Learn clause ( ¯

w ∨ ¯ x ∨ ¯ c)

  • Cannot apply self-subsuming

resolution

– Resolving with reason of c yields ( ¯ w ∨ ¯ x ∨ ¯ a ∨ ¯ b)

  • Can apply recursive minimization
  • Marked nodes: literals in learned clause

[SB09]

slide-71
SLIDE 71

Clause Minimization II

Level Dec. Unit Prop. 1 2 ∅ w a b c x e d ⊥

  • Learn clause ( ¯

w ∨ ¯ x ∨ ¯ c)

  • Cannot apply self-subsuming

resolution

– Resolving with reason of c yields ( ¯ w ∨ ¯ x ∨ ¯ a ∨ ¯ b)

  • Can apply recursive minimization
  • Marked nodes: literals in learned clause

[SB09]

  • Trace back from c until marked nodes or new decision nodes

– Drop literal c if only marked nodes visited

slide-72
SLIDE 72

Clause Minimization II

Level Dec. Unit Prop. 1 2 ∅ w a b c x e d ⊥

  • Learn clause ( ¯

w ∨ ¯ x ∨ ¯ c)

  • Cannot apply self-subsuming

resolution

– Resolving with reason of c yields ( ¯ w ∨ ¯ x ∨ ¯ a ∨ ¯ b)

  • Can apply recursive minimization
  • Learn clause ( ¯

w ∨ ¯ x)

  • Marked nodes: literals in learned clause

[SB09]

  • Trace back from c until marked nodes or new decision nodes

– Drop literal c if only marked nodes visited

slide-73
SLIDE 73

Clause Minimization II

Level Dec. Unit Prop. 1 2 ∅ w a b c x e d ⊥

  • Learn clause ( ¯

w ∨ ¯ x ∨ ¯ c)

  • Cannot apply self-subsuming

resolution

– Resolving with reason of c yields ( ¯ w ∨ ¯ x ∨ ¯ a ∨ ¯ b)

  • Can apply recursive minimization
  • Learn clause ( ¯

w ∨ ¯ x)

  • Marked nodes: literals in learned clause

[SB09]

  • Trace back from c until marked nodes or new decision nodes

– Drop literal c if only marked nodes visited

  • Complexity of recursive minimization?
slide-74
SLIDE 74

Outline

Basic Definitions DPLL Solvers CDCL Solvers Clause Learning, UIPs & Minimization Search Restarts & Lazy Data Structures What Next in CDCL Solvers? CNF Encodings

slide-75
SLIDE 75

Search Restarts I

  • Heavy-tail behavior:

[GSK98]

– 10000 runs, branching randomization on industrial instance

  • Use rapid randomized restarts (search restarts)
slide-76
SLIDE 76

Search Restarts II

  • Restart search after a number
  • f conflicts

solution cutoff cutoff

slide-77
SLIDE 77

Search Restarts II

  • Restart search after a number
  • f conflicts
  • Increase cutoff after each

restart

– Guarantees completeness – Different policies exist (see refs)

solution cutoff cutoff

slide-78
SLIDE 78

Search Restarts II

  • Restart search after a number
  • f conflicts
  • Increase cutoff after each

restart

– Guarantees completeness – Different policies exist (see refs)

  • Works for SAT & UNSAT
  • instances. Why?

solution cutoff cutoff

slide-79
SLIDE 79

Search Restarts II

  • Restart search after a number
  • f conflicts
  • Increase cutoff after each

restart

– Guarantees completeness – Different policies exist (see refs)

  • Works for SAT & UNSAT
  • instances. Why?
  • Learned clauses effective after

restart(s)

slide-80
SLIDE 80

Data Structures Basics

  • Each literal l should access clauses containing l

– Why?

slide-81
SLIDE 81

Data Structures Basics

  • Each literal l should access clauses containing l

– Why? Unit propagation

slide-82
SLIDE 82

Data Structures Basics

  • Each literal l should access clauses containing l

– Why? Unit propagation

  • Clause with k literals results in k references, from literals to the

clause

slide-83
SLIDE 83

Data Structures Basics

  • Each literal l should access clauses containing l

– Why? Unit propagation

  • Clause with k literals results in k references, from literals to the

clause

  • Number of clause references equals number of literals, L
slide-84
SLIDE 84

Data Structures Basics

  • Each literal l should access clauses containing l

– Why? Unit propagation

  • Clause with k literals results in k references, from literals to the

clause

  • Number of clause references equals number of literals, L

– Clause learning can generate large clauses

◮ Worst-case size: O(n)

slide-85
SLIDE 85

Data Structures Basics

  • Each literal l should access clauses containing l

– Why? Unit propagation

  • Clause with k literals results in k references, from literals to the

clause

  • Number of clause references equals number of literals, L

– Clause learning can generate large clauses

◮ Worst-case size: O(n)

– Worst-case number of literals: O(m n)

slide-86
SLIDE 86

Data Structures Basics

  • Each literal l should access clauses containing l

– Why? Unit propagation

  • Clause with k literals results in k references, from literals to the

clause

  • Number of clause references equals number of literals, L

– Clause learning can generate large clauses

◮ Worst-case size: O(n)

– Worst-case number of literals: O(m n) – In practice,

Unit propagation slow-down worse than linear as clauses are learned !

slide-87
SLIDE 87

Data Structures Basics

  • Each literal l should access clauses containing l

– Why? Unit propagation

  • Clause with k literals results in k references, from literals to the

clause

  • Number of clause references equals number of literals, L

– Clause learning can generate large clauses

◮ Worst-case size: O(n)

– Worst-case number of literals: O(m n) – In practice,

Unit propagation slow-down worse than linear as clauses are learned !

  • Clause learning to be effective requires a more efficient

representation:

slide-88
SLIDE 88

Data Structures Basics

  • Each literal l should access clauses containing l

– Why? Unit propagation

  • Clause with k literals results in k references, from literals to the

clause

  • Number of clause references equals number of literals, L

– Clause learning can generate large clauses

◮ Worst-case size: O(n)

– Worst-case number of literals: O(m n) – In practice,

Unit propagation slow-down worse than linear as clauses are learned !

  • Clause learning to be effective requires a more efficient

representation: Watched Literals

slide-89
SLIDE 89

Data Structures Basics

  • Each literal l should access clauses containing l

– Why? Unit propagation

  • Clause with k literals results in k references, from literals to the

clause

  • Number of clause references equals number of literals, L

– Clause learning can generate large clauses

◮ Worst-case size: O(n)

– Worst-case number of literals: O(m n) – In practice,

Unit propagation slow-down worse than linear as clauses are learned !

  • Clause learning to be effective requires a more efficient

representation: Watched Literals

– Watched literals are one example of lazy data structures

◮ But there are others

slide-90
SLIDE 90

Watched Literals

[MMZZM01]

  • Important states of a clause
slide-91
SLIDE 91

Watched Literals

[MMZZM01]

  • Important states of a clause
  • Associate 2 references with

each clause

slide-92
SLIDE 92

Watched Literals

[MMZZM01]

  • Important states of a clause
  • Associate 2 references with

each clause

  • Deciding unit requires

traversing all literals

slide-93
SLIDE 93

Watched Literals

[MMZZM01]

  • Important states of a clause
  • Associate 2 references with

each clause

  • Deciding unit requires

traversing all literals

  • References unchanged when

backtracking

slide-94
SLIDE 94

Watched Literals, in Practice

[ES03,G13]

  • In practice, first two positions
  • f clause are watched

Fixed Assign watched Assign watched Swap Swap

slide-95
SLIDE 95

Watched Literals, in Practice

[ES03,G13]

  • In practice, first two positions
  • f clause are watched
  • May require to traverse already

assigned literals, multiple times

Fixed Assign watched Assign watched Swap Swap

slide-96
SLIDE 96

Watched Literals, in Practice

[ES03,G13]

  • In practice, first two positions
  • f clause are watched
  • May require to traverse already

assigned literals, multiple times

  • Worst-case time of unit

propagation is quadratic on clause size and so on number

  • f literals

Fixed Assign watched Assign watched Swap Swap

slide-97
SLIDE 97

Watched Literals, in Practice

[ES03,G13]

  • In practice, first two positions
  • f clause are watched
  • May require to traverse already

assigned literals, multiple times

  • Worst-case time of unit

propagation is quadratic on clause size and so on number

  • f literals
  • In practice, no gains observed

from considering alternative implementations (see previous slide)

Fixed Assign watched Assign watched Swap Swap

slide-98
SLIDE 98

Additional Key Techniques

  • Lightweight branching

[e.g. MMZZM01]

– Use conflict to bias variables to branch on, associate score with each variable – Prefer recent bias by regularly decreasing variable scores

slide-99
SLIDE 99

Additional Key Techniques

  • Lightweight branching

[e.g. MMZZM01]

– Use conflict to bias variables to branch on, associate score with each variable – Prefer recent bias by regularly decreasing variable scores

  • Clause deletion policies

– Not practical to keep all learned clauses – Delete larger clauses

[e.g. MSS96]

– Delete less used clauses

[e.g. GN02,ES03]

slide-100
SLIDE 100

Additional Key Techniques

  • Lightweight branching

[e.g. MMZZM01]

– Use conflict to bias variables to branch on, associate score with each variable – Prefer recent bias by regularly decreasing variable scores

  • Clause deletion policies

– Not practical to keep all learned clauses – Delete larger clauses

[e.g. MSS96]

– Delete less used clauses

[e.g. GN02,ES03]

  • Proven recent techniques:

– Phase saving

[PD07]

– Luby restarts

[H07]

– Literal blocks distance

[AS09]

slide-101
SLIDE 101

Outline

Basic Definitions DPLL Solvers CDCL Solvers What Next in CDCL Solvers? CNF Encodings

slide-102
SLIDE 102

CDCL – A Glimpse of the Future

  • Clause learning techniques

[e.g. ABHJS08]

– Clause learning is the key technique in CDCL SAT solvers – Many recent papers propose improvements to the basic clause learning approach

slide-103
SLIDE 103

CDCL – A Glimpse of the Future

  • Clause learning techniques

[e.g. ABHJS08]

– Clause learning is the key technique in CDCL SAT solvers – Many recent papers propose improvements to the basic clause learning approach

  • Preprocessing & inprocessing

– Many recent papers

[e.g. JHB12,HJB11]

– Essential in some applications

slide-104
SLIDE 104

CDCL – A Glimpse of the Future

  • Clause learning techniques

[e.g. ABHJS08]

– Clause learning is the key technique in CDCL SAT solvers – Many recent papers propose improvements to the basic clause learning approach

  • Preprocessing & inprocessing

– Many recent papers

[e.g. JHB12,HJB11]

– Essential in some applications

  • Application-driven improvements

– Incremental SAT

◮ Handling of assumptions due to MUS extractors [LB13] ◮ Changing SAT solvers to better suit applications [AS13]

slide-105
SLIDE 105

But Also, SAT-Based Problem Solving

Problem Solving with SAT

Embeddings

PBO B&B Search Enumeration OPT SAT Lazy SMT LCG

Oracles

MaxSAT MUS MCS

  • Min. Mod-

els Backbones Enumeration CEGAR SMT CEGAR QBF MC: ic3

Encodings

MBD Eager SMT Planning BMC

slide-106
SLIDE 106

Outline

Basic Definitions DPLL Solvers CDCL Solvers What Next in CDCL Solvers? CNF Encodings

slide-107
SLIDE 107

Outline

Basic Definitions DPLL Solvers CDCL Solvers What Next in CDCL Solvers? CNF Encodings

slide-108
SLIDE 108

Encoding to CNF

  • What to encode?

– Boolean formulas

◮ Tseitin’s encoding ◮ Plaisted&Greenbaum’s encoding ◮ ...

– Cardinality constraints – Pseudo-Boolean (PB) constraints – Can also translate to SAT:

◮ Constraint Satisfaction Problems (CSPs) ◮ Answer Set Programming (ASP) ◮ Model Finding ◮ ...

  • Key issues:

– Encoding size – Arc-consistency?

slide-109
SLIDE 109

Outline

Basic Definitions DPLL Solvers CDCL Solvers What Next in CDCL Solvers? CNF Encodings Boolean Formulas Cardinality Constraints Pseudo-Boolean Constraints Encoding CSPs

slide-110
SLIDE 110

Representing Boolean Formulas / Circuits I

  • Satisfiability problems can be defined on Boolean circuits/formulas
  • Can represent circuits/formulas as CNF formulas

[T68,PG86]

– For each (simple) gate, CNF formula encodes the consistent assignments to the gate’s inputs and output

◮ Given z = OP(x, y), represent in CNF z ↔ OP(x, y)

– CNF formula for the circuit is the conjunction of CNF formula for each gate

Fc = (a ∨ c) ∧ (b ∨ c) ∧ (¯ a ∨ ¯ b ∨ ¯ c) Ft = (¯ r ∨ t) ∧ (¯ s ∨ t) ∧ (r ∨ s ∨ ¯ t)

NAND OR

a b c r s t

slide-111
SLIDE 111

Representing Boolean Formulas / Circuits II

NAND

a b c

ab c 00 01 11 10 1 1 1 1 1 a b c Fc(a,b,c) 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Fc = (a ∨ c) ∧ (b ∨ c) ∧ (¯ a ∨ ¯ b ∨ ¯ c)

slide-112
SLIDE 112

Representing Boolean Formulas / Circuits III

  • CNF formula for the circuit is the conjunction of the CNF formula

for each gate

– Can specify objectives with additional clauses

NAND AND OR

a b c d x y z = 1?

F = (a ∨ x) ∧ (b ∨ x) ∧ (¯ a ∨ ¯ b ∨ ¯ x) ∧ (x ∨ ¯ y) ∧ (c ∨ ¯ y) ∧ (¯ x ∨ ¯ c ∨ y) ∧ (¯ y ∨ z) ∧ ( ¯ d ∨ z) ∧ (y ∨ d ∨ ¯ z) ∧ (z)

slide-113
SLIDE 113

Representing Boolean Formulas / Circuits III

  • CNF formula for the circuit is the conjunction of the CNF formula

for each gate

– Can specify objectives with additional clauses

NAND AND OR

a b c d x y z = 1?

F = (a ∨ x) ∧ (b ∨ x) ∧ (¯ a ∨ ¯ b ∨ ¯ x) ∧ (x ∨ ¯ y) ∧ (c ∨ ¯ y) ∧ (¯ x ∨ ¯ c ∨ y) ∧ (¯ y ∨ z) ∧ ( ¯ d ∨ z) ∧ (y ∨ d ∨ ¯ z) ∧ (z)

  • Note: z = d ∨ (c ∧ (¬(a ∧ b)))

– No distinction between Boolean circuits and formulas

slide-114
SLIDE 114

Outline

Basic Definitions DPLL Solvers CDCL Solvers What Next in CDCL Solvers? CNF Encodings Boolean Formulas Cardinality Constraints Pseudo-Boolean Constraints Encoding CSPs

slide-115
SLIDE 115

Cardinality Constraints

  • How to handle cardinality constraints, n

j=1 xj ≤ k ?

– How to handle AtMost1 constraints, n

j=1 xj ≤ 1 ?

– General form: n

j=1 xj ⊲

⊳ k, with ⊲ ⊳ ∈ {<, ≤, =, ≥, >}

  • Solution #1:

– Use native PB solver, e.g. BSOLO, PBS, Galena, Pueblo, etc. – Difficult to keep up with advances in SAT technology – For SAT/UNSAT, best solvers already encode to CNF

◮ E.g. Minisat+, WBO, etc.

slide-116
SLIDE 116

Cardinality Constraints

  • How to handle cardinality constraints, n

j=1 xj ≤ k ?

– How to handle AtMost1 constraints, n

j=1 xj ≤ 1 ?

– General form: n

j=1 xj ⊲

⊳ k, with ⊲ ⊳ ∈ {<, ≤, =, ≥, >}

  • Solution #1:

– Use native PB solver, e.g. BSOLO, PBS, Galena, Pueblo, etc. – Difficult to keep up with advances in SAT technology – For SAT/UNSAT, best solvers already encode to CNF

◮ E.g. Minisat+, WBO, etc.

  • Solution #2:

– Encode cardinality constraints to CNF – Use SAT solver

slide-117
SLIDE 117

Equals1, AtLeast1 & AtMost1 Constraints

  • n

j=1 xj = 1: encode with (n j=1 xj ≤ 1) ∧ (n j=1 xj ≥ 1)

  • n

j=1 xj ≥ 1: encode with (x1 ∨ x2 ∨ . . . ∨ xn)

  • n

j=1 xj ≤ 1 encode with:

– Pairwise encoding

◮ Clauses: O(n2) ; No auxiliary variables

– Sequential counter

[S05] ◮ Clauses: O(n) ; Auxiliary variables: O(n)

– Bitwise encoding

[P07,FP01] ◮ Clauses: O(n log n) ; Auxiliary variables: O(log n)

– ...

slide-118
SLIDE 118

Bitwise Encoding

  • Encode n

j=1 xj ≤ 1 with bitwise encoding:

  • An example: x1 + x2 + x3 ≤ 1
slide-119
SLIDE 119

Bitwise Encoding

  • Encode n

j=1 xj ≤ 1 with bitwise encoding:

– Auxiliary variables v0, . . . , vr−1 ; r = ⌈log n⌉ (with n > 1) – If xj = 1, then v0 . . . vr−1 = b0 . . . br−1, the binary encoding of j − 1

xj → (v0 = b0)∧. . .∧(vr−1 = br−1) ⇔ (¯ xj ∨(v0 = b0)∧. . .∧(vr−1 = br−1))

  • An example: x1 + x2 + x3 ≤ 1

j − 1 v1v0 x1 00 x2 1 01 x3 2 10

slide-120
SLIDE 120

Bitwise Encoding

  • Encode n

j=1 xj ≤ 1 with bitwise encoding:

– Auxiliary variables v0, . . . , vr−1 ; r = ⌈log n⌉ (with n > 1) – If xj = 1, then v0 . . . vr−1 = b0 . . . br−1, the binary encoding of j − 1

xj → (v0 = b0)∧. . .∧(vr−1 = br−1) ⇔ (¯ xj ∨(v0 = b0)∧. . .∧(vr−1 = br−1))

– Clauses (¯ xj ∨ (vi ↔ bi)) = (¯ xj ∨ li), i = 0, . . . , r − 1, where

◮ li ≡ vi, if bi = 1 ◮ li ≡ ¯

vi, otherwise

  • An example: x1 + x2 + x3 ≤ 1

j − 1 v1v0 x1 00 x2 1 01 x3 2 10 (¯ x1 ∨ ¯ v1) ∧ (¯ x1 ∨ ¯ v0) (¯ x2 ∨ ¯ v1) ∧ (¯ x2 ∨ v0) (¯ x3 ∨ v1) ∧ (¯ x3 ∨ ¯ v0)

slide-121
SLIDE 121

Bitwise Encoding

  • Encode n

j=1 xj ≤ 1 with bitwise encoding:

– Auxiliary variables v0, . . . , vr−1 ; r = ⌈log n⌉ (with n > 1) – If xj = 1, then v0 . . . vr−1 = b0 . . . br−1, the binary encoding of j − 1

xj → (v0 = b0)∧. . .∧(vr−1 = br−1) ⇔ (¯ xj ∨(v0 = b0)∧. . .∧(vr−1 = br−1))

– Clauses (¯ xj ∨ (vi ↔ bi)) = (¯ xj ∨ li), i = 0, . . . , r − 1, where

◮ li ≡ vi, if bi = 1 ◮ li ≡ ¯

vi, otherwise

– If xj = 1, assignment to vi variables must encode j − 1

◮ All other x variables must take value 0

– If all xj = 0, any assignment to vi variables is consistent – O(n log n) clauses ; O(log n) auxiliary variables

  • An example: x1 + x2 + x3 ≤ 1

j − 1 v1v0 x1 00 x2 1 01 x3 2 10 (¯ x1 ∨ ¯ v1) ∧ (¯ x1 ∨ ¯ v0) (¯ x2 ∨ ¯ v1) ∧ (¯ x2 ∨ v0) (¯ x3 ∨ v1) ∧ (¯ x3 ∨ ¯ v0)

slide-122
SLIDE 122

General Cardinality Constraints

  • General form: n

j=1 xj ≤ k (or n j=1 xj ≥ k)

– Sequential counters

[S05] ◮ Clauses/Variables: O(n k)

– BDDs

[ES06] ◮ Clauses/Variables: O(n k)

– Sorting networks

[ES06] ◮ Clauses/Variables: O(n log2 n)

– Cardinality Networks:

[ANORC09,ANORC11a] ◮ Clauses/Variables: O(n log2 k)

– Pairwise Cardinality Networks:

[CZI10]

– ...

slide-123
SLIDE 123

Outline

Basic Definitions DPLL Solvers CDCL Solvers What Next in CDCL Solvers? CNF Encodings Boolean Formulas Cardinality Constraints Pseudo-Boolean Constraints Encoding CSPs

slide-124
SLIDE 124

Pseudo-Boolean Constraints

  • General form: n

j=1 aj xj ≤ b

– Operational encoding

[W98] ◮ Clauses/Variables: O(n) ◮ Does not guarantee arc-consistency

– BDDs

[ES06] ◮ Worst-case exponential number of clauses

– Polynomial watchdog encoding

[BBR09] ◮ Let ν(n) = log(n) log(amax) ◮ Clauses: O(n3ν(n)) ; Aux variables: O(n2ν(n))

– Improved polynomial watchdog encoding

[ANORC11b] ◮ Clauses & aux variables: O(n3 log(amax))

– ...

slide-125
SLIDE 125

Encoding PB Constraints with BDDs I

  • Encode 3x1 + 3x2 + x3 ≤ 3
  • Construct BDD

– E.g. analyze variables by decreasing coefficients

  • Extract ITE-based circuit from BDD

x1 x2 x3 1 x2 x3 1 1 1 1 1 1 1

slide-126
SLIDE 126

Encoding PB Constraints with BDDs I

  • Encode 3x1 + 3x2 + x3 ≤ 3
  • Construct BDD

– E.g. analyze variables by decreasing coefficients

  • Extract ITE-based circuit from BDD

x1 x2 x3 1 x2 x3 1 1 1 1 1 1 1

ITE 1 s b a z ITE 1 s b a z ITE 1 s b a z ITE 1 s b a z ITE 1 s b a z

1 1 1

1 x1 x2 x3 x2 x3

slide-127
SLIDE 127

Encoding PB Constraints with BDDs II

  • Encode 3x1 + 3x2 + x3 ≤ 3
  • Extract ITE-based circuit from BDD
  • Simplify and create final circuit:

ITE 1 s b a z

NOR

1

NAND

x1 x2 x3 x2 x3

slide-128
SLIDE 128

More on PB Constraints

  • How about n

j=1 aj xj = k ?

slide-129
SLIDE 129

More on PB Constraints

  • How about n

j=1 aj xj = k ?

– Can use (n

j=1 aj xj ≥ k) ∧ (n j=1 aj xj ≤ k), but...

◮ n j=1 aj xj = k is a subset-sum constraint

(special case of a knapsack constraint)

slide-130
SLIDE 130

More on PB Constraints

  • How about n

j=1 aj xj = k ?

– Can use (n

j=1 aj xj ≥ k) ∧ (n j=1 aj xj ≤ k), but...

◮ n j=1 aj xj = k is a subset-sum constraint

(special case of a knapsack constraint)

◮ Cannot find all consequences in polynomial time [S03,FS02,T03]

slide-131
SLIDE 131

More on PB Constraints

  • How about n

j=1 aj xj = k ?

– Can use (n

j=1 aj xj ≥ k) ∧ (n j=1 aj xj ≤ k), but...

◮ n j=1 aj xj = k is a subset-sum constraint

(special case of a knapsack constraint)

◮ Cannot find all consequences in polynomial time [S03,FS02,T03]

  • Example:

4x1 + 4x2 + 3x3 + 2x4 = 5

slide-132
SLIDE 132

More on PB Constraints

  • How about n

j=1 aj xj = k ?

– Can use (n

j=1 aj xj ≥ k) ∧ (n j=1 aj xj ≤ k), but...

◮ n j=1 aj xj = k is a subset-sum constraint

(special case of a knapsack constraint)

◮ Cannot find all consequences in polynomial time [S03,FS02,T03]

  • Example:

4x1 + 4x2 + 3x3 + 2x4 = 5

– Replace by (4x1 + 4x2 + 3x3 + 2x4 ≥ 5) ∧ (4x1 + 4x2 + 3x3 + 2x4 ≤ 5)

slide-133
SLIDE 133

More on PB Constraints

  • How about n

j=1 aj xj = k ?

– Can use (n

j=1 aj xj ≥ k) ∧ (n j=1 aj xj ≤ k), but...

◮ n j=1 aj xj = k is a subset-sum constraint

(special case of a knapsack constraint)

◮ Cannot find all consequences in polynomial time [S03,FS02,T03]

  • Example:

4x1 + 4x2 + 3x3 + 2x4 = 5

– Replace by (4x1 + 4x2 + 3x3 + 2x4 ≥ 5) ∧ (4x1 + 4x2 + 3x3 + 2x4 ≤ 5) – Let x3 = 0

slide-134
SLIDE 134

More on PB Constraints

  • How about n

j=1 aj xj = k ?

– Can use (n

j=1 aj xj ≥ k) ∧ (n j=1 aj xj ≤ k), but...

◮ n j=1 aj xj = k is a subset-sum constraint

(special case of a knapsack constraint)

◮ Cannot find all consequences in polynomial time [S03,FS02,T03]

  • Example:

4x1 + 4x2 + 3x3 + 2x4 = 5

– Replace by (4x1 + 4x2 + 3x3 + 2x4 ≥ 5) ∧ (4x1 + 4x2 + 3x3 + 2x4 ≤ 5) – Let x3 = 0 – Either constraint can still be satisfied, but not both

slide-135
SLIDE 135

Outline

Basic Definitions DPLL Solvers CDCL Solvers What Next in CDCL Solvers? CNF Encodings Boolean Formulas Cardinality Constraints Pseudo-Boolean Constraints Encoding CSPs

slide-136
SLIDE 136

CSP Constraints

  • Many possible encodings:

– Direct encoding

[dK89,GJ96,W00]

– Log encoding

[W00]

– Support encoding

[K90,G02]

– Log-Support encoding

[G07]

– Order encoding for finite linear CSPs

[TTKB09]

– ...

slide-137
SLIDE 137

Direct Encoding for CSP w/ Binary Constraints

  • Variable xi with domain Di, with mi = |Di|
  • Represent values of xi with Boolean variables xi,1, . . . , xi,mi
  • Require mi

k=1 xi,k = 1

– Suffices to require mi

k=1 xi,k ≥ 1

[W00]

  • If the pair of assignments xi = vi ∧ xj = vj is not allowed, add

binary clause (¯ xi,vi ∨ ¯ xj,vj)

slide-138
SLIDE 138

Thanks!