2000.9.20CS 5411 Compilation Approaches to AI Planning 1 José Luis Ambite* Some slides are taken...
-
Upload
ellen-houston -
Category
Documents
-
view
215 -
download
0
Transcript of 2000.9.20CS 5411 Compilation Approaches to AI Planning 1 José Luis Ambite* Some slides are taken...
2000.9.20 CS 541 1
Compilation Approaches to AI Planning 1
José Luis Ambite*
Some slides are taken from presentations by Kautz and Selman. Please visit their websites:
http://www.cs.washington.edu/homes/kautz/ http://www.cs.cornell.edu/home/selman/
2000.9.20 CS 541 2
Complexity of Planning
• Domain-independent planning: PSPACE-complete or worse– (Chapman 1987; Bylander 1991; Backstrom 1993)
• Bounded-length planning: NP-complete– (Chenoweth 1991; Gupta and Nau 1992)
• Approximate planning: NP-complete or worse– (Selman 1994)
2000.9.20 CS 541 3
Compilation Idea
• Use any computational substrate that is (at least) NP-hard.
• Planning as:– SAT: Propositional Satisfiability
• SATPLAN, Blackbox (Kautz&Selman, 1992, 1996, 1999)• OBDD: Ordered Binary Decision Diagrams (Cimatti et al, 98)
– CSP: Constraint Satisfaction • GP-CSP (Do & Kambhampati 2000)
– ILP: Integer Linear Programming• Kautz & Walser 1999, Vossen et al 2000
– …
2000.9.20 CS 541 4
Planning as SAT
• Bounded-length planning can be formalized as propositional satisfiability (SAT)
• Plan = model (truth assignment) that satisfies logical constraints representing:
– Initial state– Goal state– Domain axioms: actions, frame axioms, …
for a fixed plan length• Logical spec such that any model is a valid plan
2000.9.20 CS 541 5
Architecture of a SAT-based planner
Compiler(encoding)
satisfyingmodel
Plan
mappingIncrement plan length
If unsatisfiable
Problem Description• Init State• Goal State• Actions
CNF Simplifier(polynomial inference)
Solver(SAT engine/s)
Decoder
CNF
2000.9.20 CS 541 6
Parameters of SAT-based planner
• Encoding of Planning Problem into SAT
• General Limited Inference: Simplification
• SAT Solver(s)
2000.9.20 CS 541 7
Encodings of Planning to SAT
• Discrete Time– Each proposition and action have a time parameter:
– drive(truck1 a b) ~> drive(truck1 a b 3)
– at(p a) ~> at(p a 0)
• Common Axiom schemas:– INIT: Initial state completely specified at time 0
– GOAL: Goal state specified at time N
– A => P,E: Action implies preconditions and effects
2000.9.20 CS 541 8
Encodings of Planning to SATCommon Schemas Example
• INIT: on(a b 0) ^ clear(a 0) ^ …
• GOAL: on(a c 2)
• A => P,EMove(x y z) pre: clear(x) ^ clear(z) ^ on(x y) eff: on(x z) ^ not clear(z) ^ not on(x y)
Move(a b c 1) => clear(a 0) ^ clear(b 0) ^ on(a b 0)Move(a b c 1) => on(a c 2) ^not clear(a 2) ^ not clear(b 2)
2000.9.20 CS 541 9
Encodings of Planning to SATFrame Axioms
• Classical: (McCarthy & Hayes 1969)– state what fluents are left unchanged by an action– clear(d i-1) ^ move(a b c i) => clear(d i+1)– Problem: if no action occurs at step i nothing can be
inferred about propositions at level i+1 – Sol: at-least-one axiom: at least one action occurs
• Explanatory: (Haas 1987)– State the causes for a fluent change– clear(d i-1) ^ not clear(d i+1) => (move(a b d i) v move(a c d i) v … move(c Table d i))
2000.9.20 CS 541 10
Encodings of Planning to SATOperator Splitting
• To reduce size of instantiated formula (#vars)• Normal = plan-length #actions objectsmax-act-arity
• Split = plan-length #actions objects max-act-arity– Replaces: drive(truck1 LA SF 5)
– With: (drive-arg1(truck1 5) ^ drive-arg2(LA 5) ^
drive-arg3(SF 5))
2000.9.20 CS 541 11
KS96 Encodings: Linear (sequential)
• Same as KS92• Initial and Goal States• Action implies both preconditions and its effects• Only one action at a time• Some action occurs at each time
(allowing for do-nothing actions)
• Classical frame axioms• Operator Splitting
2000.9.20 CS 541 12
KS96 Encodings: Graphplan-based
• Goal holds at last layer (time step)• Initial state holds at layer 1• Fact at level i implies disjuntion of all
operators at level i–1 that have it as an add-efffect
• Operators imply their preconditions• Conflicting Actions (only action mutex
explicit, fact mutex implicit)
2000.9.20 CS 541 13
Graphplan Encoding
Fact => Act1 Act2
Act1 => Pre1 Pre2
¬Act1 ¬Act2
Act1
Act2
Fact
Pre1
Pre2
2000.9.20 CS 541 14
KS96 Encodings: State-based
• Assert conditions for valid states • Combines graphplan and linear• Action implies both preconditions and its effects• Conflicting Actions (only action mutex explicit,
fact mutex implicit)• Explanatory frame axioms• Operator splitting• Eliminate actions ( state transition axioms)
2000.9.20 CS 541 15
Algorithms for SAT
• Systematic (complete: prove sat and unsat)– Davis-Putnam (1960)– Satz (Li & Anbulagan 1997)– Rel-Sat (Bayardo & Schrag 1997)
• Stochastic (incomplete: cannot prove unsat)– GSAT (Selman et al 1992)– Walksat (Selman et al 1994)
• Randomized Restarts (Gomes et al 1998)
2000.9.20 CS 541 16
Davis-Putnam algorithm
function Satisfiable ( clause set S ) return boolean
repeat /* unit propagation */
for each unit clause L in S do
delete from S every clause containing L /* unit subsumption */
delete not L from every clause of S in which it occurs /*unit resolution*/
if S is empty then return true
else if a clause becomes null in S then return false
until no further changes result
choose a literal L occurring in S /* splitting */
if Satisfiable ( S U L ) then return true
else if Satisfiable ( S U {not L}) then return true
else return false
2000.9.20 CS 541 17
Walksat
For i=1 to max-tries
A:= random truth assigment
For j=1 to max-flips
If solution?(A) then return A else
C:= random unsatisfied clause
With probability p flip a random variable in C
With probability (1- p) flip the variable in C that
minimizes the number of unsatisfied clauses
2000.9.20 CS 541 18
General Limited InferenceFormula Simplification
• Generated wff can be further simplified by consistency propagation techniques
• Compact (Crawford & Auton 1996)– unit propagation (unit clauses) O(n)– failed literal rule O(n2)
• if Wff + { P } unsat by unit propagation, then set p to false
– binary failed literal rule: O(n3)• if Wff + { P, Q } unsat by unit propagation, then add (not p V not q)
• Experimentally reduces number of variables and clauses by 30% (Kautz&Selman 1999)
2000.9.20 CS 541 19
Randomized Sytematic Solvers
• Stochastic local search solvers (walksat)– when they work, scale well
– cannot show unsat
– fail on some domains
• Systematic solvers (Davis Putnam)– complete
– seem to scale badly
• Can we combine best features of each approach?
2000.9.20 CS 541 20
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
2000.9.20 CS 541 21
Heavy Tailed Cost Distribution
0.1
1
1 10 100 1000 10000 100000
log( Backtracks )
log
( 1
- F
(x)
)
2000.9.20 CS 541 22
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
• Eliminates heavy tails
• In practice: rapid restarts with low cutoff can dramatically improve performance
2000.9.20 CS 541 23
Rapid Restart Speedup
1000
10000
100000
1000000
1 10 100 1000 10000 100000 1000000
log( cutoff )
log
( b
ackt
rack
s )
2000.9.20 CS 541 24
Blackbox Results
0.01
0.1
1
10
100
1000
10000
rocket.a rocket.b log.a log.b log.c log.d
Graphplan
BB-walksat
BB-rand-sys
Handcoded-walksat
1016 states6,000 variables125,000 clauses
2000.9.20 CS 541 25
AI Planning Systems CompetitionCMU, 1998
Team Number of Average Fastest Shortestproblems solution on solutionssolved time (msec) for
Blackbox 10 3171 3 6(AT&T Labs)HSP 9 25875 1 5(Venezuela)IPP 8 (11) 11036 1(3) 6(8)(Germany)STAN 7 20947 5 4(UK)