110 likes | 214 Views
Happy Deepavali!. Oct 23 rd. 4 th Nov, 2002. 10/23. SAT & CSP. Average: 33 St Dev: 13.2 Max: 55.5 Min: 7. Midterm Histogram. 40. 55. 5. 15. 25. Marks. Review. Entailment by model checking.
E N D
Happy Deepavali! Oct 23rd 4th Nov, 2002.
10/23 SAT & CSP
Average: 33 St Dev: 13.2 Max: 55.5 Min: 7 Midterm Histogram 40 55 5 15 25 Marks
Review Entailment by model checking • We said entailment can be checked by truth table enumeration. Can we do the check without full enumeration? • SAT problem • Given a set of propositions • And a set of (CNF) clauses • Find a model (an assignment of t/f values to propositions) that satisfies all clauses • k-SAT is a SAT problem where all clauses are length less than or equal to k • SAT is NP-complete; • 1-SAT and 2-SAT are polynomial • k-SAT for k> 2 is NP-complete • If we have a procedure for solving SAT problems, we can use it to compute entailment • The senstence S is entailed, if negation of S, when added to the KB, gives a SAT theory that is unsatisfiable (NO MODEL) • CO-NP-Complete • SAT is useful for modeling many other “assignment” problems • We will see use of SAT for planning; it can also be used for Graph coloring, n-queens, Scheduling and Circuit verification etc (the last thing makes SAT VERY interesting for Electrical Engineering folks)
Review Compiling Planning into SAT Goals: In(A),In(B) One way of finding a k-length plan is to grow a k-length planning graph (with mutexes) and looking for a valid subgraph of this graph. If it is not found, extend the graph and try again Init: At-R-E-0 & At-A-E-0 & At-B-E-0 Goal: In-A-1 & In-B-1 Graph: “cond at k => one of the supporting actions at k” In-A-1 => Load-A-1 In-B-1 => Load-B-1 At-R-M-1 => Fly-R-1 At-R-E-1 => P-At-R-E-1 Load-A-1 => At-R-E-0 & At-A-E-0 “Actions at k => preconds at k-1” Load-B-1 => At-R-E-0 & At-B-E-0 P-At-R-E-1 => At-R-E-0h ~In-A-1 V ~ At-R-M-1 ~In-B-1 V ~At-R-M-1“Mutexes”
Init: J-0 Goal: P-2 & Q-2 Do the following for every cond; action and mutex at every level Graph: “cond at k => one of the supporting actions at k” P-2=> O1-2 V p-P-2 Q-2 => O2-2 V p-Q-2…. “Actions at k => preconds at k-1” O2-2 => J-1 p-P-2 => P-1 Mutexes ~P-2 V ~J-2 ~P-1 V ~Q-1 …. Planning as SAT (another example) A solution assignment will be J-0; O2-1; Q-1; p-Q-2; O1-2; P-2; Q-2;
SAT as Search • Search in the space of “partial assignments” (P=T,Q=F..) • Extend a partial assignment by picking a variable and generating the t/f children of the assignment • Nodes: partial assignments • Operators: assigning values to variables • We can assign variables in any order (commutative). So no need to consider more than one order • If a partial assignment is already inconsistent, you can kill the search • Depth first search is good enough • depth of the search tree is finite (= number of propositions) • all satisfying models are equally good. • All assignments are at depth d (d = # propositions)
Improvements? • Need hints on • Which prop to pick for assignment next? • Which value to try for it next? • Can we detect inevitable failures early on? • Involves inference • Notice the “circularity” • Inference can be done by SAT which involves inference (which can be done by SAT which involves inference… • Can we avoid previously encountered failures? • Can we improve the mobility of the search?
DPLL—does lookahead by unit propagation • DPLL is a procedure that basically implements this with 2 enhancements: • Unit propagation [Trying to detect inevitable failure early] • Before expanding a partial assignment, run unit resolution to completion • Apply inference of type [P ; ~P V Q VJ ] => Q V J repeatedly • Whenever a unit clause is found, set the corresponding variable to True, and remove all clauses that have that variable • If an empty clause is detected, the node is “dead”--Backtrack • Pure-literal elimination • If a proposition appears with the same polarity in all clauses it appears, set its value to that polarity, and remove all the clauses that it is part of. • Makes sense only if all satisfying assignments are equally desirable • E.g. be-god V study; be-god V practice
Davis-Putnam-Logeman-Loveland Procedure detect failure
Improvements to DPLL • Order in which propositions are selected • Select the most constraining prop first (the one that takes part in most clauses) • Select the prop which, when set, leads to most unit-propagation cascade [Costly, but works wonders—e.g SATZ) • Learning from mistakes (“Nogood” learning) • If we are forced to backtrack over particular partial assignment, remember the reason so if that reason holds in another branch, we can cut search. • Problem: Need to carefully control the amount of nogoods you remember (storage and matching costs). Works great in RelSAT. • Using random-restart policies to increase the “mobility” of the search • Many many many more.. (still continuing) • Read the overview paper on the quest for efficient boolean solvers