informatics 1
play

Informatics 1 Michael Fourman Lecture 19 Searching for Satisfaction - PowerPoint PPT Presentation

Informatics 1 Michael Fourman Lecture 19 Searching for Satisfaction 1 Clausal Form Clausal form is a set of sets of literals { {A,C}, {B,D}, {E,B}, {E,A}, {A,E}, {E,B},{B, C, D} } A (partial) truth assignment makes a


  1. Informatics 1 Michael Fourman Lecture 19 Searching for Satisfaction 1

  2. ⋀⋁ Clausal Form Clausal form is a set of sets of literals { {¬A,C}, {¬B,D}, {¬E,B}, {¬E,A}, {A,E}, {E,B},{¬B, ¬C, ¬D} } A (partial) truth assignment makes a clause true iff it makes at least one of its literals true (so it can never make the empty clause {} true) A (partial) truth assignment makes a clausal form true iff it makes all of its clauses true ( so the empty clausal form { } is always true ). 3

  3. The satisfiability problem (SAT) is a fundamental problem from computer science. It is the problem to decide whether a formula of N Boolean variables can be satisfied, i.e. evaluated to TRUE by an assigment of the variables. Without loss of generality one can assume that the formula is organized as conjunction of clauses, where each clause is a disjunction of literals. SAT is a very important problem in theoretical computer science (some people would even say: the most important problem), but it has numerous practical applications as well.

  4. 5 5 Darwin Brisbane Perth Sydney Adelaide Melbourne Hobart

  5. 6 D B P S A M H

  6. 7 D 7 nodes 9 edges B P S A M H

  7. M elbourne 8 A delaide B risbane 21 S ydney D arwin H obart P erth atoms r ed Mr Sr Hr Dr Pr Ar Br g reen Mg Sg Hg Dg Pg Ag Bg a mber Ma Sa Ha Da Pa Aa Ba D 34 clauses 1 for each node (eg D) Dr ⋁ Dg ⋁ Da B 3 for each edge (eg D–B) ¬Dr ⋁ ¬Br S P A eg: ¬Dg ⋁ ¬Bg M Pr ≡ red(Perth) ¬Da ⋁ ¬Ba H

  8. M elbourne 9 A delaide B risbane 21 S ydney D arwin H obart P erth atoms r ed Mr Sr Hr Dr Pr Ar Br g reen Mg Sg Hg Dg Pg Ag Bg a mber Ma Sa Ha Da Pa Aa Ba Dr 34 clauses 1 for each node (e.g. D) Dr ⋁ Dg ⋁ Da Bg 3 for each edge (e.g. D–B) ¬Dr ⋁ ¬Br Sr Pg Aa ¬Dg ⋁ ¬Bg Mg ¬Da ⋁ ¬Ba Hr

  9. 10 Dr Bg Pg Sr Aa Mg Hr

  10. 11 Dr Bg Pg Sr Aa Mg Hr

  11. M elbourne 12 A delaide B risbane 21 S ydney D arwin H obart P erth atoms r ed Mr Sr Hr Dr Pr Ar Br g reen Mg Sg Hg Dg Pg Ag Bg a mber Ma Sa Ha Da Pa Aa Ba D 34 clauses 1 for each node (eg D) Dr ⋁ Dg ⋁ Da B 3 for each edge (eg D–B) ¬Dr ⋁ ¬Br S P A eg: ¬Dg ⋁ ¬Bg M Pr ≡ red(Perth) ¬Da ⋁ ¬Ba H

  12. 13

  13. Sudoku Squares i, j (i, j ∈ (1..9)) p i, j, k Numbers k (k ∈ (1..9)) means the number k is in square i,j 729 (= 9 3 ) Atoms p i, j, k A sudoku problem is defined 
 by saying which numbers are in which squares 14

  14. 15 at most one number per square every number occurs in each row every number occurs in each column every number occurs in top-left square every number occurs in centre-left square every number occurs in bottom-left square every number occurs in top-middle square

  15. 16 every number occurs in centre-middle square every number occurs in bottom-middle square every number occurs in top-right square every number occurs in centre-right square every number occurs in bottom-right square 729 atoms structural constraints include 
 many, many occurrences of literals How Many?

  16. 2-SAT A clausal form with at most two literals per clause. Corresponds to a conjunction of implications. We can draw the directed graph and count the satisfying valuations. When clauses with 3 or more literals are involved, satisfaction gets complicated. In general, we must search for satisfaction.

  17. If every clause has 2 variables (2-SAT) the problem is easy. If every clause has 3 variables (3-SAT) the problem is hard. A clause with K literals excludes 1/2 K of the 2 N possible assignments and the whole formula is satisfiable if the number of clauses is small compared to the number of variables. Just by counting, we can see that a K-SAT problem is satisfiable if the number of clauses is less than 2 K , and it is easy to exclude all valuations with 2 K clauses For a large number of variables, N, a random 3-SAT problem with N variables, with less than ~ 4.2 N clauses if is probably satisfiable; with more than ~ 4.2 N clauses if is probably not satisfiable. Hard problems appear near the boundary.

  18. V is a partial valuation Naïve search (a consistent set of literals) V^A = V ∪ {A} function SAT( Φ ,V) Φ is a set of clauses Φ |V = {} || {} ∉ Φ |V Φ | V is the result of && simplifying Φ using V: let A = chooseLiteral ( Φ ,V) For each literal L ∈ V in • remove clauses SAT ( Φ ,V ^ A) containing L || • delete ¬L from SAT ( Φ ,V ^ ¬A) remaining clauses chooseLiteral( Φ ,V) returns a literal occurring in Φ | V

  19. partial valuations

  20. 22 Φ Φ | V V : [] A B C A B C search [] ¬C B D ¬C B D ¬A B C ¬A B C ¬A ¬B ¬C ¬A ¬B ¬C

  21. 23 Φ Φ | V V : [A] A B C A B C search [] ¬C B D ¬C B D A ¬A B C ¬A B C ¬A ¬B ¬C ¬A ¬B ¬C

  22. 24 Φ Φ | V V : [A,B] A B C A B C search [] ¬C B D ¬C B D A AB ¬A B C ¬A B C ¬A ¬B ¬C ¬A ¬B ¬C

  23. 25 Φ Φ | V V : [A,B,C] A B C A B C search [] ¬C B D ¬C B D A ¬A B C ¬A B C AB A,B,C ¬A ¬B ¬C ¬A ¬B ¬C

  24. 26 Φ Φ | V V : [A,B] A B C A B C search [] ¬C B D ¬C B D A ¬A B C ¬A B C AB ✘ A,B,C ¬A ¬B ¬C ¬A ¬B ¬C

  25. 27 Φ Φ | V V : [A,B,C] A B C A B C search [] ¬C B D ¬C B D A ¬A B C ¬A B C AB A,B,C A,B,¬C ✘ ✔ ¬A ¬B ¬C ¬A ¬B ¬C

  26. 28 Φ Φ | V V : [A,B,C] A B C A B C search [] ¬C B D ¬C B D A ¬A B C ¬A B C AB A,B,C A,B,¬C ✘ ✔ ¬A ¬B ¬C ¬A ¬B ¬C

  27. 29 Φ Φ | V V : [A,B,C] A B C A B C search [] ¬C B D ¬C B D A ¬A B C ¬A B C AB A,B,C A,B,¬C ✘ ✔ ¬A ¬B ¬C ¬A ¬B ¬C

  28. 30 Φ Φ | V V : [A,B,C] A B C A B C search [] ¬C B D ¬C B D A ¬A B C ¬A B C AB A,B,C A,B,¬C ✘ ✔ ¬A ¬B ¬C ¬A ¬B ¬C

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend