Artificial intelligence 关于人工智能规划中的PDDL

Artificial intelligence 关于人工智能规划中的PDDL,artificial-intelligence,planning,pddl,Artificial Intelligence,Planning,Pddl,我试图用PDDL解决一个规划师的吃豆人风格的问题。我想在给定的地图上有很多食物。我使用exists来检查地图上是否有其他食物,但它不起作用;为什么呢 这是我的问题文件: (define (problem pacman-level-1) (:domain pacman_simple) ;; problem map ;; | 1 | 2 | 3 | ;; -|---|---|---| ;; a| P | G | F | ;; b| _ | _ | _ | ;; |---|-

我试图用PDDL解决一个规划师的吃豆人风格的问题。我想在给定的地图上有很多食物。我使用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。没有任何计划可以解决它

我认为问题在于你对时间的使用,而快进可能无法解决这个问题。你可以试着在没有它的情况下重新表述你的问题

你有六个牢房。只需引入一个谓词food,初始设置为true,如

(food a1) (food a2) ...
移动的效果不是食物(细胞中的食物被移走)。 然后你需要重新表述你的目标

(and (not (food a1)) (not (food a2)) ...)
这不太优雅,但应该可以做到

移动操作可能如下所示:

(:action move
 :parameters (?from - cell ?to - cell ?p - pacman ?g - ghost)
 :precondition (and
     (adjacent ?from ?to)
     (at ?from ?p)
     (not (at ?to ?g)))
 :effect (and
     (at ?to ?p)
     (not (at ?from ?p))
     (not (food ?to))))

我没有时间完全诊断,但您看到的错误消息几乎总是来自一个无法解决的实例,这对于计划人员来说是微不足道的。测试这一点的最好方法是遵循以下策略:1写下一个你知道会解决它的计划;2从第一个行动开始,将目标设定为先决条件;3重复到最后。如果失败,开始将初始状态更改为计划执行期间预期的完整状态。