320 likes | 402 Views
QBF Modeling : Exploiting Player Symmetry for Simplicity and Efficiency. Ashish Sabharwal , Carlos Ansotegui, Carla P. Gomes, Justin W. Hart, Bart Selman Cornell University SAT Conference, August 2006 Seattle, WA. The Goal of This Work.
E N D
QBF Modeling: Exploiting Player Symmetry for Simplicity and Efficiency Ashish Sabharwal, Carlos Ansotegui,Carla P. Gomes, Justin W. Hart, Bart Selman Cornell University SAT Conference, August 2006 Seattle, WA
The Goal of This Work To significantly extend the reach of QBF reasoning by • Investigating and improving basic modeling framework • Retaining the benefits of CNF for SAT/QBF solvers • E.g., must avoid “higher level” representations • Maintaining (or enhancing) simplicity of representation Our driving force: • Real-World Reasoning Program • A set of challenging QBF benchmarks • With many quantifier alternations • Encoding a hard adversarial task: chess-style end games SAT 2006
Our Contribution We propose a simple but fundamental change in the way problems are modeled as QBF instances, and solved. • A systematic modeling technique based on a game theoretic view and SAT-based planning ideas • A split CNF-DNF dual encoding (existential player modeled as CNF, universal player as DNF) • A new QBF solver Duaffle (“dual-Quaffle”) • 2+ orders of magnitude improvement through • Better propagation across quantifiers • Avoidance of “illegal search space” issue • “Simpler” encoding w.r.t. previous approaches SAT 2006
Roadmap of the Talk FourKey Challenges The Basicsof QBF Our Approach:From problem to games dual representation dual solver Summary ExperimentalResults SAT 2006
Roadmap of the Talk FourKey Challenges The Basicsof QBF Our Approach:From problem to games dual representation dual solver Summary ExperimentalResults SAT 2006
SAT, QBF, CNF, and DNF • F : a Boolean formula • e.g. F = (a or b) and (not (a and (b or c))) • 3 satisfying assignments: (a,b,c) = (1,0,0), (0,1,0), (0,1,1) • F in CNF: FCNF = (a or b) and (a or b) and (b or c) • F in DNF: FDNF = (a and b) or (a and b and c) • SAT: Does F have any satisfying assignments? • NP-complete for FCNF, trivial for FDNF • QBF: Is a given (totally) quantified Boolean formula True? • e.g. G = a,b c. (a or b) and (not (a and (b or c))) • GCNF = a,b c. FCNF, GDNF = a,b c. FDNF • In general, an unbounded number of quantifier layers • PSPACE-complete for both CNF and DNF forms SAT 2006
CNF Format and SAT Many good reasons to use the CNF format for SAT: • Fairly “natural” representation • Many problems are a conjunction of several constraints • Each constraint in itself is often simple and easy to satisfy • Efficient pruning of unsat. parts of the search space • Violation of any single constraint by a partial assignment can be detected immediately • Simplicity • Lends itself easily to clever techniques and data structures(e.g. watched literals, conflict graph, …) • Provides a clear uniform standard SAT 2006
Is CNF Equally Good for QBF? • Many advantages • SAT techniques “carry over” to QBF(encoder format, clause learning, unit propagation, watched literals, restarts, …) • Can quickly extend existing SAT solvers to QBF solvers(search both assignments for universal variables) • This approach led to the first QBF solvers based on DPLL, local search, Q-resolution, etc. So far so good. The problem?Modern SAT solvers scale very well (1M + variables),but modern QBF solvers don’t! (~10 K vars) SAT 2006
The Message • Provides effective propagation • Avoids QBF-specific search issues • Results in a simpler encoding • Improves state-of-the-art by orders of magnitude Assuming CNF is a good modeling language for SAT, a split CNF-DNF representation is the right format for QBF SAT 2006
Roadmap of the Talk FourKey Challenges The Basicsof QBF Our Approach:From problem to games dual representation dual solver Summary ExperimentalResults SAT 2006
Challenge #1 • Most QBF benchmarks have only 2-3 quantifer levels • Might as well translate into SAT (it often works!) • Benchmarks with many levels are often the hardest • Practical issues in both modeling and solving become much more apparentwith many quantifier levels • Our benchmarks encode chess-like problems with 7-15 quantifier levels Can QBF solvers be made to scale well with10+ quantifier alternations? SAT 2006
Challenge #2 QBF solvers extremely sensitive to encoding! • Especially with many quantifier levels, e.g., evader-pursuer chess instances [Madhusudan et al. 2003] Can we design generic QBF modeling techniquesthat are simple and efficient for solvers? SAT 2006
? q-unsat: too few steps for White Challenge #3 For QBF, traditional encodings hinder unit propagation • E.g. unsatisfiable “reachability” queries • A SAT solver would have simply unit propagated • QBF solvers need 1000’s of backtracks and complex mechanisms like learning Can we achieve unit propagation across quantifiers? SAT 2006
Lack of Effective Propagation Question:Can White reach thepink square withoutbeing captured? q-unsat:White has one toofew available moves SAT 2006
Challenge #4 QBF solvers suffer from the “illegal search space issue”[Ansotegui et al. 2005] • Auxiliary variables needed for conversion into CNF • Can push solver into large irrelevant parts of search space • Note: negligible impact on SAT due to effective propagation • Best fix for QBF: condQuaffle (passes “flags” to the solver) Can we somehow completely avoid the illegal searchspace issue by using a better representation? SAT 2006
Original 2N Aside: Search Space for SAT Effect of addingauxiliary variables Search Space SAT Encoding 2N+M Original Search Space 2N Space Searched by SAT Solvers 2N/C ; Nlog(N); Poly(N) SAT 2006
Search Space Standard QBF Encoding 2N+M’’ Original 2N Aside: Search Space for QBF Search Space QBF Encoding 2N+M’ Can we reduce the search space With clever encodings , streamlining, etc? Original Search Space 2N SAT 2006
Roadmap of the Talk FourKey Challenges The Basicsof QBF Our Approach:From problem to games dual representation dual solver Summary ExperimentalResults SAT 2006
The Traditional Approach CNF-basedQBF encoding QBF Solver Problemof interest e.g. chess end-game, circuit minimization,adversarial planning, … Solution! Any discreteadversarial task SAT 2006
Overview of Our Approach Game G: players E & U,states, actions, rules, goal AdversarialTask “Planning as Satisfiability” framework (standard) e.g. chess end-game, circuit minimization,adversarial planning, … Create CNF encodingseparately for E and U: initial state axioms, action implies precondition,fact implies achieving action, frame axioms, goal condition Solution! Dual (split)CNF-DNF encoding QBF SolverDuaffle NegateCNF part for U(creates DNF) SAT 2006
From Adversarial Tasks To Games Example #1: Circuit Minimization: Given a circuit C, is there a smaller circuit computing the same function as C? • Related QBF benchmarks: adder circuits, sorting networks • A game with 2 turns • Moves: First, E commits to a circuit CE; second, U produces an input p and computations of CE, C on p. • Rules: CE must be a legal circuit smaller than C; U must correctly compute CE(p) and C(p). • Goal: E wins if CE(p) = C(p) no matter how U chooses p • “E wins” iff there is a smaller circuit SAT 2006
From Adversarial Tasks To Games Example #2: The Chromatic Number Problem: Given a graph G and a positive number k, does G have chromatic number k? • Chromatic number: minimum number of colors needed to color G so that every two adjacent vertices get different colors • A game with 2 turns • Moves: First, E produces a coloring S of G; second, U produces a coloring T of G • Rules: S must be a legal k-coloring of G; T must be a legal (k-1)-coloring of G • Goal: E wins if S is valid and T is not • “E wins” iff G has chromatic number k SAT 2006
From Games to Formulas Use the “planning as satisfiability” framework • I : Initial conditions • TrE : Rules for legal transitions/moves of E • TrU : Rules for legal transitions/moves of U • GE : Goal of E (negation of goal of U) Two alternative formulations of the QBF Matrix CNFclauses Fits circuit minimization,chromatic number problem, etc. M1 = I TrE (TrU GE) M2 = TrU (I TrE GE) Fits games like chess, etc. SAT 2006
The Dual Encoding Two alternative formulations of the dual QBF matrix M’1 = (I TrE) (TrU GU) CNF DNF (negation of CNF clauses) M’2 = (I TrE GE) TrU In contrast with[Zhang, AAAI ’06]:split, non-redundant Variables : state vars S1, S2, …, Sk+1 action vars A1, A2, …, Ak S1 A1S2 A2S3 A3S4 AkSk+1 M’i i {1,2} SAT 2006
The Dual Encoding: Example • Chess: White as E, Black as U • TrE: Transition axioms for E: CNF clauses e.g. Move(Wking, sqA, sqB, step 5) Loc(Wking, sqA, 5) • TrU: Transition axioms for U: DNF terms(negated “traditional” axiom clauses) e.g. Move(Bking, sqA, sqB, step 5) Loc(Bking, sqA, 5) SAT 2006
Our QBF Solver: Duaffle “dual-Quaffle” • An extension of Quaffle[Zhang-Malik ’02] • Quaffle already supports DNF terms (“cubes”) • However, its DNF terms are deduced from the CNF input • For us, DNF and CNF parts are “independent” propagation mechanism changes • Most features remain unchanged(e.g. parser, data structures, decision heuristic, clause and cube learning, fast backjumping, …) SAT 2006
Duaffle: Input Format c Dual QBF format c 100 variables c 25 CNF clauses, 32 DNF terms c p cnfdnf and 100 25 32 c c Quantifiers e 1 2 5 9 23 56 … 0 a 6 7 21 22 … 0 … 0 c CNF clauses -4 -7 8 12 0 9 5 -55 0 … 0 c DNF terms 43 -61 -2 0 4 1 -100 0 … 0 • Straightforward extensionof QDIMACS format • Specifies quantification,CNF clauses, DNF terms • Additional flag for choosingbetween formulations M’1 (connective ) and M’2 (connective ) SAT 2006
Duaffle: Backtracking Policy • E.g. what should we do when the CNF part is satisfied but the DNF part is not? • Extension of Quaffle’s policy(Quaffle never encounters certain possibilities because its DNF part is logically deduced from the CNF part) DNF part DNF part U F T U F T U U CNFpart CNFpart F F T T For formulation M’2 For formulation M’1 SAT 2006
Roadmap of the Talk FourKey Challenges The Basicsof QBF Our Approach:From problem to games dual representation dual solver Summary ExperimentalResults SAT 2006
Experimental Results 5-15 quantifier levels (reachability) 7-9 quantifier levels SAT 2006
Experimental Results, contd. 7-9 quantifier levels Duaffle (even without learning) on the dual encoding dramatically outperforms all leading CNF-based QBF solvers on these challenging instances SAT 2006
Summary • A new QBF modeling approach • Uses a split CNF-DNF representation • Preserves benefits of CNF • Leverages modern QBF solvers’ ability to handle DNF • Based on a systematic view of problems as games, and the planning as satisfiability framework • A dual format QBF solver, Duaffle • Extends Quaffle • Outperforms all existing QBF solvers (on xChess) by orders of magnitude, even without clause/cube learning SAT 2006