Download presentation

Presentation is loading. Please wait.

Published byGianni Test Modified over 2 years ago

1
Introduction to MiniSat v1.14 Presented by Yunho Kim Provable Software Lab, KAIST

2
Contents Overview VSIDS Decision Heuristic Conflict Clause Analysis Example MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST2/33

3
Overview MiniSat is a fast SAT solver developed by Niklas Eén a nd Niklas Sörensson – MiniSat won all industrial categories in SAT 2005 competition – MiniSat won SAT-Race 2006 MiniSat is simple and well-documented – Well-defined interface for general use – Helpful implementation documents and comments – Minimal but efficient heuristic MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST3/33

4
Overview 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 negative variable MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST4/33 (x 2 ∨x 4 ∨x 5 ∨x 6 ) ∧ (x 0 ∨-x 1 ∨x 6 ) ∧ (-x 2 ∨-x 3 ∨-x 4 ) (x 2 ∨x 4 ∨x 5 ∨x 6 ), (x 0 ∨-x 1 ∨x 6 ), (-x 2 ∨-x 3 ∨-x 4 ) Variables: x 0, x 1, x 2, x 3, x 4, x 5, x 6 Literals: x 0, -x 1, x 2, -x 2, -x 3, x 4, -x 4, x 5, x 6 Definition from Lintao Zhang and Sharad malik “The Quest for Efficient Boolean Satisfiability Solvers”

5
Overview 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 – (x 0 ) is a unit clause and ‘x 0 ’ is a unit literal – (-x 0 ∨x 1 ) is a unit clause since x 0 has to be True – (-x 2 ∨-x 3 ∨-x 4 ) can be a unit clause if the current assignment is that x 3 and x 4 are True Boolean Constrain Propagation(BCP) is the process of assigning the True value to all unit literals MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST5/33 …… (x 0 )∧ (-x 0 ∨x 1 )∧ (-x 2 ∨-x 3 ∨-x 4 )∧ ……

