1 / 33

# Introduction to MiniSat v1.14 - PowerPoint PPT Presentation

Introduction to MiniSat v1.14. Presented by Yunho Kim Provable Software Lab, KAIST. Overview VSIDS Decision Heuristic Conflict Clause Analysis Example. Contents. MiniSat is a fast SAT solver developed by Niklas Eén and Niklas Sörensson

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

## PowerPoint Slideshow about 'Introduction to MiniSat v1.14' - mayten

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

### Introduction to MiniSat v1.14

Presented by Yunho Kim

Provable Software Lab, KAIST

VSIDS Decision Heuristic

Conflict Clause Analysis

Example

Contents

MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

• MiniSat is a fast SAT solver developed by NiklasEén and NiklasSörensson

• MiniSatwon all industrial categories in SAT 2005 competition

• MiniSatwon SAT-Race 2006

• MiniSat is simple and well-documented

• Well-defined interface for general use

• Minimal but efficient heuristic

Overview

MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

CNF is a logical AND of one or more clauses

Clause is a logical OR of one or more literals

Literal is either the positive or the negativevariable

Overview

(x2∨x4∨x5∨x6) ∧ (x0∨-x1∨x6)∧ (-x2∨-x3∨-x4)

(x2∨x4∨x5∨x6), (x0∨-x1∨x6), (-x2∨-x3∨-x4)

Variables: x0, x1, x2, x3, x4, x5, x6

Literals: x0, -x1, x2, -x2, -x3, x4, -x4, x5, x6

Definition from Lintao Zhang and Sharadmalik

“The Quest for Efficient Boolean Satisfiability Solvers”

MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

• Unit clause is a clause in which all but one of literals is assigned to False

• Unit literal is the unassigned literal in a unit clause

• (x0) is a unit clause and ‘x0’ is a unit literal

• (-x0∨x1) is a unit clause since x0 has to be True

• (-x2∨-x3∨-x4) can be a unit clause if the current assignment is that x3 and x4 are True

• Boolean Constrain Propagation(BCP) is the process of assigning the True value to all unit literals

Overview

……

(x0)∧

(-x0∨x1)∧

(-x2∨-x3∨-x4)∧

……

MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

/* overall structure of Minisat solve procedure */

Solve(){

while(true){

boolean_constraint_propagation();

if(no_conflict){

if(no_unassigned_variable) return SAT;

decision_level++;

make_decision();

}else{

analyze_conflict();

undo_assignments();

}

}

}

Overview

MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

• Variable State Independent Decaying Sum(VSIDS)

• decision heuristic to determine what variable will be assigned next

• decision is independent from the current assignment of each variable

• VSIDS makes decisions based on activity

• Activity is a literal occurrence count with higher weight on the more recently added clauses

VSIDS Decision Heuristic

activity description from Lintao Zhang and Sharadmalik

“The Quest for Efficient Boolean Satisfiability Solvers”

MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

Initially, the score for each literal is the occurrence on the given input CNF instance

VSIDS Decision Heuristic

Initial constraints

(x1∨x4) ∧

(x1∨-x3∨-x5) ∧

(x1∨x5∨x7) ∧

(x2∨x8) ∧

(-x7∨-x3∨x6) ∧

(-x7∨x5∨-x6) ∧

(x7∨x5∨-x9)

MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

VSIDS Decision Heuristic

(x1∨x4) ∧

(x1∨-x3∨-x5) ∧

(x1∨x5∨x7) ∧

(x2∨x8) ∧

(-x7∨-x3∨x6) ∧

(-x7∨x5∨-x6) ∧

(x7∨x5∨-x9)∧

(x7∨x6∨-x9)

MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

VSIDS Decision Heuristic

(x1∨x4) ∧

(x1∨-x3∨-x5) ∧

(x1∨x5∨x7) ∧

(x2∨x8) ∧

(-x7∨-x3∨x6) ∧

(-x7∨x5∨-x6) ∧

(x7∨x5∨-x9)∧

(x7∨x6∨-x9)

MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

VSIDS Decision Heuristic

(x1∨x4) ∧

(x1∨-x3∨-x5) ∧

