Top Banner
1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and resolution More techniques: decision heuristics, deduction. Stochastic SAT solvers: the GSAT approach
40

1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

Jan 02, 2016

Download

Documents

Irene White
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

1

Agenda

Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and resolution More techniques: decision heuristics, deduction. Stochastic SAT solvers: the GSAT approach

Page 2: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

2

Conflict clauses and Resolution

Binary-resolution is a sound inference rule:

Example:

Page 3: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

3

Consider the following example:

Conflict clause: c5: (x2 Ç :x4 Ç x10)

We show that c5 is inferred by resolution from c1,…,c4

Conflict clauses and resolution

Page 4: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

4

Conflict clause: c5: (x2 Ç :x4 Ç x10)

BCP order: x4,x5,x6,x7 T1 = Res(c4,c3,x7) = (:x5 Ç :x6) T2 = Res(T1, c2, x6) = (:x4 Ç :x5 Ç X10 ) T3 = Res(T2,c1,x5) = (x2 Ç :x4 Ç x10 )

Conflict clauses and resolution

Page 5: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

5

Applied to our example:

Finding the conflict clause:

cl is asserting the first UIP

Page 6: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

6

Conflict clauses and resolution

c2

c3

c4

c5

c1

This will be part of the (Hyper )Resolution Graph:

Page 7: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

7

The resolution graph

What is it good for ? Example: for computing an Unsatisfiable core

[Picture Borrowed from Zhang, Malik SAT’03]

Page 8: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

Minimizing the core

The proof is not unique. Different proofs / different cores.

Can we find a minimum / minimal / smaller cores/proofs?

8

Page 9: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

Minimizing the core

Core compression [ZM03,…]… Min-core-biased search [NRS’13]

Proof compression:

Exponential-time transformations [GKS’06].

Linear time transformations “Recycle units” [BFHSS’08]

9

Page 10: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

Core compression (smaller core)

A basic approach: run until reaching a fixpoint [chaff]

10

SAT solver

core== last_core ?

corecore

last_core = core

yes

no

initially last_core = ;

Page 11: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

11

Remove an unmarked clause c 2

SAT() ?

mark c

yes

:= core

no

Initially ’s clauses are unmarkedReturn

All marked

Core compression (minimal core)

Page 12: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

12

Proof compression Example of a linear-time transformation / “Recycle-units” Observation:

When learning (resolving) a new clause in SAT, The resolving clauses are not satisfied Hence, the resolution-variable is unassigned

l l1 :l l2

l1 l2

Page 13: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

13

Example (cont’d)

Suppose that the pivot’s constant value is learned later on.

We will use it to simplify the resolution proof.

Page 14: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

14

Recycle-units / easy case

1 3 -1 2 5

2 3 5 1 -2

1 3 5

-1 4 -1 -4

-1

3 5

Page 15: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

15

Recycle-units / easy case

1 3 -1 2 5

2 3 5 1 -2

1 3 5

-1 4 -1 -4

-1

3 5

Page 16: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

16

Recycle-units

1 3

3 1 -2

1 3 5

-1 4 -1 -4

-1

3 5

3

3

Page 17: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

17

Recycle-units

1 3

3

-1 4 -1 -4

-1

Reduced proof by 4 clauses Reduced core by 2 clauses

Page 18: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

18

Recycle-units / beware of cycles

1 3

2 3 5 1 -2

1 3 5

-1 4 -1 -4

-1

By making this connection we created

cyclic reasoning

Page 19: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

19

Recycle-units / beware of cycles

Solution: mark antecedents of units apply only to unmarked nodes

1 3

2 3 5 1 -2

1 3 5

-1 4 -1 -4

-1

-1 2 5

3 5

Page 20: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

20

Agenda

Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and resolution More techniques: decision heuristics, deduction. Stochastic SAT solvers: the GSAT approach

Page 21: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

21

4. Periodically, all the counters are divided by a constant.

3. The unassigned variable with the highest counter is chosen.

2. When a clause is added, the counters are updated.

