PDDL Graphplan无法找到计划

时间:2014-10-15 03:44:35

标签: artificial-intelligence planning pddl

我已经在PDDL中编写了域名和测试问题,但显然图形图实现无法找到计划。这是域名:

(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))
        )
)

以及问题所在:

(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)
      )
    )
)

对于此特定问题,解决方案的状态集应为:

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

但是,正如我所说,我使用的图表规划实施(graphplan)无法找到任何计划。

1 个答案:

答案 0 :(得分:0)

我能够使用strips找到解决方案计划。但是,我不得不稍微调整你的域名。具体来说,我更改了域名操作“拾取”和“删除”以将参数类型“位置”替换为“房间”。通过这一改变,我找到了以下解决方案:

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

也许这可能是graphplan无法找到解决方案的原因?以下是修改后的域和问题pddl文件。

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)
      )
    )
)