1 / 33

Introduction to MiniSat v1.14

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

mayten
Download Presentation

Introduction to MiniSat v1.14

An Image/Link below is provided (as is) to download presentation 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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

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

  3. 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 • Helpful implementation documents and comments • Minimal but efficient heuristic Overview MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

  4. 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

  5. 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

  6. /* 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(); } } } Overview MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

  7. 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

  8. VSIDS is proposed by chaff first. 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

  9. When a clause is added to DB, the related counters are incremented • Conflict analysis adds a new learnt clause to DB 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

  10. Periodically, the scores are divided by a constant factor • In this example, a constant factor is 2 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

  11. Literals on more recently added clause have higher weighted scores 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

  12. VSIDS in MiniSat 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

  13. Conflict Clause Analysis • 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

  14. Conflict Clause Analysis • 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

  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 Sharadmalik “The Quest for Efficient Boolean Satisfiability Solvers” MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

  16. DLevel=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

  17. DLevel=2 DLevel=1 Conflict Clause Analysis e=F a=T -b∨-c∨-d MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

  18. DLevel=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

  19. DLevel=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

  20. DLevel=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

  21. DLevel=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

  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, KAIST

  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, KAIST

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

  25. Example • First assign False to x7 MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

  26. Example • BCP from –x7 MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

  27. Example • Second assign False to x3 MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

  28. Example • C0 is a conflicting clause. Analyze it MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

  29. Example 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

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

  31. Example 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

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

  33. An Extensible SAT-solver by NiklasEen and NiklasSörensson in SAT 2003 References MiniSat v1.14, Yunho Kim, Provable Software Lab, KAIST

More Related