PDDL Graphplan can't find plan

拈花ヽ惹草 提交于 2020-01-06 14:12:08

问题


I've written a domain and a test problem in PDDL, but apparently the graphplan implementation can't find a plan. Here's the domain:

(define (domain aperture)
    (:requirements :strips :typing :negative-preconditions)
    (:types
        cube
        hallway room - location
        )
    (:predicates
        (at ?l - location)
        (has ?c - cube)
        (connected ?l1 - location ?l2 - location)
        (in ?c - cube ?l - location)
        )
    (:action enter
        :parameters (?h - hallway ?r - room)
        :precondition (and (connected ?h ?r) (connected ?r ?h) (at ?h)
                        (not (at ?r)))
        :effect (and (at ?r) (not (at ?h)))
        )
    (:action exit
        :parameters (?r - room ?h - hallway)
        :precondition (and (connected ?r ?h) (connected ?h ?r) (at ?r)
                        (not (at ?h)))
        :effect (and (at ?h) (not (at ?r)))
        )
    (:action move
        :parameters (?h1 ?h2 - hallway)
        :precondition (and (connected ?h1 ?h2) (connected ?h2 ?h1) 
                           (at ?h1) (not (at ?h2)))
        :effect (and (at ?h2) (not (at ?h1)))
        )
    (:action pickup
        :parameters (?c - cube ?l - location)
        :precondition (and (at ?l) (not (has ?c)) (in ?c ?l))
        :effect (and (has ?c) (not (in ?c ?l)))
        )
    (:action drop
        :parameters (?c - cube ?l - location)
        :precondition (and (at ?l) (has ?c) (not (in ?c ?l)))
        :effect (and (not (has ?c)) (in ?c ?l))
        )
)

and here's the problem:

(define (problem pb1)
  (:domain aperture)
  (:requirements :strips :typing) 
  (:objects h1 - hallway
        h2 - hallway
        h3 - hallway
        r1 - room
        c1 - cube)
  (:init (at h1)
     (connected h1 h2)
     (connected h2 h1)
     (connected h2 h3)
     (connected h3 h2)
     (connected h2 r1)
     (connected r1 h2)
     (in c1 r1)
     )
  (:goal (and 
      (has c1)
      )
    )
)

For this particular problem the set of states for the solution should be:

move(h1,h2)
enter(h2,r1)
pickup(c1,r1)

but, as I've said, the graphplan implementation that I'm using (graphplan) can't find any plan.


回答1:


I was able to find a solution plan using strips. However, I had to tweak your domain slightly. Specifically, I changed the domain actions "pickup" and "drop" to replace the parameter type "location" with "room". With this change, I was able to find the following solution:

1. move h1 h2
2. enter h2 r1
3. pickup c1 r1

Maybe this could be the reason graphplan was unable to find a solution as well? Here are the modified domain and problem pddl files.

domain.pddl

(define (domain aperture)
    (:requirements :strips :typing :negative-preconditions)
    (:types
        cube
        hallway room - location
        )
    (:action enter
        :parameters (?h - hallway ?r - room)
        :precondition (and (connected ?h ?r) (connected ?r ?h) (at ?h)
                        (not (at ?r)))
        :effect (and (at ?r) (not (at ?h)))
        )
    (:action exit
        :parameters (?r - room ?h - hallway)
        :precondition (and (connected ?r ?h) (connected ?h ?r) (at ?r)
                        (not (at ?h)))
        :effect (and (at ?h) (not (at ?r)))
        )
    (:action move
        :parameters (?h1  - hallway ?h2 - hallway)
        :precondition (and (connected ?h1 ?h2) (connected ?h2 ?h1) 
                           (at ?h1) (not (at ?h2)))
        :effect (and (at ?h2) (not (at ?h1)))
        )
    (:action pickup
        :parameters (?c - cube ?l - room)
        :precondition (and (at ?l) (not (has ?c)) (in ?c ?l))
        :effect (and (has ?c) (not (in ?c ?l)))
        )
    (:action drop
        :parameters (?c - cube ?l - room)
        :precondition (and (at ?l) (has ?c) (not (in ?c ?l)))
        :effect (and (not (has ?c)) (in ?c ?l))
        )
)

problem.pddl

(define (problem pb1)
  (:domain aperture)
  (:objects h1 - hallway
        h2 - hallway
        h3 - hallway
        r1 - room
        c1 - cube)
  (:init (at h1)
     (connected h1 h2)
     (connected h2 h1)
     (connected h2 h3)
     (connected h3 h2)
     (connected h2 r1)
     (connected r1 h2)
     (in c1 r1)
     )
  (:goal (and 
      (has c1)
      )
    )
)


来源:https://stackoverflow.com/questions/26374143/pddl-graphplan-cant-find-plan

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!