为什么 PDDL 编译不正确并导致解析错误?

Why isn't PDDL compiling correctly and resulting in parse error?

我是 PDDL 的新手,所以我不太了解发生了什么,但我遇到了这个问题,黑盒规划器似乎无法解析我的 PDDL代码。

这里有:

(define (domain vacuum)
    (:requirements :strips)
    (:predicates
        (clean ?x)
        (in_room ?x ?r)
        (door_to ?r1 ?r2)
        (dirty ?x)
    )

    (:action moveToAction
        :parameters (?ob ?r1 ?r2)
        :precondition (and
            (in_room ?ob ?r1)
            (door_to ?r1 ?r2)
        )
        :effect (and
            (not (in_room ?r1))
            (in_room ?ob ?r2)
        )
    )
    
    (:action cleanAction
        :parameters (?r1)
        :precondition (and
            (dirty ?r1)
        )
        :effect (and
            (clean ?r1)
        )
    )
)

这里有 问题:

(define (problem vacuum)
    (:domain vacuum)
    (:objects vacuum kitchen corridor bedroom1 bedroom2 bathroom living_room)
    (:init  
        (dirty kitchen) 
        (dirty bedroom1) 
        (dirty bedroom2)
        (dirty living_room) 
        (dirty bathroom) 
        (dirty corridor)
        (in_room vacuum living_room)
        (not in_room vacuum kitchen) 
        (not in_room vacuum bedroom1) 
        (not in_room vacuum bedroom2) 
        (not in_room vacuum bathroom) 
        (not in_room vacuum corridor) 
        (door_to bathroom corridor) 
        (door_to kitchen corridor) 
        (door_to living_room corridor) 
        (door_to bedroom1 corridor) 
        (door_to bedroom2 corridor) 
        (door_to corridor bathroom) 
        (door_to corridor kitchen)
        (door_to corridor living_room)
        (door_to corridor bedroom1)
        (door_to corridor bedroom2)
    )
    (:goal 
        (and (clean living_room))
    )
)

解算器给我的确切错误是:

parse error
Error occurred at or near line 40

如果我理解正确的话,解析器首先读取域文件,然后再读取问题文件,所以错误应该在问题文件中,特别是在 init 中。准确的行应该是(dirty corridor)。 我不明白我做错了什么,我是完全错过了语法还是只是搞砸了什么?

由于 Closed World Assumption,您必须从问题的初始状态中删除 否定谓词 ,而且您在域 [=13] 中有一个小错字=] 接受两个变量,而不只是一个!

那么您的域/问题将如下所示:

域:

(define (domain vacuum)
    (:requirements :strips)
    (:predicates
        (clean ?x)
        (in_room ?x ?r)
        (door_to ?r1 ?r2)
        (dirty ?x)
    )

    (:action moveToAction
        :parameters (?ob ?r1 ?r2)
        :precondition (and
            (in_room ?ob ?r1)
            (door_to ?r1 ?r2)
        )
        :effect (and
            (not (in_room ?ob ?r1))
            (in_room ?ob ?r2)
        )
    )
    
    (:action cleanAction
        :parameters (?r1)
        :precondition (and
            (dirty ?r1)
        )
        :effect (and
            (clean ?r1)
        )
    )
)

问题

(define (problem vacuum)
    (:domain vacuum)
    (:objects vacuum kitchen corridor bedroom1 bedroom2 bathroom living_room)
    (:init  
        (dirty kitchen) 
        (dirty bedroom1) 
        (dirty bedroom2)
        (dirty living_room) 
        (dirty bathroom) 
        (dirty corridor)
        (in_room vacuum living_room)
        (door_to bathroom corridor) 
        (door_to kitchen corridor) 
        (door_to living_room corridor) 
        (door_to bedroom1 corridor) 
        (door_to bedroom2 corridor) 
        (door_to corridor bathroom) 
        (door_to corridor kitchen)
        (door_to corridor living_room)
        (door_to corridor bedroom1)
        (door_to corridor bedroom2)
    )
    (:goal 
        (and (clean living_room))
    )
)

产出计划:

  (:action cleanaction
    :parameters (living_room)
    :precondition
      (and
        (dirty living_room)
      )
    :effect
      (and
        (clean living_room)
      )
  )