Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
SlideShare a Scribd company logo
SAT Planning
Bounded Planning Problem
  MPrimes (AIPS 1998)
         Fariz Darari
     fadirra@gmail.com
         FU Bolzano
Formulas
1.   Initial State
2.   Actions (Preconditions and Effects)
3.   Explanatory Frame Axiom
4.   Complete Exclusion Axiom
5.   Goal
Formulas

• To satisfy:
 initial state & all possible action descriptions & goal
                      1 & {2, 3, 4} & 5
1 - Initial State
• Specify what is true at the beginning (t = 0).
  – Example: (at v0 l0 0)
• Specify what is not true at the beginning (t = 0).
  – Example: (not (at v0 l1 0))
Dynamic vs Static
• We need to specify only the falsehood of
  dynamic states, but not of static states!
• Why?
  Possible actions will always satisfy the
  precondition for corresponding static states, since
  they are generated using the facts about static
  states themselves!
• In other words, it is safe to give an interpretation
  for any static state wrt. possible actions, to be
  true at a specific time (well since they are static!).
OWA
• Propositional logic has no CWA!
   – Therefore, what are not specified can be interpreted
     as True (xor False).
   – Example: (random-predicate random-constant) can be
     interpreted as true!
• Therefore, if we ask for the satisfiability of:
  (at v0 l0 0) & -(at v0 l1 0) & (asdf zxcv 0)
  The answer will still be YES!
• Do we need to add -(asdf zxcv 0)? No since we
  will never care about the value of (asdf zxcv 0)
  and never put it in the formula!
2 - Actions
• We want to represent the actions as compact as
  possible!
• Characteristics:
   –   Action name
   –   Preconditions
   –   Effects
   –   Typing
• All these characteristics define:
  Possible actions!
  PS: We can think these possible actions as a
  substitution!
Example
(:action move
    :params (?v - vehicle ?l1 ?l2 - location ?f1 ?f2 - fuel)
    :precondition (and (at ?v ?l1)
                    (conn ?l1 ?l2)
                    (has-fuel ?l1 ?f1)
                    (fuel-neighbor ?f2 ?f1))
    :effect         (and (not (at ?v ?l1))
                    (at ?v ?l2)
                    (not (has-fuel ?l1 ?f1))
                    (has-fuel ?l1 ?f2)))
Move

• move (?v, ?l1, ?l2, ?f1, ?f2)
• ?v is of type Vehicle
• (at ?v ?l1) is in precondition, but do you think
  we can use this knowledge benefit? No, since
  at is dynamic (time dependent)!
• Therefore, ?v ranges over objects defined as a
  vehicle without any other restrictions
Move
• move (?v, ?l1, ?l2      , ?f1, ?f2)
• ?l1 and ?l2 are of type Location
• (conn ?l1 ?l2) is in precondition, but do you think
  we can use this knowledge benefit? Yes, since
  conn is static (time independent)!
• Therefore, ?l1 and ?l2 ranges over object
  locations defined in conn!
• Another benefit: the precondition of conn is
  always satisfied!
Move
• move (?v, ?l1, ?l2,?f1, ?f2   )
• ?f1 and ?f2 are of type Fuel
• (fuel-neighbor ?f2 ?f1), beware of the order, is in
  precondition, but do you think we can use this
  knowledge benefit? Yes, since fuel-neighbor is
  static!
• Therefore, ?f1 and ?f2 ranges over object fuels
  defined in fuel-neighbor!
• Another benefit: the precondition of fuel-
  neighbor is always satisfied!
How much reduction do we get?
• Suppose |v| = 10, |l| = 10, |f| = 10,
  |conn| = 2 * 10, |fuel-neighbor| = 10

• Naive encoding (typing) =
  n ^ 5 = 10 ^ 5 = 100.000
• Improved encoding =
  2 * (n ^ 3) = 10 * 2 * 10 * 10 = 2000

• Even worse, suppose n = 100, then:
  100 ^ 5 = 10.000.000.000 (☠)
• But with the improved encoding:
  100 * 2 * 100 * 100 = 2.000.000
Precondition
:precondition   (and (at ?v ?l1)
                     (conn ?l1 ?l2)
                     (has-fuel ?l1 ?f1)
                     (fuel-neighbor ?f2 ?f1))
Relation between Precond and
            Possible Actions
• Action -> Precond
• Example: move (?v, ?l1, ?l2, ?f1, ?f2) implies
  (and     (at ?v ?l1)
           (conn ?l1 ?l2)
           (has-fuel ?l1 ?f1)
           (fuel-neighbor ?f2 ?f1))
Relation between Precond and
            Possible Actions
• Substitution: (v0, l1, l2, f1, f0)
• Example: move (v0, l1, l2, f1, f0) implies
  (and     (at v0 l1) //dynamic
           (conn l1 l2) //static
           (has-fuel l1 f1) //dynamic
           (fuel-neighbor f0 f1)) //static
