问:PDDL 无法编译问题和域
我不知道为什么它不起作用。这是我的代码:
域
(define (domain tren_mover)
(:requirements :adl)
(:predicates
(conectado ?x ?y)
(en ?x ?y)
(movil ?x)
)
(:action mover
:parameters (?tren ?origen ?destino)
:precondition
(and
(movil ?tren)
(en ?origen ?destino)
(conectado ?origen ?destino)
)
:effect
(and
(en ?tren ?destino)
(not (en ?tren ?origen))
)
)
)
问题
(define (problem tren_en_movimiento)
(:domain tren_mover)
(:objects
T - tren
F1- Fábrica1
F2 - Fábrica2
A - almacén
P - puerto
)
(:init
(en puerto tren)
(mover tren)
(conectado A P)
(conectado P F2)
(conectado F2 F1)
(conectado F1 A)
(conectado A F1)
(conectado F1 F2)
(conectado F2 P)
(conectado P A)
)
(:goal (and
(en F1 T)
)
)
)
出现的错误消息是:
Failed to parse the problem -- invalid syntax (, line 37)
/tmp/solver_planning_domains_tmp_4C4oEmiiY8B3Q/domain.pddl:
syntax error in line 16, '':
domain definition expected
I don't know why it doesn't work. here is my code:
Domain
(define (domain tren_mover)
(:requirements :adl)
(:predicates
(conectado ?x ?y)
(en ?x ?y)
(movil ?x)
)
(:action mover
:parameters (?tren ?origen ?destino)
:precondition
(and
(movil ?tren)
(en ?origen ?destino)
(conectado ?origen ?destino)
)
:effect
(and
(en ?tren ?destino)
(not (en ?tren ?origen))
)
)
)
Problem
(define (problem tren_en_movimiento)
(:domain tren_mover)
(:objects
T - tren
F1- Fábrica1
F2 - Fábrica2
A - almacén
P - puerto
)
(:init
(en puerto tren)
(mover tren)
(conectado A P)
(conectado P F2)
(conectado F2 F1)
(conectado F1 A)
(conectado A F1)
(conectado F1 F2)
(conectado F2 P)
(conectado P A)
)
(:goal (and
(en F1 T)
)
)
)
The Error message that appears is:
Failed to parse the problem -- invalid syntax (, line 37)
/tmp/solver_planning_domains_tmp_4C4oEmiiY8B3Q/domain.pddl:
syntax error in line 16, '':
domain definition expected
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的代码中有几个逻辑和语法错误:
逻辑
(en ?origen ?destino)
你怎么能把两个位置放在同一个地方!应该是tren
必须处于原点位置。句法
对象
,你必须理解类型
和对象
之间的区别,你在混合它们!mover
而不是movil
。goal
中,您使用的是不需要的and()
,而且会导致错误,因为您没有两个谓词可以组合!域
问题
解决方案测试
There are several logical and syntactical mistakes in your code:
Logical
(en ?origen ?destino)
how can you put two positions in the same place! it should be thetren
who has to be in the origin position.Syntactical
objects
in the problem, you have to understand the difference betweentypes
andobjects
, you are mixing between them!mover
instead ofmovil
.goal
, you are usingand()
which is not needed, and moreover causes an error as you don't have two predicates to combine!Domain
Problem
Solution Test
我认为您应该考虑包含要求
:typing
对谓词和操作中使用的参数进行分类。由于此错误,问题文件中的:objects
无法正确解析。请参考此链接:https://planning.wiki/ref/pddl/requirements#typing< /a>
并尝试纠正错误。
另外,您可以使用可用于 PDDL 的 VS Code 插件来避免语法错误并解决计划。可以在这里找到:https://marketplace.visualstudio.com/items? itemName=jan-dolejsi.pddl
致以诚挚的问候!
I think you should consider including the requirement
:typing
to categorize the parameters used inpredicates and actions
. Due to this error, the:objects
in the problem file can't be parsed correctly.Please refer to this link: https://planning.wiki/ref/pddl/requirements#typing
and try to rectify errors.
Also, You can use VS Code plugin available for PDDL to avoid syntax errors and solve the plan. It can be found here: https://marketplace.visualstudio.com/items?itemName=jan-dolejsi.pddl
Best Regards!