140 likes | 383 Views
Planning as Logic: Why logic?. Flexible language Range of expressive power/tractability Clear semantics and syntax Good solution processes Mature (older than computer science!) General purpose Fast!. Translate/Solve/Decode Architecture. Planning problem. Compiler. Logic problem. Solver.
E N D
Planning as Logic: Why logic? • Flexible language • Range of expressive power/tractability • Clear semantics and syntax • Good solution processes • Mature (older than computer science!) • General purpose • Fast!
Translate/Solve/Decode Architecture Planning problem Compiler Logic problem Solver Logical model Decoder Solution plan
Filling in the Blanks • What kind of logic? • How do we encode/decode as logical formulae? • What kind of solver?
Planning as Boolean Satisfiability • What kind of logic? • Propositional logic • Boolean satisfiability • How do we encode/decode as logical formulae? • Instantiate actions • Compile fixed length plan • What kind of solver? • Systematic: depth-first search/complete • Stochastic: randomized/incomplete
Translating to Propositional Logic • Predicate • Single positive literal for each instantiation of parameters at each time step • Initial state • Conjunction of all true literals + CWA at step 0 • Goal state • Conjunction of all goal literals at step n*2 • Actions • Instantiation of each action at each step with all possible combinations of parameters • Enforce preconditions/effects
Dinner Date Initial Conditions: (:and (cleanHands) (quiet)) Goal: (:and (noGarbage) (dinner) (present)) Actions: (:operator carry :precondition :effect (:and (noGarbage) (:not (cleanHands))) (:operator dolly :precondition :effect (:and (noGarbage) (:not (quiet))) (:operator cook :precondition (cleanHands) :effect (dinner)) (:operator wrap :precondition (quiet) :effect (present))
Dinner Date: Logical Form • Initial conditions: (:and (cleanHands0) (quiet0) (:not (noGarbage0)) (:not (dinner0)) (:not (present0))) • Goal state: (:and (noGarbagen*2) (dinnern*2) (presentn*2)) • Actions (for every odd i): (:implies (cooki) (:and ;; preconditions (cleanHandsi-1) ;; effects (dinneri+1))) Is this enough?
Frame Axioms and Exclusions • What about GraphPlan’s no-ops? • Frame axioms • An action only changes a predicate if it explicitly includes that predicate in its effect list or • If a variable’s truth value changes, some action must have caused that change • What about mutual exclusivity? • Serial exclusions: at most one action per time-step • Parallel exclusions: if actions are exclusive, insert a clause which keeps them from occurring in parallel
Dinner Date: Logical Form Continued • For every odd time step i: (:implies (:and (:not noGarbagei-1) (noGarbagei+1)) (:or (carryi) (dollyi))) • For every odd time step i: (:or (:not carryi) (:not cooki))
Dinner Date in CNF !STEP1~NOGARBAGE STEP0~ACTION-CARRY STEP0~ACTION-DOLLY STEP1~NOGARBAGE STEP1~ACTION-CARRY STEP1~ACTION-DOLLY !STEP1~DINNER STEP0~ACTION-COOK STEP1~DINNER STEP1~ACTION-COOK STEP0~ACTION-CARRY STEP1~CLEAN-HANDS STEP1~CLEAN-HANDS !STEP2~CLEAN-HANDS STEP1~ACTION-CARRY !STEP1~CLEAN-HANDS STEP2~CLEAN-HANDS !STEP1~PRESENT STEP0~ACTION-WRAP STEP1~PRESENT STEP1~ACTION-WRAP STEP0~ACTION-DOLLY STEP1~QUIET STEP1~QUIET !STEP2~QUIET STEP1~ACTION-DOLLY !STEP1~QUIET STEP2~QUIET STEP1~NOGARBAGE !STEP0~ACTION-CARRY !STEP0~ACTION-CARRY !STEP1~CLEAN-HANDS STEP1~NOGARBAGE !STEP0~ACTION-DOLLY !STEP0~ACTION-DOLLY !STEP1~QUIET STEP1~DINNER !STEP0~ACTION-COOK STEP1~PRESENT !STEP0~ACTION-WRAP !STEP1~ACTION-CARRY !STEP2~CLEAN-HANDS !STEP1~ACTION-DOLLY !STEP2~QUIET !STEP1~ACTION-COOK STEP1~CLEAN-HANDS !STEP1~ACTION-WRAP STEP1~QUIET !STEP0~ACTION-CARRY !STEP0~ACTION-COOK !STEP1~ACTION-CARRY !STEP1~ACTION-COOK !STEP0~ACTION-DOLLY !STEP0~ACTION-WRAP !STEP1~ACTION-DOLLY !STEP1~ACTION-WRAP After initial unit propagation 26 Clauses 23 Variables
Satisfiability Solvers • Systematic • Complete • Depth first search: never repeat states • Global • Systems: RelSAT, Tableau, LPSAT, … • Stochastic • Incomplete • Simulated annealing to choose next state • Local • Systems: WalkSat, GSat, ...
DPLL Algorithm: Definitions satisfied = CNF statement is empty inconsistent = any clause in the CNF statement is empty unit clause = any clause with exactly one literal pure literal = any literal whose negation never appears in the CNF statement
Systematic Solver:DPPL Algorithm Procedure DPLL(φ: CNF problem) If φ is satisfied, return YES Else if φ is inconsistent, return NO Else if there is a unit clause {} or pure literal in φ, return DPLL(φ|) Else choose a variable in φ. If DPLL(φ|), return YES Else, return DPLL(φ|)
F q F T F unit var pure literal unit var t s T r DPLL Example {r, s, t} {p, q} {q, p} {s, t} {s, p} {t, p} {p, q} {q, p} {s, t} {s, p} {t, p} T pure literal p T {q} {s, t} {s} {t} {q} {s, t} s {q} {t} {t} {s, t} T unit var {q} {}