Effects
:effect   (and (not (at ?v ?l1))
                (at ?v ?l2)
                (not (has-fuel ?l1 ?f1))
                (has-fuel ?l1 ?f2)))
Relation between Effect and Possible
               Actions
• Action -> Effect
• Example: move (?v, ?l1, ?l2, ?f1, ?f2) implies
(and                 (not (at ?v ?l1))
                     (at ?v ?l2)
                     (not (has-fuel ?l1 ?f1))
                     (has-fuel ?l1 ?f2)))
Relation between Precond and
            Possible Actions
• Substitution: (v0, l1, l2, f1, f0)
• Example: move (v0, l1, l2, f1, f0) implies
(and             (not (at v0 l1)) //dynamic
                 (at v0 l2) //dynamic
                 (not (has-fuel l1 f1)) //dynamic
                 (has-fuel l1 f0))) //dynamic
3 - Explanatory Frame Axiom
• Describe what doesn’t change between steps i and i +
  1.
• Two axioms for every possible dynamic state at every
  time step i
• Say that if s changes truth value between i and i+1 then
  the action at step i must be responsible:
   – not (s, i) & (s, i + 1) -> BIG OR {(a, i)| e in EFF(s)} OR False
   – (s, i) & not (s, i + 1) -> BIG OR {(a, i)| e in EFF(-s)} OR False
• If s became true then some action must have added it,
  if s became false then some action must have deleted
  it!
Example
• at = (n ^ 2) * t * 2
• (and (at v0 l0 2) (not (at v0 l0 3)) )
  IMPLY
  (or (move v0 l0 l1 f1 f0 2) (false) )
• move (?v, ?l1, ?l2, ?f1, ?f2)
  Precondition = (at ?v ?l1)
  Effecct = (not (at ?v ?l1))
4 - Complete Exclusion Axiom
• Very simple but huge!
• For all actions a and b and time steps i
  include the formula
   ¬ (a, i) OR ¬ (b, i)
• This guaranteed that there could be only one
  action at a time
• Example:
   (or (not (unload c0 v0 l0 s0 s1 0))
       (not (unload c0 v0 l1 s0 s1 0)))
5 - Goal
• Very simple!
• Just a conjunction of your goals at the time n
  (aka the bound).
• Example (n = 20):
  (and (at c0 l0 20) (at c1 l1 20) (at c2 l2 20))
DEMO

Example Solution:
---PLAN---
68 of load_c0_v0_l0_s1_s0_0
45 of move_v0_l0_l1_f2_f1_1
96 of unload_c0_v0_l1_s0_s1_2
References
• Mprime: http://www.loria.fr/~hoffmanj/ff-
  domains.html
• Course page:
  http://teaching.case.unibz.it/mod/assignment
  /view.php?id=13400

More Related Content