6
Overview /* 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{ if (no_dicisions_made) return UNSAT; analyze_conflict(); undo_assignments(); add_conflict_clause(); } MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST6/33

7
VSIDS Decision Heuristic 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 MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST7/33 activity description from Lintao Zhang and Sharad malik “The Quest for Efficient Boolean Satisfiability Solvers”

8
VSIDS Decision Heuristic VSIDS is proposed by chaff first. Initially, the score for each literal is the occurrence on the given input CNF instance MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST8/33 Initial constraints (x 1 ∨x 4 ) ∧ (x 1 ∨-x 3 ∨-x 5 ) ∧ (x 1 ∨x 5 ∨x 7 ) ∧ (x 2 ∨x 8 ) ∧ (-x 7 ∨-x 3 ∨x 6 ) ∧ (-x 7 ∨x 5 ∨-x 6 ) ∧ (x 7 ∨x 5 ∨-x 9 ) ScoreLiteral 3x 1, x 5 2-x 3, x 7, -x 7 1x 2, x 4, -x 5, x 6, -x 6, x 8, -x 9

9
VSIDS Decision Heuristic When a clause is added to DB, the related counters are incremented – Conflict analysis adds a new learnt clause to DB MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST9/33 (x 1 ∨x 4 ) ∧ (x 1 ∨-x 3 ∨-x 5 ) ∧ (x 1 ∨x 5 ∨x 7 ) ∧ (x 2 ∨x 8 ) ∧ (-x 7 ∨-x 3 ∨x 6 ) ∧ (-x 7 ∨x 5 ∨-x 6 ) ∧ (x 7 ∨x 5 ∨-x 9 ) ∧ (x 7 ∨x 6 ∨-x 9 ) ScoreLiteral 3x 1, x 5, x 7 2-x 3, x 7, -x 7, x 6, -x 9 1x 2, x 4, -x 5, x 6, -x 6, x 8, -x 9

10
VSIDS Decision Heuristic Periodically, the scores are divided by a constant factor – In this example, a constant factor is 2 MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST10/33 (x 1 ∨x 4 ) ∧ (x 1 ∨-x 3 ∨-x 5 ) ∧ (x 1 ∨x 5 ∨x 7 ) ∧ (x 2 ∨x 8 ) ∧ (-x 7 ∨-x 3 ∨x 6 ) ∧ (-x 7 ∨x 5 ∨-x 6 ) ∧ (x 7 ∨x 5 ∨-x 9 ) ∧ (x 7 ∨x 6 ∨-x 9 ) ScoreLiteral 1.5x 1, x 5, x 7 1-x 3, -x 7, x 6, -x 9 0.5x 2, x 4, -x 5, -x 6, x 8

11
VSIDS Decision Heuristic Literals on more recently added clause have higher weighted scores MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST11/33 (x 1 ∨x 4 ) ∧ (x 1 ∨-x 3 ∨-x 5 ) ∧ (x 1 ∨x 5 ∨x 7 ) ∧ (x 2 ∨x 8 ) ∧ (-x 7 ∨-x 3 ∨x 6 ) ∧ (-x 7 ∨x 5 ∨-x 6 ) ∧ (x 7 ∨x 5 ∨-x 9 ) ∧ (x 7 ∨x 6 ∨-x 9 ) ∧ (-x 9 ∨x 8 ) ScoreLiteral 2-x 9 1.5x 1, x 5, x 7, x 8 1-x 3, -x 7, x 6, -x 9 0.5x 2, x 4, -x 5, -x 6, x 8

12
VSIDS Decision Heuristic VSIDS in MiniSat is slightly different from chaff – MiniSat does not consider polarity – Before adding the first 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 MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST12/33

13
Conflict Clause Analysis A conflict happens when one clause is falsified by unit propagation Analyze the conflicting clause to infer a clause – (-x 3 ∨-x 2 ∨-x 1 ) is conflicting clause The inferred clause is a new knowledge – A new learnt clause is added to constraints Assume x 4 is False (x 1 ∨x 4 ) ∧ (-x 1 ∨x 2 ) ∧ (-x 2 ∨x 3 ) ∧ (-x 3 ∨-x 2 ∨-x 1 ) Falsified! Omitted clauses MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST13/33

14
Conflict Clause Analysis Learnt clauses are inferred by conflict analysis They help prune future parts of the search space – Assigning False to x 4 is the casual of conflict – Adding (x4) to constraints prohibit conflict from –x 4 Learnt clauses actually drive backtracking (x 1 ∨x 4 ) ∧ (-x 1 ∨x 2 ) ∧ (-x 2 ∨x 3 ) ∧ (-x 3 ∨-x 2 ∨-x 1 ) ∧ omitted clauses ∧ (x 4 ) learnt clause MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST14/33

15
Conflict Clause Analysis /* 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); } add_clause_to_database(cl); /* 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 Sharad malik “The Quest for Efficient Boolean Satisfiability Solvers” MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST15/33

16
Conflict Clause Analysis Assignmentsantecedent e=F assumption f=F -f∨e g=F -g∨f h=F -h∨g a=T assumption b=T b∨-a∨e c=T c∨e∨f∨-b d=T d∨-b∨h e=F a=T -b∨-c∨-d Conflict DLevel=2 DLevel=1 Example slides are from CMU 15-414 course ppt MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST16/33

17
Conflict Clause Analysis e=F a=T -b∨-c∨-d Assignmentsantecedent e=F assumption f=F -f∨e g=F -g∨f h=F -h∨g a=T assumption b=T b∨-a∨e c=T c∨e∨f∨-b d=T d∨-b∨h DLevel=2 DLevel=1 MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST17/33

18
Conflict Clause Analysis e=F a=T -b∨-c∨-d -b∨-c∨h Assignmentsantecedent e=F assumption f=F -f∨e g=F -g∨f h=F -h∨g a=T assumption b=T b∨-a∨e c=T c∨e∨f∨-b d=T d∨-b∨h DLevel=2 DLevel=1 MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST18/33

19
Conflict Clause Analysis e=F a=T -b∨-c∨-d -b∨-c∨h Assignmentsantecedent e=F assumption f=F -f∨e g=F -g∨f h=F -h∨g a=T assumption b=T b∨-a∨e c=T c∨e∨f∨-b d=T d∨-b∨h DLevel=2 DLevel=1 MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST19/33

20
Conflict Clause Analysis e=F a=T -b∨-c∨-d -b∨e∨f∨h learnt clause -b∨-c∨h Assignmentsantecedent e=F assumption f=F -f∨e g=F -g∨f h=F -h∨g a=T assumption b=T b∨-a∨e c=T c∨e∨f∨-b d=T d∨-b∨h DLevel=2 DLevel=1 MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST20/33

21
Conflict Clause Analysis e=F a=T -b∨-c∨-d -b∨-c∨h b=F -b∨e∨f∨h Assignmentsantecedent e=F assumption f=F -f∨e g=F -g∨f h=F -h∨g b=F -b∨e∨f∨h … … DLevel=1 MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST21/33

22
Example 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, KAIST22/33

23
Example 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, KAIST23/33

24
Example Right-down shows trail, that is an assignment stack MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST24/33

25
Example First assign False to x7 MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST25/33

26
Example BCP from –x7 MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST26/33

27
Example Second assign False to x3 MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST27/33

28
Example C0 is a conflicting clause. Analyze it MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST28/33

29
Example First resolve last propagated literal c0 and c2 are resolved w.r.t x0 MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST29/33 Activity is changed

30
Example A new learnt clause is (-x2∨x4∨x6∨x7) MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST30/33

31
Example Adds a learnt clause to DB and go on search MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST31/33 Activities are decayed for next added clause

32
Example Finally we find a model, that is, satisfying assignment MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST32/33

33
References An Extensible SAT-solver by Niklas Een and Niklas Sörensson in SAT 2003 MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST33/33

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google