我是PDDL的新手,目前正在学习如何通过简单的程序使汽车从pt0pt0前进到pt1pt1。
但是,当我尝试在PDDL编辑器上运行它时遇到编译错误。有经验的编码员可以告诉我代码有什么问题吗?非常感谢,谢谢。
problem.pddl
(define (problem parking)
(:domain grid_world)
(:objects agent1 - agent
pt0pt0 pt0pt1 pt1pt1 - gridcell
)
(:init (at pt0pt0 agent1) (forward_next pt0pt0 pt0pt1) (forward_next pt0pt1 pt1pt1))
(:goal (at pt1pt1 agent1))
)
domain.pddl
(define (domain grid_world )
(:requirements :strips :typing)
(:types car
agent - car
gridcell
)
(:predicates (at ?pt1 - gridcell ?car - car)
(forward_next ?pt1 - gridcell ?pt2 - gridcell)
)
(:action FOWARD
:parameters ( ?agent - car ?pt1 - gridcell ?pt2 - gridcell)
:precondition (and (at ?pt1 ?agent))
:effect (and (not (at ?pt1 ?agent)) (forward_next ?pt1 ?pt2) (at ?pt2 ?agent))
)
)
答案 0 :(得分:1)
PDDL中的空格无关紧要,因此您的: types
声明中的类型继承应为
(:types
car - object
agent - car
gridcell
)
或者只是...
(:types
agent - car
gridcell
)
您实质上定义了周期性依赖关系car agent - car
。
修改后,您将获得以下计划:
0.00100: (foward agent1 pt0pt0 pt1pt1)
这可能不是您想要的,因此快速观察一下,将(forward_next ?pt1 ?pt2)
从您的动作效果移到了前提条件。您将获得此计划:
0.00100: (foward agent1 pt0pt0 pt0pt1)
0.00200: (foward agent1 pt0pt1 pt1pt1)
您可以在此会话中找到固定的PDDL(为了便于阅读,对其进行了格式化): http://editor.planning.domains/#read_session=qrAGLXX9O1
点击解决进行尝试。