PDDL 无法编译

Posted

技术标签:

【中文标题】PDDL 无法编译【英文标题】:PDDL doesn't compile 【发布时间】:2020-08-01 22:33:45 【问题描述】:

试图找出让机器人清洁瓷砖的 PDDL 问题,但据我所知,我一直坚持自己做错了什么,我只有上下移动动作和清洁动作,但它仍然不编译。它只是给我一个错误,说无法解析域文件。

这是域:

(define (domain floor-tile)

    (:requirements :typing)

    ;; We have two types: robots and the tiles, both are objects
    (:types robot tile - object)

    ;; define all the predicates as they are used in the probem files
    (:predicates  

    ;; described what tile a robot is at
    (robot-at ?r - robot ?x - tile)

    ;; indicates that tile ?x is above tile ?y
    (up ?x - tile ?y - tile)

    ;; indicates that tile ?x is below tile ?y
    (down ?x - tile ?y - tile)

    ;; indicates that tile ?x is right of tile ?y
    (right ?x - tile ?y - tile)

    ;; indicates that tile ?x is left of tile ?y
    (left ?x - tile ?y - tile)

    ;; indicates that a tile is clear (robot can move there)
    (clear ?x - tile)

    ;; indicates that a tile is cleaned
    (cleaned ?x - tile)
    )




(:action clean-up

  :parameters (?r - robot ?x - tile ?y - tile )
  :precondition (and (up ?y ?x) (robot-at ?r ?x) (clear ?y))
  :effect (and (not (clear ?y))  (cleaned ?y) 
                 
)


 (:action clean-down

  :parameters (?r - robot?x - tile ?y - tile)
  :precondition (and (down ?y ?x) (robot-at ?r ?x) (clear ?y))
  :effect (and (not (clear ?y))  (cleaned ?y) 
                
)


 
(:action up 
    :parameters (?r - robot?x - tile ?y - tile)
    :precondition (and (up ?y ?x) (robot-at ?r ?x) (clear ?y))
    :effect (and (robot-at ?r ?y) (not(robot-at ?r ?x))) 
)


(:action down 
     :parameters (?r - robot?x - tile ?y - tile)
     :precondition (and (down ?y ?x) (robot-at ?r ?x)(clear ?y))
     :effect (and (robot-at ?r ?y) 
            (not(robot-at ?r ?x))) 
)

(:action right 
     :parameters (?r - robot?x - tile ?y - tile)
     :precondition (and (right ?y ?x) (robot-at ?r ?x) (clear ?y))
     :effect (and (robot-at ?r ?y) 
            (not(robot-at ?r ?x)))    
)

(:action left 
     :parameters (?r - robot?x - tile ?y - tile)
     :precondition (and (left ?y ?x) (robot-at ?r ?x) (clear ?y))
     :effect (and (robot-at ?r ?y ) 
            (not(robot-at ?r ?x)))
)
)

问题来了:

(define (problem prob001)
 (:domain floor-tile)
 (:objects tile_0-1 tile_0-2  
           tile_1-1 tile_1-2  
           tile_2-1 tile_2-2  - tile
           robot1 - robot
)
 (:init 
   (robot-at robot1 tile_1-1)
   (clear tile_0-1)
   (clear tile_0-2)
   (clear tile_1-2)
   (clear tile_2-1)
   (clear tile_2-2)
   (up tile_1-1 tile_0-1)
   (up tile_1-2 tile_0-2)
   (up tile_2-1 tile_1-1)
   (up tile_2-2 tile_1-2)
   (down tile_0-1 tile_1-1)
   (down tile_0-2 tile_1-2)
   (down tile_1-1 tile_2-1)
   (down tile_1-2 tile_2-2)
   (right tile_0-2 tile_0-1)
   (right tile_1-2 tile_1-1)
   (right tile_2-2 tile_2-1)
   (left tile_0-1 tile_0-2)
   (left tile_1-1 tile_1-2)
   (left tile_2-1 tile_2-2)
)
 (:goal (and
    (cleaned tile_0-1)
    (cleaned tile_0-2)
    (cleaned tile_1-1)
    (cleaned tile_2-2)
))

)

【问题讨论】:

Eric,如果对您有用,请行使您的特权来批准@haz 给出的答案。这样,发现此问题的其他人可以将其识别为正确的解决方案。 【参考方案1】:

clean-upclean-down:effect 缺少括号。添加这些括号后,online editor 的求解器表明目标无法达到,但至少可以解析。

【讨论】:

以上是关于PDDL 无法编译的主要内容,如果未能解决你的问题,请参考以下文章

如何在 PDDL forall 中获取 break 的功能

快进和 pddl:计算的解决方案是最好的吗?

[PDDL人工智能] 01.PDDL规划器安装及入门详解(规划领域定义语言)

[PDDL人工智能] 02.PDDL规划领域定义语言之语法理解和示例详解

[PDDL人工智能] 02.PDDL规划领域定义语言之语法理解和示例详解

具有多种类型的 PDDL 谓词变量