Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 –...

42
Preprocessing in Incremental SAT Alexander Nadel 1 , Vadim Ryvchin 1,2 , and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12, Trento, Italy

description

Incremental SAT

Transcript of Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 –...

Page 1: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Preprocessing in Incremental SATAlexander Nadel1, Vadim Ryvchin1,2, and Ofer Strichman2

1 – Intel, Haifa, Israel2 – Technion, Haifa, Israel

SAT’12, Trento, Italy

Page 2: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Introduction Incremental SAT is at the core of a variety of applications

Preprocessing is essential for SAT’s performance• … but is not compatible with incremental SAT

We propose a way to make them compatible • thus increasing the capacity of SAT-based tools and algorithms

Page 3: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Incremental SAT Initial Formula: First incremental Call: Nth incremental call:

– Input formula at call – New input clauses added at call

Page 4: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

SatELite Preprocessing Main techniques:

• Variable elimination• Subsumption/Self-subsuming resolution

Variable Elimination:

• If > save() else save()o Done to extend SAT assignment

The problem in combining SatELite with incremental SAT:• Eliminated variables might reappear in new input clauses

Page 5: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

The Problem

-------------------------------------------------------------------------------Elimination of variable : Now Solver returns: SAT: -------------------------------------------------------------------------------Incremental call:

Solver returns: But: – is not satisfied by .

Page 6: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Previous Approaches1. No preprocessing at all2. Full preprocessing

• After each invocation return the eliminated clauses• Redo preprocessing

3. Look Ahead:• Do not eliminate “problematic” variables

Preprocessing is essential for performance In many cases look ahead is not possible

Page 7: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Definitions – Input formula at call – Formula at the end of call

• Formula comprises clauses managed by the solver – Saved clauses for eliminated variable – New input clauses added at call – initially , modified by incremental preprocessing – all clauses in containing

Page 8: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Incremental Preprocessing

PreprocessSolve // might run in-process

Page 9: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Incremental Preprocessing

For each eliminated variable in elimination order: if (*) // decide heuristically

Re-Eliminate else Re-IntroducePreprocessSolve // might run in-process

Page 10: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Incremental Preprocessing

Remove subsumptions.For each eliminated variable in elimination order: if (*) // decide heuristically

Re-Eliminate else Re-IntroducePreprocessSolve // might run in-process

Page 11: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Incremental Preprocess Re-Elimination (for example: of ):

• Perform resolutions between newly added clauses and saved ones ()

• Add the resolvents to the formula ()• Remove clauses ()• Update previously saved clauses ()

Re-Introduction (for example: of ):• Move (all clauses saved for ) back to the formula ()

Page 12: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Data structure for Eliminated Variables

– Saved clauses containing variable

v1

v2

v3

v4

v5

S1

S2

S3

S4

S5

Clauses containing v3 but not v1 nor v2 may contain v4, v5, …

Page 13: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Start

v1

v2

v3

v4

v5

S1

S2

S3

S4

S5

Δ𝑛Δ ′

Page 14: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Step 1 – Examine v1

v1

v2

v3

v4

v5

S1

S2

S3

S4

S5 Re-Elimination

Δ𝑛Δ ′

Page 15: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Step 1 – Re-Eliminate v1

v1

v2

v3

v4

v5

S1 = S1U

S2

S3

S4

S5

Δ ′𝑣1Δ ′ Δ ′ (S1 U

Page 16: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Step 2

v1

v2

v3

v4

v5

S1 = S1 U

S2

S3

S4

S5

Δ ′

Page 17: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Step 2 – Examine v2

v1

v2

v3

v4

v5

S1 = S1 U

S2

S3

S4

S5

Δ ′

Re-Elimination

Page 18: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Step 2 – Re-Eliminate v2

v1

v2

v3

v4

v5

S1 = S1 U

S2 = S2 U

S3

S4

S5

Δ ′𝑣 2Δ ′ Δ ′ (S2 U

Page 19: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Step 3

v1

v2

v3

v4

v5

S1 = S1 U

S2 = S2 U

S3

S4

S5

Δ ′

Page 20: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Step 3 – Examine v3

v1

v2

v3

v4

v5

S1 = S1 U

S2 = S2 U

S3

S4

S5

Δ ′

Re-Introduction

Page 21: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Step 3 – Re-Introduce v3

v1

v2

v3

v4

v5

S1 = S1 U

S2 = S2 U

S3

S4

S5

S3Δ ′ Δ ′

Page 22: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Step 3 – Re-Introduce v3

v1

v2

v4

v5

S1 = S1 U

S2 = S2 U

S4

S5

S3Δ ′ Δ ′

May contain v4 and/or v5

Page 23: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Our Example1. Input: 2. Preprocessing and Solution

• Elimination of .•

3. Incremental call with )

𝑎 𝑆1=𝑐1∧𝑐2

Δ ′ Δ1

Page 24: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Our Example – Re-Elimination)