SAT Planning for MPrimes

  • 1. SAT Planning Bounded Planning Problem MPrimes (AIPS 1998) Fariz Darari fadirra@gmail.com FU Bolzano
  • 2. Formulas 1. Initial State 2. Actions (Preconditions and Effects) 3. Explanatory Frame Axiom 4. Complete Exclusion Axiom 5. Goal
  • 3. Formulas • To satisfy: initial state & all possible action descriptions & goal 1 & {2, 3, 4} & 5
  • 4. 1 - Initial State • Specify what is true at the beginning (t = 0). – Example: (at v0 l0 0) • Specify what is not true at the beginning (t = 0). – Example: (not (at v0 l1 0))
  • 5. Dynamic vs Static • We need to specify only the falsehood of dynamic states, but not of static states! • Why? Possible actions will always satisfy the precondition for corresponding static states, since they are generated using the facts about static states themselves! • In other words, it is safe to give an interpretation for any static state wrt. possible actions, to be true at a specific time (well since they are static!).
  • 6. OWA • Propositional logic has no CWA! – Therefore, what are not specified can be interpreted as True (xor False). – Example: (random-predicate random-constant) can be interpreted as true! • Therefore, if we ask for the satisfiability of: (at v0 l0 0) & -(at v0 l1 0) & (asdf zxcv 0) The answer will still be YES! • Do we need to add -(asdf zxcv 0)? No since we will never care about the value of (asdf zxcv 0) and never put it in the formula!
  • 7. 2 - Actions • We want to represent the actions as compact as possible! • Characteristics: – Action name – Preconditions – Effects – Typing • All these characteristics define: Possible actions! PS: We can think these possible actions as a substitution!
  • 8. Example (:action move :params (?v - vehicle ?l1 ?l2 - location ?f1 ?f2 - fuel) :precondition (and (at ?v ?l1) (conn ?l1 ?l2) (has-fuel ?l1 ?f1) (fuel-neighbor ?f2 ?f1)) :effect (and (not (at ?v ?l1)) (at ?v ?l2) (not (has-fuel ?l1 ?f1)) (has-fuel ?l1 ?f2)))
  • 9. Move • move (?v, ?l1, ?l2, ?f1, ?f2) • ?v is of type Vehicle • (at ?v ?l1) is in precondition, but do you think we can use this knowledge benefit? No, since at is dynamic (time dependent)! • Therefore, ?v ranges over objects defined as a vehicle without any other restrictions
  • 10. Move • move (?v, ?l1, ?l2 , ?f1, ?f2) • ?l1 and ?l2 are of type Location • (conn ?l1 ?l2) is in precondition, but do you think we can use this knowledge benefit? Yes, since conn is static (time independent)! • Therefore, ?l1 and ?l2 ranges over object locations defined in conn! • Another benefit: the precondition of conn is always satisfied!
  • 11. Move • move (?v, ?l1, ?l2,?f1, ?f2 ) • ?f1 and ?f2 are of type Fuel • (fuel-neighbor ?f2 ?f1), beware of the order, is in precondition, but do you think we can use this knowledge benefit? Yes, since fuel-neighbor is static! • Therefore, ?f1 and ?f2 ranges over object fuels defined in fuel-neighbor! • Another benefit: the precondition of fuel- neighbor is always satisfied!
  • 12. How much reduction do we get? • Suppose |v| = 10, |l| = 10, |f| = 10, |conn| = 2 * 10, |fuel-neighbor| = 10 • Naive encoding (typing) = n ^ 5 = 10 ^ 5 = 100.000 • Improved encoding = 2 * (n ^ 3) = 10 * 2 * 10 * 10 = 2000 • Even worse, suppose n = 100, then: 100 ^ 5 = 10.000.000.000 (☠) • But with the improved encoding: 100 * 2 * 100 * 100 = 2.000.000
  • 13. Precondition :precondition (and (at ?v ?l1) (conn ?l1 ?l2) (has-fuel ?l1 ?f1) (fuel-neighbor ?f2 ?f1))
  • 14. Relation between Precond and Possible Actions • Action -> Precond • Example: move (?v, ?l1, ?l2, ?f1, ?f2) implies (and (at ?v ?l1) (conn ?l1 ?l2) (has-fuel ?l1 ?f1) (fuel-neighbor ?f2 ?f1))
  • 15. Relation between Precond and Possible Actions • Substitution: (v0, l1, l2, f1, f0) • Example: move (v0, l1, l2, f1, f0) implies (and (at v0 l1) //dynamic (conn l1 l2) //static (has-fuel l1 f1) //dynamic (fuel-neighbor f0 f1)) //static
  • 16. Effects :effect (and (not (at ?v ?l1)) (at ?v ?l2) (not (has-fuel ?l1 ?f1)) (has-fuel ?l1 ?f2)))
  • 17. Relation between Effect and Possible Actions • Action -> Effect • Example: move (?v, ?l1, ?l2, ?f1, ?f2) implies (and (not (at ?v ?l1)) (at ?v ?l2) (not (has-fuel ?l1 ?f1)) (has-fuel ?l1 ?f2)))
  • 18. Relation between Precond and Possible Actions • Substitution: (v0, l1, l2, f1, f0) • Example: move (v0, l1, l2, f1, f0) implies (and (not (at v0 l1)) //dynamic (at v0 l2) //dynamic (not (has-fuel l1 f1)) //dynamic (has-fuel l1 f0))) //dynamic
  • 19. 3 - Explanatory Frame Axiom • Describe what doesn’t change between steps i and i + 1. • Two axioms for every possible dynamic state at every time step i • Say that if s changes truth value between i and i+1 then the action at step i must be responsible: – not (s, i) & (s, i + 1) -> BIG OR {(a, i)| e in EFF(s)} OR False – (s, i) & not (s, i + 1) -> BIG OR {(a, i)| e in EFF(-s)} OR False • If s became true then some action must have added it, if s became false then some action must have deleted it!
  • 20. Example • at = (n ^ 2) * t * 2 • (and (at v0 l0 2) (not (at v0 l0 3)) ) IMPLY (or (move v0 l0 l1 f1 f0 2) (false) ) • move (?v, ?l1, ?l2, ?f1, ?f2) Precondition = (at ?v ?l1) Effecct = (not (at ?v ?l1))
  • 21. 4 - Complete Exclusion Axiom • Very simple but huge! • For all actions a and b and time steps i include the formula ¬ (a, i) OR ¬ (b, i) • This guaranteed that there could be only one action at a time • Example: (or (not (unload c0 v0 l0 s0 s1 0)) (not (unload c0 v0 l1 s0 s1 0)))
  • 22. 5 - Goal • Very simple! • Just a conjunction of your goals at the time n (aka the bound). • Example (n = 20): (and (at c0 l0 20) (at c1 l1 20) (at c2 l2 20))
  • 23. DEMO Example Solution: ---PLAN--- 68 of load_c0_v0_l0_s1_s0_0 45 of move_v0_l0_l1_f2_f1_1 96 of unload_c0_v0_l1_s0_s1_2
  • 24. References • Mprime: http://www.loria.fr/~hoffmanj/ff- domains.html • Course page: http://teaching.case.unibz.it/mod/assignment /view.php?id=13400