Planning Introduction Early works Significance Formalizations Encoding Planning as an Instance of SAT Basics Solving AI Planning Problems with SAT Parallel Plans Solver Calls Sequantial Strategy Jussi Rintanen Parallel Strategy A Parallel Strategy B Parallel Strategy C Summary EPCL, Dresden, November 2013 SAT solving Depth-first Undirected Evaluation Invariants Algorithm Conclusion References 1 / 44 2 / 44 Introduction Early works Introduction Significance Reduction of AI Planning to SAT Significance Kautz and Selman 1992 [KS92] ◮ Planning one of the first “real” applications for SAT (others: ◮ Solving the AI planning problem with SAT algorithms graph-coloring, test pattern generation, ...) ◮ Novelty: planning earlier viewed as a deduction problem ◮ Later, same ideas applied to other reachability problems: ◮ Idea: ◮ computer-aided verification (Bounded Model-Checking [BCCZ99]) ◮ propositional variables for every state variable for every time point ◮ DES diagnosability testing [RG07] and diagnosis [GARK07] ◮ clauses that describe how state can change between two consecutive time ◮ SAT and related methods currently a leading approach to solving state points space reachability problems in AI and other areas of CS. ◮ unit clauses specifying the initial state and goal states ◮ Overlooked connection: the encoding is very close to Cook’s reduction ◮ Test material for local search algorithm GSAT [SLM92] from P-time Turing machines to SAT in his proof of NP-hardness of SAT ◮ Resulting SAT problems that could be solved had up to 1000 variables [Coo71]. and 15000 clauses. 3 / 44 4 / 44
Introduction Formalizations Introduction Formalizations Classical (Deterministic, Sequential) Planning Formalization ∼ succinct s-t-reachability problem for graphs A problem instance in (classical) planning consists of the following. ◮ states and actions expressed in terms of state variables ◮ set X of state variables ◮ single initial state, that is known ◮ set A of actions � p, e � where ◮ all actions deterministic ◮ p is the precondition (a set of literals over X ) ◮ actions taken sequentially, one at a time ◮ e is the effects (a set of literals over X ) ◮ a goal state (expressed as a formula) reached in the end ◮ initial state I : X → { 0 , 1 } (a valuation of X ) ◮ goals G (a set of literals over X ) Deciding whether a plan exists is PSPACE-complete. With a polynomial bound on plan length, NP-complete. 5 / 44 6 / 44 Introduction Formalizations Encodings Basics The planning problem Encoding of Actions as Formulas for Sequential Plans Let x @ t be propositional variables for t ∈ { 0 , . . . , T } and x ∈ X . An action a = � p, e � is applicable in state s iff s | = p . a = � p, e � is mapped to E a @ t which is the conjunction of The successor state s ′ = exec a ( s ) is defined by ◮ l @ t for all l ∈ p , and ◮ s ′ | = e ◮ for all x ∈ X ◮ s ( x ) = s ′ ( x ) for all x ∈ X that don’t occur in e . x @( t + 1) ↔ ⊤ if x ∈ e, x @( t + 1) ↔ ⊥ if ¬ x ∈ e, and Problem x @( t + 1) ↔ x @ t otherwise . Find a 1 , . . . , a n such that exec a n ( exec a n − 1 ( · · · exec a 2 ( exec a 1 ( I )) · · · )) | = G ? Choice between actions a 1 , . . . , a m expressed by the formula R @ t = E a 1 @ t ∨ · · · ∨ E a m @ t. 7 / 44 8 / 44
Encodings Basics Encodings Parallel Plans Reduction of Planning to SAT Parallel Plans: Motivation Kautz and Selman, ECAI’92 Define ◮ I @0 as � ( { x @0 | x ∈ X, I ( x ) = 0 } ∪ {¬ x @0 | x ∈ X, I ( x ) = 1 } ) , and ◮ G @ T as � l ∈ G l @ T ◮ Don’t represent all intermediate state at t + 1 states of a sequential plan. Theorem ◮ Ignore relative ordering of A plan of length T exists iff consecutive actions. ◮ Reduced number of explicitly T − 1 represented states ⇒ smaller � Φ T = I @0 ∧ R @ t ∧ G @ T formulas ⇒ easier to solve t =0 is satisfiable. state at t 9 / 44 10 / 44 Encodings Parallel Plans Encodings Parallel Plans Parallel plans ( ∀ -step plans) ∀ -step plans: encoding Kautz and Selman 1996 Define R ∀ @ t as the conjunction of Allow actions a 1 = � p 1 , e 1 � and a 2 = � p 2 , e 2 � in parallel whenever they don’t x @( t + 1) ↔ (( x @ t ∧ ¬ a 1 @ t ∧ · · · ∧ ¬ a k @ t ) ∨ a ′ 1 @ t ∨ · · · ∨ a ′ k ′ @ t ) interfere, i.e. ◮ both p 1 ∪ p 2 and e 1 ∪ e 2 are consistent, and for all x ∈ X , where a 1 , . . . , a k are all actions making x false, and a ′ 1 , . . . , a ′ k ′ are all actions making x true, and ◮ both e 1 ∪ p 2 and e 2 ∪ p 1 are consistent. a @ t → l @ t for all l in the precondition of a, Theorem and ¬ ( a @ t ∧ a ′ @ t ) for all a and a ′ that interfere . If a 1 = � p 1 , e 1 � and a 2 = � p 1 , e 1 � don’t interfere and s is a state such that s | = p 1 and s | = p 2 , then exec a 1 ( exec a 2 ( s )) = exec a 2 ( exec a 1 ( s )) . This encoding is quadratic due to the interference clauses. 11 / 44 12 / 44
Encodings Parallel Plans Encodings Parallel Plans ∀ -step plans: linear encoding ∃ -step plans Rintanen et al. 2006 [RHN06] Dimopoulos et al. 1997 [DNK97] Action a with effect l disables all actions with precondition l , except a itself. This is done in two parts: disable actions with higher index, disable actions Allow actions { a 1 , . . . , a n } in parallel if they can be executed in at least one with lower index. order. ◮ � n i =1 p i is consistent. v 2 v 4 v 5 ◮ � n i =1 e i is consistent. ◮ There is a total ordering a 1 , . . . , a n such that e i ∪ p j is consistent whenever i ≤ j : disabling an action earlier in the ordering is allowed. a 1 a 2 a 3 a 4 a 5 Several compact encodings exist [RHN06]. Fewer time steps are needed than with ∀ -step plans. Sometimes only half as w 1 w 2 w 4 many. This is needed for every literal. 13 / 44 14 / 44 Encodings Parallel Plans Encodings Parallel Plans ∃ -step plans: linear encoding Disabling graphs Rintanen et al. 2006 [RHN06] Rintanen et al. 2006 [RHN06] Choose an arbitrary fixed ordering of all actions a 1 , . . . , a n . Define a disabling graph with actions as nodes and with an arc from a 1 to a 2 if Action a with effect l disables all later actions with precondition l . p 1 ∪ p 2 and e 1 ∪ e 2 are consistent and e 1 ∪ p 2 is inconsistent. The test for valid execution orderings can be limited to strongly connected v 2 v 4 v 5 components (SCC) of the disabling graph. In many structured problems all SCCs are singleton sets. a 1 a 2 a 3 a 4 a 5 = ⇒ No tests for validity of orderings needed during SAT solving. This is needed for every literal. 15 / 44 16 / 44
Solver Calls Solver Calls Sequantial Strategy Scheduling the SAT Tests The sequential strategy The planning problem is reduced to SAT tests for Φ 0 = I @0 ∧ G @0 Φ 1 = I @0 ∧ R @0 ∧ G @1 1 2 3 4 5 6 7 8 9 ... Φ 2 = I @0 ∧ R @0 ∧ R @1 ∧ G @2 Φ 3 = I @0 ∧ R @0 ∧ R @1 ∧ R @2 ∧ G @3 ◮ Complete satisfiability test for t before proceeding with t + 1 . . . . ◮ This is breadth-first search / iterative deepening. Φ u = I @0 ∧ R @0 ∧ R @1 ∧ · · · R @( u − 1) ∧ G @ u ◮ Guarantees minimality of horizon length. ◮ Slow. where u is the maximum possible plan length. Q: How to schedule these tests? How this is done has much more impact on planner performance than e.g. encoding details! 17 / 44 18 / 44 Solver Calls Parallel Strategy A Solver Calls Parallel Strategy A Some runtime profiles n processes/threads Algorithm A [Rin04b, Zar04] Evaluation times: gripper10 500 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ... 450 400 ◮ Generalization of the previous: n simultaneous SAT processes; when 350 process t finishes, start process t + n . time in secs 300 ◮ Gets past hard UNSAT formulas if n high enough. 250 ◮ Worst case: n times slower than the sequential strategy. 200 150 ◮ Higher memory requirements. 100 ◮ Skipping lengths is OK: 10 20 30 40 50 60 70 80 90 100 ... 50 ◮ We have successfully used n = 20 . 0 0 10 20 30 40 50 60 time points 19 / 44 20 / 44
Solver Calls Parallel Strategy B Solver Calls Parallel Strategy B SAT solving at different rates Geometric rates Algorithm B [Rin04b] Finding a plan for blocks22 with Algorithm B 45 40 ◮ With the previous algorithm, choosing n may be tricky: sometimes big 35 difference e.g. between n = 10 and n = 11 . 30 time in secs ◮ Best to have a high n , but focus on the first SAT instances. 25 ◮ = ⇒ SAT solving at variable rates. 20 15 10 5 0 40 45 50 55 60 65 70 75 80 85 90 time points 21 / 44 22 / 44 Solver Calls Parallel Strategy C Solver Calls Summary Exponential length increase Scheduling the SAT Tests: Summary ◮ Previous strategies restrictive when plans are very long (200, 500, 1000 steps or more). algorithm reference comment ◮ Why not exponential steps to cover very long plans? sequential [KS92, KS96] slow, guarantees min. horizon binary search [SS07] length upper bound needed ◮ Works surprisingly well! (...as long as you have enough memory...) n processes [Rin04b, Zar04] fast, more memory needed ◮ Dozens of previously unsolved instances solved. geometric [Rin04b] fast, more memory needed ◮ Large slow-downs uncommon (but depends on SAT heuristics being exponential Rintanen 2012 fast, still more memory needed used and type of problems). 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 23 / 44 24 / 44
Recommend
More recommend