Perform Re-Elimination of variable :

= c4 Ʌ c5

𝑎 𝑆1=𝑐1∧𝑐2

Page 25: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Our Example – Re-Elimination) )

Perform Re-Elimination of variable :

Δ ′ 𝑐5 𝑐4∧𝑐5𝑎 𝑆1=𝑐1∧𝑐2∧𝑐5

Δ ′ Δ ′𝑎 𝑅𝑒𝑠𝑎(𝑆𝑎∪ Δ′𝑎)

Page 26: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Our Example – Re-Elimination) )

After Re-Elimination of variable :

Δ ′ 𝑐4∧𝑐6𝑎 𝑆1=𝑐1∧𝑐2∧𝑐5

Page 27: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Our Example – Re-Elimination) )

So the new formula will look like:

Solve UNSAT

Page 28: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Our Example1. Input: 2. Preprocessing and Solution

• Elimination of .•

3. Incremental call with )

𝑎 𝑆1=𝑐1∧𝑐2

Δ ′ Δ1

Page 29: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Our Example – Re-Introduction)

Perform Re-Introduction of variable :

= c4 Ʌ c5

𝑎 𝑆1=𝑐1∧𝑐2

Page 30: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Our Example – Re-Introduction)

Perform Re-Introduction of variable :

Δ ′ c1 Ʌ c2 𝑐4∧𝑐5𝑎 𝑆1=𝑐1∧𝑐2

Δ ′ 𝑆𝑎

Page 31: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Our Example – Re-Introduction)

After Re-Introduction of variable :

Δ ′

Page 32: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Our Example – Re-Introduction)

So the new formula will look like: Solve UNSAT

Page 33: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Additional Improvements Variable elimination creates many resolvent clauses. If we Re-Introduce , can we delete ’s resolvents?

• No, it affects correctness

We can remove only resolvents that did not participate in subsumptions

Page 34: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Example

• Elimination of : • Self-subsumption between and : • Self-subsumption between and : • Subsumption of and by • Re-Introduction of : returning and , removal of • So what left are .• ,

Page 35: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Assumptions How to deal with assumption variables? Regular preprocessing:

• Freeze them (do not eliminate these variables). Incremental preprocessing:

• Freeze them (the same).• But what if variable was eliminated before?

o Must Re-Introduce. What if there are a lot of assumptions

• Our previous talk

Page 36: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Experimental Results Benchmark Set:

• Implementation on top of Fiver (a new SAT solver under development at Intel).

• Large Bounded Model-checking instances from Intel divided into 4 different families.

• 206 different instances• Timeout: 4000sec

Machines:• Intel® Xeon® 4Ghz 32Gb of memory

Page 37: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Experimental Results

Page 38: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Experimental Results

Method Time-outs Avg. Total run-timeFull-preprocessing 68 2465.5

No-preprocessing 42 1784.7

Incremental-preprocessing 2 1221.3

Look-ahead 0 1064.9

Page 39: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Incremental vs. No preprocessing

Page 40: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Incremental vs. Full preprocessing

Page 41: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Incremental vs. Look-ahead

Page 42: Preprocessing in Incremental SAT Alexander Nadel 1, Vadim Ryvchin 1,2, and Ofer Strichman 2 1 – Intel, Haifa, Israel 2 – Technion, Haifa, Israel SAT’12,

Thank You!