关于AI规划中的PDDL [英] About PDDL in AI planning

查看:100
本文介绍了关于AI规划中的PDDL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用PDDL解决与计划者有关的Pacman风格的问题.我认为给定地图上有很多食物.我使用 exists 检查地图中是否还有其他食物,但这不起作用;为什么呢?

I am trying to solve a Pacman-style problem with a planner, using PDDL. I assume there are many food in the given map. I use exists to check if here is any other food in the map, but it does not work; why is that?

这是我的问题文件:

(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.没有计划可以解决

error message: ff: goal can be simplified to FALSE. No plan will solve it

推荐答案

我认为问题在于您对 when 的使用,而FastForward可能无法处理.您可以尝试改写没有它的问题.

I think the problem is your use of when, which FastForward might not be able to deal with. You could try rephrasing your problem without it.

您有六个单元格.只需引入谓词(food< cell>),您首先将其设置为true,如

You have six cells. Just introduce a predicate (food <cell>), which you set to true initially, as in

(food a1) (food a2) ...

移动的效果将是(不是(food?to)),即该单元格中的食物被去除了.然后,您需要重新设定目标

The the effect of moving would be (not (food ?to)), ie the food in that cell gets removed. You then need to rephrase your goal to

(and (not (food a1)) (not (food a2)) ...)

虽然不太优雅,但应该可以解决问题.

That is less elegant, but should do the trick.

move 操作应该看起来像这样:

The move action should probably look like this:

(: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))))

这篇关于关于AI规划中的PDDL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