1. Each variable in each polarity has a counter initialized to 0.

)Implemented in Chaff(

Decision heuristicsVSIDS (Variable State Independent Decaying Sum)

Page 22: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

22

• Chaff holds a list of unassigned variables sorted by the counter value.

• Updates are needed only when adding conflict clauses.

• Thus - decision is made in constant time.

Decision heuristicsVSIDS (cont’d)

Page 23: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

23

VSIDS is a ‘quasi-static’ strategy:

- static because it doesn’t depend on current assignment

- dynamic because it gradually changes. Variables that appear in recent conflicts have higher priority.

This strategy is a conflict-driven decision strategy.

“..employing this strategy dramatically )i.e. an orderof magnitude( improved performance ... “

Decision heuristicsVSIDS (cont’d)

Page 24: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

24

Decision Heuristics - Berkmin

Keep conflict clauses in a stack Choose the first unresolved clause in the stack

If there is no such clause, use VSIDS

Choose from this clause a variable + value according to some scoring (e.g. VSIDS)

This gives absolute priority to conflicts.

Page 25: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

25

Berkmin heuristic

tail-first conflict clause

Page 26: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

26

Deduction)( allocates new implied variables and conflicts. How can this be done efficiently ?

Observation: More than 90% of the time SAT solvers perform Deduction)(.

More engineering aspects of SAT solvers

Page 27: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

27

Hold 2 counters for each clause :

val1( ) - # of negative literals assigned 0 in +

# of positive literals assigned 1 in .

val0(( - # of negative literals assigned 1 in +

# of positive literals assigned 0 in .

Grasp implements Deduction)( with counters

Page 28: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

28

Every assignment to a variable x results in updating the counters for all the clauses that contain x.

Grasp implements Deduction)( with counters

is satisfied iff val1)( > 0

is unsatisfied iff val0)( = ||

is unit iff val1)( = 0 val0)( = || - 1

is unresolved iff val1)( = 0 val0)( < || - 1..

Backtracking: Same complexity.

Page 29: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

29

Observation: during Deduction(), we are only interested in newly implied variables and conflicts.

These occur only when the number of literals in with value ‘false’ is greater than || - 2

Conclusion: no need to visit a clause unless (val0() > || - 2)

How can this be implemented ?

Chaff implements Deduction)( with 2 observers

Page 30: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

30

For each clause ¼, define two ‘observers’: O1(), O2().

O1() and O2(): two literals which are not ‘false’.

is unit if updating one observer leads to O1() = O2().

Visit clause only if O1() or O2() become ‘false’.

Chaff implements Deduction)( with 2 observers

Page 31: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

31

1 2 3 4 5

V[1]=0

1 2 3 4 5

V[5]=0, v[4]= 0 1 2 3 4 5 Unit clause

Backtrackv[4] = v[5]= Xv[1] = 1

1 2 3 4 5

Chaff implements Deduction)( with 2 observers

1 2 3 4 5

V[2]=0

O1 O2

Page 32: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

32

Complexity of Backtracking: Observers of a unit clause are on the highest decision level

present in the clause. Hence backtracking will un-assign them first.

Conclusion: when backtracking, observers stay in place.

Chaff implements Deduction() with 2 observers

Page 33: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

33

Chaff implements Deduction() with 2 observers

Which observing literals? Strategy: the least frequently updated variables

The observers method has a learning curve Initial observers: chosen arbitrarily. Then: shifted from variables that were recently updated

These variables will most probably be reassigned soon.

In our example: the next time v[5] is updated, it will point to a significantly smaller set of clauses.

Page 34: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

34

Agenda

Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and resolution More techniques: decision heuristics, deduction. Stochastic SAT solvers: the GSAT approach

Page 35: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

35

GSAT: stochastic SAT solving

for i = 1 to max_tries {

T := randomly generated truth assignment

for j = 1 to max_flips {

if T satisfies return TRUE

choose v s.t. flipping v’s value gives largest increase in

the # of satisfied clauses )break ties randomly(.

T := T with v’s assignment flipped. } }

Given a CNF formula , choose max_tries and max_flips

Many alternative heuristics

Page 36: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

36

Numerous progressing heuristics

Hill-climbing Tabu-list Simulated-annealing Random-Walk Min-conflicts ...

Page 37: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

37

Improvement # 1: clause weights

Initial weight of each clause: 1 Increase by k the weight of unsatisfied clauses. Choose v according to maximum increase in weight

Clause weights is another example of conflict-driven decision strategy.

Page 38: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

38

Improvement # 2: Averaging-in

Q: Can we reuse information gathered in previous tries in order to speed up the search ?

A: Yes!

Rather than choosing T randomly each time, repeat ‘good assignments’ and choose randomly the rest.

Page 39: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

39

Let X1, X2 and X3 be equally wide bit vectors.

Define a function bit_average : X1 X2 X3 as follows:

b1i b1

i = b2i

random otherwise

(where bji is the i-th bit in Xj, j {1,2,3})

b3i :=

Improvement # 2: Averaging-in

Page 40: 1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.

40

Notation:

Tiinit

: The initial assignment T in cycle i.

Tibest

: The assignment with highest # of satisfied clauses in

cycle i.

T1init := random assignment.

T2init := random assignment.

i > 2, Tiinit := bit_average(Ti-1

best, Ti-2best)

Improvement # 2: Averaging-in