Control Rules in Planning - PowerPoint PPT Presentation

1 / 26
About This Presentation
Title:

Control Rules in Planning

Description:

ND search in node space of set of solution plans (set of all reachable solutions from n) ... Holding(crane1,c1) is false for all k i (S,si) |= x ( on(x,c1) on(x,c1) ... – PowerPoint PPT presentation

Number of Views:43
Avg rating:3.0/5.0
Slides: 27
Provided by: stephenm75
Category:

less

Transcript and Presenter's Notes

Title: Control Rules in Planning


1
Control Rules in Planning
  • Stephen M. Lee-Urban
  • March 26, 2007

2
References
  • Chapter 10, Control Rules in Planning, in
    Automated Planning Theory and Practice
  • F. Bacchus and F. Kabanza. Using Temporal Logics
    to Express Search Control Knowledge for
    Planning, in Artificial Intelligence, vol 116,
    2000
  • Planner TLPlan
  • (For)Warning Understanding temporal logic will
    be necessary for encoding control rules in your
    domains

3
Motive
  • Classical planning efficiency suffers from
    combinatorial complexity (intractable)
  • Most earlier planners fit in Abstract-Search
    Procedure
  • ND search in node space of set of solution plans
    (set of all reachable solutions from n)
  • Prune function detects and cuts unpromising nodes
  • Can improve solving exponential to polynomial
  • Same idea used in F.E.A.R.
  • Uses domain specific rules to guide forward
    chaining algorithm

u is a structured collection of actions and
constraints
4
Pruning
  • Often involves domain-specific tests
  • Identify less desirable solutions below node than
    solutions below a different node
  • Motivating Example
  • Forward Search Prune in Container-Stacking
  • Consistent ? all containers below c consistent
    with g
  • State Space. Long plans worse than shorter
  • If container c position is consistent with goal,
    prune what?
  • Prune states resulting from apply action moving c
  • If cs position inconsistent, action a yields
    state consistent with goal, and action b moves c
    to position inconsistent w/ g
  • Prune states resulting from applying action b
  • Finds near optimal solutions in low-order
    polynomial time

How do we express such relationships between
states?
5
Simple Temporal Logic ? ? ? ?
  • STL extends FOL to include modal operators
  • Modal Operators express relationships between
    current state and subsequent states
  • Syntax If L is a func-free FOL, then Lt includes
    all of L plus
  • true, false constant atoms that are always
    true/false
  • Modal Ops What do we need?
  • ? (until), ? (always), ? (eventually), ? (next),
    GOAL
  • If F1 and F2 are formulas, then so are
  • F1?F2, ?F1, ?F1, ?F1
  • If F1 has no modal ops, then GOAL(F1) is a formula

6
Semantics of STL
  • Interpreting requires triple (S, si, g)
  • S lts0, s1, gt is an infinite sequence
  • si?? S is the current state
  • g is a goal formula
  • If Lt is based on L of planning domain, and S is
    sequence of states produced by finite plan, isnt
    S finite?
  • Use NOPs. Append infinite final state.
  • In coming slides, let F be an STL formula. We now
    define whether (S, si, g) ? F

7
But First. Entailment
  • Aka logical implication
  • A B
  • A entails B iff every model that makes A true
    also makes B true
  • Example
  • A All horses are animals, All stallions
    are horses
  • B All stallions are animals
  • A B

8
Definitions
? - until ? - always ? - eventually ? - next
  • Given ground atom F, (S, si, g) F iff si F
  • Eg (S, ((on a b) (on b c) ), g) (on a b)
  • Quantifiers and logical connectives have the same
    semantic rules as in FOL
  • Eg (S, si, g) F1?F2 iff (S, si, g) F1 and
    (S, si, g) F2
  • (S, si, g) ?F iff
  • (S, sk, g) F for k?? i
  • (S, si, g) ?F iff
  • (S, si1, g) F
  • (S, si, g) ?F iff
  • ?k k ? i, (S, sk, g) F
  • (S, si, g) F1?F2 iff
  • ?k k ? i, (S, sm, g) F1 for m i, , k-1
    and (S, sk, g) F2
  • (S, si, g) GOAL(F) iff
  • F?g

If F contains no GOAL operators, g is irrelevant.
Write simply (S, si) F
9
Simple Examples
? - until ? - always ? - eventually ? - next
  • Each means the same for s2
  • s2 on(c1,c2) ? on(c2,c3)
  • (S,s0) ??(on(c1,c2) ? on(c2,c3))
  • (S,s1) ?(on(c1,c2) ? on(c2,c3))
  • (S,s2) on(c1,c2) ? on(c2,c3)
  • (S,si) ??holding(crane1,c1)
  • Holding(crane1,c1) is false for all k ? i
  • (S,si) ?x ( on(x,c1) ? ?on(x,c1) )
  • The same container is on c1 in all subsequent
    states
  • (S,si) ?x ?( on(x,c1) ? ?on(x,c1) )

10
Encoding our Motivating Ex.
? - until ? - always ? - event. ? - next
  • Dont move container if position is consistent
    with goal
  • F1(c,d,p) GOAL(in(c,p)) ? ??q GOAL(in(c,q)) ?
    GOAL(on(c,d) ? ??e GOAL(on(c,e))
  • Holds if acceptable when container c is on item d
    in pile p (no goal requiring c in another pile or
    on top of something else)
  • F2(c,p) ok(c,p)?? same(p,pallet) ? ?d
    (F1(c,d,p) ? ok(d,p))
  • ok(c,p) holds iff c is in pile p and cs position
    is consistent with the goal
  • F3(c) ?p (F2(c,p) ? ok(c,p))
  • holds iff cs position is consistent with the
    goal
  • F ?c F3(c) ? ?p?d ?(in(c,p) ? in(c,d))
  • holds iff for every container c whose position is
    consistent with g, c will never be moved (c
    always remains in same pile and on same item in
    that pile)

11
Break
  • Yum, dinner ?

12
Progression
  • Computing progression of a control formula F is
    essential for pruning
  • Formula progress(F,si) is true in si1 iff F is
    true in si. This is called Fs progression.
  • progress(F,si) is the formula produced from
    progr(F,si) by performing usual simplifications
  • Replace true ? d with d, ?true with false, etc.
  • Both functions can be computed in low-order
    polynomial time with algorithms directly
    implementing their definitions

(S,si,g) F iff (S,si1,g) progress(F,si)
13
Definition of progr(F,si)
? - until ? - always ? - eventually ? - next
  • If F contains no modal operators, then
  • progr(F,si) true if si F, false if si ? F
  • Logical connectives are as usual
  • progr(F1?F2,si) progr(F1,si) ? progr(F2,si)
  • progr(?F,si) ?progr(F,si)
  • Modal operators are as follows
  • progr(?F,si) F
  • progr(F1?F2,si) ( (F1?F2) ? progr(F1,si) ) ?
    progr(F2,si)
  • progr(?F,si) (?F) ? progr(F,si)
  • progr(?F,si) (?F) ? progr(F,si)

14
Example of Progr
? - until ? - always ? - eventually ? - next
progr(?F,si) (?F) ? progr(F,si)
  • F ?on(c1,c2)
  • si on(c1,c2)
  • progress(F,si)
  • ?on(c1,c2) ? progress(on(c1,c2),si)
  • ?on(c1,c2) ? true
  • F
  • What if si ?on(c1,c2)?

15
Using Control Formulas in Planning
  • Let S lts0,s1,gt be infinite and F be an STL
    formula.
  • If (S,s0,g) F, then for every finite
    truncation S lts0,s1,,sigt of S, progress(F,S)
    ? false
  • Let s0 be a state, ? be a plan applicable to s0,
    and S lts0,,sngt be the seq. of states produced
    by applying ? to s0.
  • If F is an STL formula and progress(F,S) false,
    then S has no extension S lts0,,sn,
    sn1,sn2,gt such that (S,s0,g) F

Modify Forward-search to prune any partial plan ?
such that progress(F,S?) false
16
Our Handy Example
? - until ? - always ? - eventually ? - next
  • Let s0 and g be for a container-stacking problem
    with constant symbols c1, , ck. Let F1, F2, F3,
    and F be as before.
  • progress(F,s0)
  • progress(?c F3(c) ? ?p?d ?(in(c,p) ?
    in(c,d)), s0)
  • progress(F3(c1) ? ?p?d ?(in(c1,p) ?
    in(c1,d)), s0) ? ? progress(F3(ck) ? ?p?d
    ?(in(ck,p) ? in(ck,d)), s0)
  • Suppose in s0, c1 is consistent with g and is on
    item d1 in pile p1. Then
  • s0 F3(c1)
  • s0 ? F3(ci) for i 2, , k
  • Which means progress(F,s0)
  • progress( ?p?d ?(in(c1,p) ? in(c1,d)), s0 )
  • progress( ?(in(c1,p1) ? in(c1,d1)), s0 )
  • ?(in(c1,p1) ? in(c1,d1))
  • If an applicable action a to state s0 moves c1
    then
  • ?(s0,a) ? progress(F,s0)
  • Thus ?(s0,a) can be pruned.

17
Finally, the Planning Procedure!
18
Planning Procedure - Comments
  • Sound and complete, if the problem is solvable
    and STL formula F is entailed for at least one
    solution of the problem
  • Soundness follows from soundness of
    Forward-Search
  • Completeness follows from what?
  • the condition on F

Control formulas are like specialized computer
programs and must be debugged.
19
Extensions
  • Function Symbols
  • Axioms (Horn-clauses)
  • Restrict axioms to Horn-clauses and use a
    Horn-clause theorem prover
  • Attached Procedures
  • Allow some func./predicate symbols to be
    evalutated as attached procedures
  • Time
  • Actions with time durations and overlapping
  • Extended Goals
  • Add control rules like F ??at(r1,bad-loc)
  • Reach goal in 2 actions or fewer F g V (?g)

20
TLPlan
  • On vega.cc.lehigh.edu /home/sml3/planning/sys/tlp
    lan
  • http//www.cs.toronto.edu/fbacchus/tlplan-manual.
    html
  • Requires one input script file referring to two
    others
  • (load-file "BlocksWorld.tlp")
  • (load-file "BlocksProblems.tlp")
  • (set-statistics-file "BlocksProblems.csv")
  • (set-goal (goal0))
  • (set-initial-world (state0))
  • (set-plan-name "Problem0")
  • (plan) try and solve the
    problem
  • (select-final-world) needed for next line
  • (print-pddl-plan)
  • (exit) remove this line for interactive mode
  • Running from the directory containing your
    domain
  • ../runtlplan script.tlp

Domain File
Problem File
Defined in Problem File
Also in tlplan.log
or make a symbolic link in your domain directory
via ln s ltpathgt/runtlplan
21
Sample Domain File
(clear-world-symbols) Remove old dom symb
WORLD SYMBOLS (declare-described-symbols
(predicate on 2) and so on (predicate
ontable 1)) (declare-defined-symbols
(predicate goodtower 1) (predicate
goodtowerabove 1) and so on (function
depth 1)) DEFINED PREDICATES
(def-defined-predicate (goodtower ?x) (and
(clear ?x) (goodtowerbelow ?x)))
TEMPORAL CONTROL FORMULA (define (bw-control1)
(always (forall (?x) (clear ?x)
(implies (goodtower ?x) (next
(goodtowerabove ?x))) )))
OPERATORS (def-strips-operator (pickup ?x)
(pre (handempty) (clear ?x) (ontable ?x))
(add (holding ?x)) (del (handempty)
(clear ?x) (ontable ?x))) PRINT ROUTINES and
FUNCTIONS
Problem File
(define (state0) (clear a) (clear b)
(clear c) (ontable a) (ontable b)
(ontable c) (handempty)) (define
(goal0) (on a b) (on b c) (ontable c))
22
Defining a Domain Init/Def
  • (clear-world-symbols)
  • Must call first in a new domain definition file
  • Clears the prev. domain's language definition
  • Resets temporal control formula and the print
    world command to their defaults
  • (declare-described-symbols (functionpredicate
    name arity no-cycle-checkrewritable) ...)
  • must be declared prior to any other symbols
  • (declare-defined-symbols (functionpredicategener
    ator name arity) ...)
  • must be declared after the described symbols
  • (def-defined-predicate (name parameters)
    (local-vars declarations) formula)
  • Includes a new predicate, defined in terms of a
    FO formula involving other predicates
  • Can be recursive
  • (define name list)
  • name is an abbreviation for list. Allows macro
    subst. in domain definition files.
  • Use to define temporal control formulas
  • ( ?variable value)
  • assigns value to ?variable

23
Formula Syntax
Termsconstant symbol, number, or
string?variable any symbol starting with
?(?array index ) dimension must agree with
args(function term ) built-in or declared w/
init. decl. Atomic Formulas (predicate term )
predicate declared w/ init. decl.( term1 term2)
predefined equality binary predicate (TRUE)
const. atomic formula always true (FALSE)
const. atomic formula always false First-Order
Formulas atomic-formula (and formula ) --
?? (or formula ) ? (xor formula ) ?? (not
formula ) ? (implies formula1 formula2) --
? (if-then-else formula1 formula2
formula3) (forall var-gen formula) --
?? (exists var-gen formula) ? (exists!
var-gen formula) unique ? (exactly one)
Temporal Logic Formulas (TF)first-order-formula(
next tf) -- ? (eventually tf) ?(t-eventually
ispec tf) ispec is an interval of
states(always tf) ?(t-always ispec tf)
ispec is again an interval(t-until ispec tf1
tf2) ? Modalities(goal formula tf
generator) eval in goal world(previous formula
tf generator) eval in prev. state(current
formula tf generator) eval in cur. state
24
Defining Operators
STRIPS Operator(def-strips-operator name pre del
cost duration priority) where(name v )
Declares op name and params(pre formula)
Precondition list(add p ) Add list(del p )
Delete list(cost n) Cost of action, default
is 1(duration n) Duration of action, default
1(priority n) Used in search to order
successor states, default 0
(def-strips-operator (pickup ?x) (pre
(handempty) (clear ?x) (ontable ?x)) (add
(holding ?x)) (del (handempty) (clear ?x)
(ontable ?x)))
25
Defining TL Control Formulas
  • (define name list)

(define (bw-control1) (always (forall (?x)
(clear ?x) (implies (goodtower ?x)
(next (goodtowerabove ?x))) )))
26
Contact Me
  • Start early, defining control rules is tricky,
    REQUIRES DEBUGGING and tuning
  • sml3_at_lehigh.edu
Write a Comment
User Comments (0)
About PowerShow.com