我正在尝试使用 PDDL 用规划器解决 Pacman 风格的问题。我假设给定地图中有很多食物。我exists
用来检查地图上是否还有其他食物,但它不起作用;这是为什么?
这是我的问题文件:
(define
(problem pacman-level-1)
(:domain pacman_simple)
;; problem map
;; | 1 | 2 | 3 |
;; -|---|---|---|
;; a| P | G | F |
;; b| _ | _ | _ |
;; |---|---|---|
(:objects
a1 a2 a3 b1 b2 b3 - cell
pacman - pacman
ghost - ghost
food1 - food
food2 - food
nofood - nofood
)
(:init
(at a1 pacman)
(at a2 ghost)
(status a1 nofood)
(status a2 nofood)
(status a3 food1)
(status b1 nofood)
(status b2 nofood)
(status b3 food2)
(adjacent a1 a2) (adjacent a1 b1)
(adjacent a2 a1) (adjacent a2 b2) (adjacent a2 a3)
(adjacent a3 a2) (adjacent a3 b3)
(adjacent b1 a1) (adjacent b1 b2)
(adjacent b2 b1) (adjacent b2 a2) (adjacent b2 b3)
(adjacent b3 b2) (adjacent b3 a3)
(same a1 a1)
(same a2 a2)
(same a3 a3)
(same b1 b1)
(same b2 b2)
(same b3 b3)
)
(:goal
(and
(eatallfood)
)
)
)
以下是我的域文件:
(define
(domain pacman_simple)
(:requirements :strips :typing :equality :adl :conditional-effects)
(:types
cell subject - object
pacman ghost - subject
food nofood - cellstatus
)
(:constants
F - food
NF - nofood
)
(:predicates
(adjacent ?c - cell ?c - cell)
(at ?c - cell ?s - subject)
(status ?c - cell ?s - cellstatus)
(eatallfood)
(same ?c1 ?c2 - cell)
)
(:action move
:parameters (?from - cell ?to - cell ?p - pacman ?g - ghost ?nf - nofood ?f - food)
:vars
(
?x - food
)
:precondition
(and
(adjacent ?from ?to)
(at ?from ?p)
(status ?from ?nf)
(not
(at ?to ?p)
)
(not
(at ?to ?g)
)
(not
(eatallfood)
)
)
:effect
(and
(at ?to ?p)
(status ?to ?nf)
(not
(at ?from ?p)
)
(when (not
(exists (?c - cell)
(and
(and
(not (same ?to ?c))
(status ?c ?f)
)
)
)
)
(and
(eatallfood)
)
)
)
)
)
错误信息:ff: 目标可以简化为 FALSE。没有计划能解决它