我正在为 LightsOut 游戏开发 PDDL 项目。虽然我的 PDDL 代码在 Fast Downward 中成功执行,但我在 Visual Studio Code PDDL 插件中遇到解析错误,并且 plasp 无法正确处理它。
这是我的 PDDL 代码中导致问题的一部分:
(define (domain lightsout)
(:requirements :strips :disjunctive-preconditions :conditional-effects :typing)
(:types
light
)
(:predicates
(on ?l - light)
(off ?l - light)
(adjacent ?l1 ?l2 - light)
)
(:action toggle
:parameters (?l - light)
:precondition (or (on ?l) (off ?l))
:effect (and
(when (on ?l) (and (not (on ?l)) (off ?l)))
(when (off ?l) (and (not (off ?l)) (on ?l)))
(forall (?adj - light)
(when (adjacent ?l ?adj)
(and
(when (on ?adj) (and (not (on ?adj)) (off ?adj)))
(when (off ?adj) (and (not (off ?adj)) (on ?adj)))
)
)
)
)
)
)
VSC PDDL 插件在第 25 行报告的错误是:
“(和...)中的语法错误” “动作声明中存在语法错误。” “不可读的结构” 此外,plasp 无法解析此 PDDL 代码。我认为该问题与操作中嵌套的 when 和 forall 结构有关。如何修改 PDDL 代码来解决这些解析错误,同时保持游戏的预期功能?我可以使用替代结构或重构技术来使代码与 VSC PDDL 插件和 plasp 兼容吗?
任何解决这些解析问题的建议或见解将不胜感激。
将动作分成两个动作,on的情况和off的情况?