560 likes | 726 Views
Improving SATPLAN and DPLL by Inferring Additional Constraints: Clause Learning, Invariants, Symmetries. Henry Kautz Logical Foundations of AI. Satplan in 15 Seconds. Time = bounded sequence of integers Translate planning operators to propositional schemas that assert:. Satplan in 15 Seconds.
E N D
Improving SATPLAN and DPLL by Inferring Additional Constraints:Clause Learning,Invariants,Symmetries • Henry Kautz • Logical Foundations of AI
Satplan in 15 Seconds • Time = bounded sequence of integers • Translate planning operators to propositional schemas that assert:
Satplan in 15 Seconds • Time = bounded sequence of integers • Translate planning operators to propositional schemas that assert:
Plan Graph Based Instantiation • initial state: p • action a: precondition: p effect: p • action b: precondition: p effect: p q m0 m1 = = p0 p1 p2 a0 a1 b1 q2
International Planning Competition • IPC-2004: 1st place, Optimal Planning • Best on 5 of 7 domains • 2nd best on remaining 2 domains PROLEMA / philosophers
International Planning Competition • IPC-2006: Tied for 1st place, Optimal Planning • Other winner, MAXPLAN, is a variant of Satplan!
What Changed? • Small change in modeling • Modest improvement from 2004 to 2006 • Significant change in SAT solvers!
Heavy Tails Bad scaling of systematic solvers can be caused by heavy tailed distributions Deterministic algorithms get stuck on particular instances but that same instance might be easy for a different deterministic algorithm! Expected (mean) solution time increases without limit over large distributions
Randomized Restarts Solution: randomize the systematic solver Add noise to the heuristic branching (variable choice) function Cutoff and restart search after a fixed number of backtracks Provably Eliminates heavy tails In practice: rapid restarts with low cutoff can dramatically improve performance (Gomes, Kautz, and Selman 1997, 1998)
Run-Time Distribution of Restart Strategies Independent trials:
Rapid Restart on LOG.D Note Log Scale: Exponential speedup!
Satplan in 15 Seconds • Time = bounded sequence of integers • Translate planning operators to propositional schemas that assert:
DPLL Algorithm DPLL(F) // Perform unit propagation while exists unit clause (y) F F F|y if F is empty, report satisfiable and halt if F contains the empty clause L, return else choose a literal x DPLL(F|x) DPLL(F|x) Remove all clauses containing y Shrink all clauses containing y
Extending DPLL: Clause Learning When backtracking in DPLL, add new clauses corresponding to causes of failure of the search EBL [Stallman & Sussman 77, de Kleer & Williams 87] CSP [Dechter 90] CL [Bayardo-Schrag 97, MarquesSilva-Sakallah 96, Zhang 97, Moskewicz et al. 01, Zhang et al. 01] Added conflict clauses • Capture reasons of conflicts • Obtained via unit propagations from known ones • Reduce future search by producing conflicts sooner
x1 y x2 false y 1-UIP scheme(t) t x3 p q a b t Decision scheme (p q b) FirstNewCut scheme (x1 x2 x3) Conflict Graphs Known Clauses (p q a) ( a b t) (t x1) (t x2) (t x3) (x1 x2 x3 y) (x2 y) Current decisions p false q false b true
CL Critical to Performance Best current SAT algorithms rely heavily on CL for good behavior on real world problems GRASP [MarquesSilva-Sakallah 96], SATO [H.Zhang 97]zChaff [Moskewicz et al. 01], Berkmin [Goldberg-Novikov 02] However, • No good understanding of strengths and weaknesses of CL • Not much insight on why it works well when it does
Harnessing the Power of Clause Learning(Beame, Kautz, & Sabharwal 2003) • Mathematical framework for analyzing clause learning • Characterization of its power in relation to well-studied topics in proof complexity theory • Ways to improve solver performance based on formal analysis
Proofs of Unsatisfiability When F is unsatisfiable, • Trace of DPLL on F is a proof of its unsatisfiability • Boundonshortest proof of F givesbound on best possible implementation • Upper bound – “There is a proof no larger than K” • Potential for finding proofs quickly • Best possible branching heuristic, backtracking, etc. • Lower bound – “Shortest proof is at least size K” • Inherent limitations of the algorithm or proof system
L empty clause Proof size = 9 c c (b c) (a b) (a c) a (bc) (a c) Proof System: Resolution F=(a b) (a c) a (b c) (a c) Unsatisfiable CNF formula
Special Cases of Resolution Tree-like resolution • Graph of inferences forms a tree DPLL Regular resolution • Variable can be resolved on only once on any path from input to empty clause Directed acyclic graph analog of DPLL tree • Natural to not branch on a variable once it has been eliminated • Used in original DP [Davis-Putnam 60]
Proof System Hierarchy … Space of formulas with poly-size proofs Frege systems … Pigeonhole principle [Haken 85] General RES [Alekhnovich et al. 02] Regular RES [Bonet et al. 00] Tree-like RES
Formula f • Poly-size RES proof • Exp-size Regular proof Thm1. CL can beat Regular RES • Formula PT(f,) • Poly-size CL proof • Exp-size Regular proof Regular RES CL General RES Regular RES DPLL Example formulas GTn Ordering principlePeb Pebbling formulas [Alekhnovich et al. 02]
Implications? DPLL algorithms w/o clause learning arehopeless for certain formula classes CL algorithms have potential for small proofs Potential is realized by good heuristic for branching!
Adding Control Kx to SATPLAN Problem Specification Axioms Control Knowledge Axioms Instantiated Clauses As control knowledge increases, Core shrinks! SAT Simplifier SAT “Core” SAT Engine
Scale Up with Compiled Control Knowledge • Significant scale-up using axiomatic control knowledge • Same knowledge useful for both systematic and local search engines • simple DP now scales from 1010 to 1016 states • order of magnitude speedup for Walksat • Control axioms summarize general features of domain / good plans: not a detailed program! • Many kinds of control knowledge can be created automatically • State invariants – TIMS (Fox & Long), DISCOPLAN (Gerivini & Schubert) • Symmetry breaking – (Fox & Long), (Joslin & Roy), (Rintennan), (Agarwal 2005) • Rule out some “equivalent” solutions • Retains guarantees of solvability & optimality
Symmetry in Planning Part II: Sources of symmetry, discovery and exploitation in planning
What is Symmetry? • A problem has a symmetry if we can exchange (rename) some subset of its propositions and obtain the same problem. • For example: Consider a logistics planning problem that requires two packages, A and B, to delivered from City 1 to City 2. There are two trucks available, named X and Y. • This problem has a symmetry, because the propositions involving the packages can be exchanged, as can those involving the trucks.
X Y Y X A A B B B A Example Destination
The Impact of Symmetries:SatPlan • SatPlan uses DFS (DPLL) • Symmetries leads to multiple equivalent choices: if one fails, they all fail • Clause learning alone doesn’t help, because different propositions are involved • DPLL discovers multiple failures by repeated search
Breaking Symmetry in Encoding • Sometimes it is possible to reduce symmetries by changing to a “counting” encoding of the problem: • Replace individually named objects with simple counts of the numbers of objects in different states
Example • Gripper problem (transport a collection of symmetric objects from one location to another using symmetric grippers)
Encoding of Gripper: Actions • (:action pick • :parameters (?b – ball ?g – gripper ?r – room) • :precondition (and (at ?b ?r) (atRobot ?r) (free ?g)) • :effect (and (holding ?g ?b) (not (at ?b ?r)) (not (free ?g))) • ) • (:action drop • :parameters (?b – ball ?g – gripper ?r – room) • :precondition (and (holding ?g ?b) (atRobot ?r)) • :effect (and (at ?b ?r) (not (holding ?g ?b)) (free ?g)) • ) • (:action move • :parameters (?rf ?rt – room) • :precondition (atRobot ?rf) • :effect (and (atRobot ?rt) (not (atRobot ?rf))) • )
Encoding of Gripper: Problem (:objects ball1 ball2 ball3 ball4 ball5 ball6 … - ball left right – gripper roomA roomB – room) (:init (atRobot roomA) (free left) (free right) (at ball1 roomA) (at ball2 roomA) … ) (:goal (and (at ball1 roomB) (at ball2 roomB) … )) The potential symmetry states of balls are: in room A, in room B, in a gripper Grippers can be free or holding something
Encoding of Gripper II: Actions (:action pick :parameters (?r – room) :precondition (and (> (atBalls ?r) 0) (atRobot ?r) (> (free) 0)) :effect (and (increase (holding) 1) (decrease (atBalls ?r) 1) (decrease (free) 1)) ) (:action drop :parameters (?r – room) :precondition (and (> (holding) 0) (atRobot ?r)) :effect (and (increase (atBalls ?r) 1) (decrease (holding) 1) (increase (free) 1)) ) (:action move :parameters (?rf ?rt – room) :precondition (atRobot ?rf) :effect (and (atRobot ?rt) (not (atRobot ?rf))) )
Encoding of Gripper II: Problem (:objects roomA roomB – room) (:init (atRobot roomA) (= (free) 2) (= (atBalls roomA) 10) (= (atBalls roomB) 0) (= (holding) 0)) (:goal (= (atBalls roomB) 10))
Symmetry Breaking • Another approach is to detect and “break” symmetries in the CNF formula itself • Basic idea: if propositions P and Q are symmetric (e.g. Pickup(Ball1, T1) and Pickup(Ball2, T1)), then add: • P => Q