(x1∨x5∨x7) ∧

(x2∨x8) ∧

(-x7∨-x3∨x6) ∧

(-x7∨x5∨-x6) ∧

(x7∨x5∨-x9)∧

(x7∨x6∨-x9) ∧

(-x9∨x8)

MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

• VSIDS in scoresMiniSat is slightly different from chaff

• MiniSat does not consider polarity

• Before adding thefirst learnt clause, all the scores are 0

• All the scores are decaying by 5% when a conflict occurs

• The activities of all variables occurring in some clause used in the conflict analysis are increased

VSIDS Decision Heuristic

MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

Conflict Clause Analysis scores

• A conflict happens when one clause is falsified by unit propagation

• Analyze the conflicting clause to infer a clause

• (-x3∨-x2∨-x1) is conflicting clause

• The inferred clause is a new knowledge

• A new learnt clause is added to constraints

Assume x4 is False

(x1∨x4) ∧

(-x1∨x2) ∧

(-x2∨x3) ∧

(-x3∨-x2∨-x1) Falsified!

Omitted clauses

MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

Conflict Clause Analysis scores

• Learnt clauses are inferred by conflict analysis

• They help prune future parts of the search space

• Assigning False to x4 is the casual of conflict

• Adding (x4) to constraints prohibit conflict from –x4

• Learnt clauses actually drive backtracking

(x1∨x4) ∧

(-x1∨x2) ∧

(-x2∨x3) ∧

(-x3∨-x2∨-x1) ∧

omitted clauses ∧

(x4) learnt clause

MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

Conflict Clause Analysis scores

/* conflict analysis algorithm */

Analyze_conflict(){

cl = find_confclicting_clause();

/* Loop until cl is falsified and zero or one propagated literals in current decision level are remained */

While(!stop_criterion_met(cl)){

lit = choose_literal(cl); /* select the last propagated literal */

Var = variable_of_literal(lit);

ante = antecedent(var);

cl = resolve(cl, ante, var);

}

/* backtrack level is the lowest decision level for which the learnt clause is unit clause */

back_dl = clause_asserting_level(cl);

return back_dl;

}

Algorithm from Lintao Zhang and Sharadmalik

“The Quest for Efficient Boolean Satisfiability Solvers”

MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

DLevel scores=2

DLevel=1

Conflict Clause Analysis

e=F

a=T

Conflict

-b∨-c∨-d

Example slides are from CMU 15-414 course ppt

MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

DLevel scores=2

DLevel=1

Conflict Clause Analysis

e=F

a=T

-b∨-c∨-d

MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

DLevel scores=2

DLevel=1

Conflict Clause Analysis

e=F

a=T

-b∨-c∨-d

-b∨-c∨h

MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

DLevel scores=2

DLevel=1

Conflict Clause Analysis

e=F

a=T

-b∨-c∨-d

-b∨-c∨h

MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

DLevel scores=2

DLevel=1

Conflict Clause Analysis

e=F

a=T

-b∨-c∨-d

-b∨-c∨h

-b∨e∨f∨hlearnt clause

MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

DLevel scores=1

Conflict Clause Analysis

e=F

a=T

b=F

-b∨-c∨-d

-b∨-c∨h

-b∨e∨f∨h

MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

Example scores

• Left side shows status of clauses

• Green literals are True, reds are False and yellows are Undefined

MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

Example scores

• Right-up side shows variable data

• Reason indicates what clause the variable propagated from

• Level is a decision level

MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

Example scores

• Right-down shows trail, that is an assignment stack

MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

Example scores

• First assign False to x7

MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

Example scores

• BCP from –x7

MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

Example scores

• Second assign False to x3

MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

Example scores

• C0 is a conflicting clause. Analyze it

MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

Example scores

Activity is changed

• First resolve last propagated literal

• c0 and c2 are resolved w.r.t x0

MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

Example scores

• A new learnt clause is (-x2∨x4∨x6∨x7)

MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

Example scores

Activities are decayed for next added clause

• Adds a learnt clause to DB and go on search

MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

Example scores

• Finally we find a model, that is, satisfying assignment

MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

References

MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST