260 likes | 277 Views
Algorithms and Problems for Quantified SAT. Ian P. Gent School of Computer Science University of St Andrews Scotland. Toby Walsh Department of Computer Science University of York England. Algorithms and Problems for Quantified SAT. 1. Quantified Satisfiability QSAT
E N D
Algorithms and Problemsfor Quantified SAT Ian P. Gent School of Computer Science University of St Andrews Scotland Toby Walsh Department of Computer Science University of York England
Algorithms and Problemsfor Quantified SAT 1. Quantified Satisfiability QSAT 2. The Evaluate Algorithm 3. A New Algorithm 4. Phase Transitions 5. Phase Transition in QSAT
Quantified satisfiability (QSAT) • Existential quantifiers • as in propositional SAT • Universal quantifiers • "x.$ y. (x v y) & (-x v -y) • x=true, then y=false satisfies • x=false, then y=true satisfies • also called quantified Boolean formulae (QBF) QSAT can be seen as an alternating game between existentials which want to make formula true, and universals which want to make it false
Complexity of QSAT • PSPACE-complete • no limit on number of alternating quantifiers • problems needing polynomial space on a Turing machine • k-QSAT • k alternations, $ innermost • Sk P-complete • CNFformulae • does not change complexity
Algorithms for QSAT • Recent Algorithms by... • Cadoli, Giovanardi & Schaerf, AAAI 98, SAT 2000. • simple to avoid • Both based on similar idea • Work `outside in' • Set outermost quantifiers first, then next level ... • Both make extensive use of propagation rules • I will present a simplified version of Cadoli's
Cadoli et al's Evaluate algorithm • Two mutually recursive functions • U-evaluate for universal quantifiers • E-evaluate for existential quantifier • Many propagation rules in each • e.g. `unit propagation' • If a clause exists with only a single existential literal • ... commit to the E-variable having the relevant value • I will not detail propagation rules • Focus on branching nature of search ... • ... and an unusual preprocessing step
An unusual preprocessing step • Given a QSAT formula F • Form existential simplification E(F) • Discard universal literals in F • Solve E(F) as SAT problem (not as QSAT) • Use classic Davis-Putnam • If DP succeeds, F is soluble as QSAT • Same values of e-variables works for all values of u-variables
Function U-Evaluate(F) • If clause set is empty, succeed • If there is empty/all universal clause, fail • Try Davis-Putnam on Existential Simplification • If this solves all clauses, succeed • Apply Propagation rules • If the outermost quantifier is now Existential • Return result of E-evaluate(F) • Choose a U-variable u • Fail if U-Evaluate(F u:=true) fails • Else return result of U-Evaluate(F u:=false)
Function E-Evaluate(F) • If clause set is empty, succeed • If there is empty/all universal clause, fail • Try Davis-Putnam on Existential Simplification • If this solves all clauses, succeed • Apply Propagation rules • If the outermost quantifier is now Universal • Return result of U-evaluate(F) • Choose a E-variable e • Succeed if E-Evaluate(F e:=true) succeeds • Else return result of E-Evaluate(F e:=false)
Thoughts about theAlgorithms • Both Rintanen/Cadoli algorithms successful • Cadoli et al on Random Problems • Rintanen on `Conditional Planning' Problems • Blind search successful • especially notable in U-evaluate • simple enumeration of possibilities • SAT preprocessing successful • yet work often discarded • New algorithm should: • avoid blind search/avoid discarding SAT work
Failure Driven Search • Any partial solution (e.g. from DP) is helpful ... • ... as long as it solves all clauses without universals • The existential assignment solves many clauses • applies to all universal assignments ... • except those invalidating universals in unsat clauses • Future tests need only solve remaining cases • Failure-driven rather than blind search • Exploits work done by failed calls to DP
No-commitment Search • We can try hard to avoid guessing universals • Set them as unknown initially • Treat all literals as false if value = unknown • Attempt to solve without choosing value • Only forced to choose a value on backtracking • for universal values not solved by existentials
Hard and Soft Clauses • Soft Clauses • clauses that can be left unsolved on this attempt • have some free universal variables • e.g. U or V or W or E • if we set E = false, have solution when U/V/W true • next test we set U=V=W=false and force new solution • Hard Clauses • clauses that must be solved for problem to be soluble • i.e. No universal variables, e.g. E
Revised E-evaluate • Takes hard and soft clauses as input • Fails if hard clauses alone are insoluble • Succeeds if hard clauses are soluble • solves as many soft clauses as possible • can use heuristic method on soft clauses • returns list of unsatisfied soft clauses • Calls U-evaluate recursively for hard clauses
Revised U-evaluate([F]) • Uses ToDo list ofsubproblems • Initially ToDo = [ F ] • Succeed when ToDo empty • Removes element G of ToDo list • Call E-evaluate(G) • fail if E-evaluate fails • if E-evaluate succeeds ... • for each unsat soft clause returned • assign universals so as to unsatisfy the soft clause • add the resulting simplified problem to ToDo • Return result of U-evaluate on revised ToDo list
Comments • Where did DP go? • DP call evaporates! • First step in U-evaluate is to call E-evaluate • We are always reasoning on existentials first • DP could be used as heuristic on soft clauses • As could WalkSAT ... Where is unknown value set? • Unknown value is set implicitly • when U-evaluate calls E-evaluate without setting universal
Conclusions (Algorithms) • Recent algorithms making QSAT feasible • Existing algorithms have possible drawbacks • blind search • wasted work • Can remove these drawbacks • Exercises for the interested author... • Correctness proof (except 2-QSAT) • Implementation • Empirical Evaluation
Phase transition behaviour • Seen in many NP-hard problems • SAT, CSP, number partitioning, TSP ... • seminal IJCAI-91 paper by Cheeseman, Kanefsky & Taylor • rapid solubility transition • around <Sol> » 1
Phase transition behaviour • Complexity peak • associated with solubility transition • easy-hard-easy • problems on "knife-edge" • a theory of constrainedness • models such behaviour • k= 1-log(<Sol>)/n • AAAI-96, 97, 98
Other complexity classes • Polynomial problems • enforcing arc-consistency in CSPs [CP-97] • worst-case complexity seen at phase boundary • k useful to predict location of transition • What about higher complexity classes?
QSAT phase transition • Fixed clause length model • k alternating quantifiers • each with n variables • l clauses each with h literals • Cadoli et al (AI*IA97, AAAI98) • not always an easy-hard-easy pattern • solubility transition at l µÖn
Flawed problem generation! Easy fix: discard unit clauses • Propositional satisfiability • may generate unit clauses, x and -x • just as 2 people here are likely to have same birthday • Quantified satisfiability • may generate clause with single existential, x and another with -x • no satisfying assignment • simple argument gives l µÖn Two fixes: Model A, discard clauses with one or fewer existentials Model B, fix number of existentials in each clause
QSAT phase transition • Easy-hard-easy pattern now clearly visible • phase transition around fixed l/n 2-QSAT, 3-cnf
QSAT phase transition • Clear complexity "ridge" • varying l/n, and proportion of universals • larger gap between higher percentiles than in NP? ãJ. Rintanen
Conclusions (Transitions) • Be careful of "flaws" • SAT, CSP, QSAT ... • simple to avoid • QSAT phase transition • similar to that seen in NP • constrainedness, k useful but less accuate • We predict similar results in other PSPACE problems • gameplaying and planning