Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/visual-studio-2010/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Artificial intelligence PDDL人工智能规划中的一个缺陷_Artificial Intelligence_Planning_Pddl - Fatal编程技术网

Artificial intelligence PDDL人工智能规划中的一个缺陷

Artificial intelligence PDDL人工智能规划中的一个缺陷,artificial-intelligence,planning,pddl,Artificial Intelligence,Planning,Pddl,我正在尝试使用PDDL解决一个Pacman问题。我需要做的主要事情是在不使用函数或fluents的情况下对电源持续时间进行软编码。它没有返回错误,但不知何故,我感觉它初始化了Powerlose(n2,n0)。我从不初始化掉电(n2,n0)或改变掉电的效果。但是它给c的初始值是n2。那怎么了?提前谢谢 您可以通过以下链接检查问题和域: 我试图在域文件的第34行使用exists语句而不是Powerlose(cPlus1,c),但它不起作用。它仍然使用n2初始化c。我很困惑。 这是我的域文件: (d

我正在尝试使用PDDL解决一个Pacman问题。我需要做的主要事情是在不使用
函数
fluents
的情况下对电源持续时间进行软编码。它没有返回错误,但不知何故,我感觉它初始化了Powerlose(n2,n0)。我从不初始化掉电(n2,n0)或改变掉电的效果。但是它给
c
的初始值是
n2
。那怎么了?提前谢谢

您可以通过以下链接检查问题和域:

我试图在域文件的第34行使用
exists
语句而不是
Powerlose(cPlus1,c)
,但它不起作用。它仍然使用
n2
初始化
c
。我很困惑。 这是我的域文件:

(define
    (domain pacman_hard)
    (:requirements :strips :typing :equality :adl)

    (:types
       pos int
    )

    (:predicates
        (PacmanAt ?p - pos)
        (GhostAt ?p - pos)
        (FoodAt ?p - pos)
        (CapsuleAt ?p - pos)
        (PowerCurr ?n - int)
        (PowerLose ?n1 ?n2 - int)
        (PowerGain ?n1 ?n2 - int)
        (Adjacent ?p1 ?p2 - pos)
    )


    (:action move
        :parameters (?posCurr ?posNext - pos ?cPlus1 ?c ?MaxPower - int)
        :precondition (and
                        (and
                        ; check if there is any food left,
                        ; which guarantees all ghosts are eaten before last food
                        (exists (?p - pos) (FoodAt ?p)) 
                        (PacmanAt ?posCurr)
                        (Adjacent ?posCurr ?posNext)
                        (PowerCurr ?cPlus1)
                        (PowerGain ?cPlus1 ?MaxPower)
                        )
                        (or
                        (PowerLose ?cPlus1 ?c) ;powered
                        (not (GhostAt ?posNext))
                        )
                      )
        :effect (and 
                    (PacmanAt ?posNext)
                    (not (PacmanAt ?posCurr))
                    ; update power status accordingly/with priority
                    ; first reduce the time of power
                    (when (PowerLose ?cPlus1 ?c); could minus 1  
                        (and
                        (not (PowerCurr ?cPlus1))
                        (PowerCurr ?c)
                        (not (GhostAt ?posNext))
                        )
                    )

                    ; refresh the power time if in next pos its a capsule
                    (when (CapsuleAt ?posNext)
                        (and
                        (not (PowerCurr ?cPlus1))
                        (not (PowerCurr ?c))
                        (PowerCurr ?MaxPower)
                        )
                    )
                    (not (FoodAt ?posNext))
                    (not (CapsuleAt ?posNext))
                )
    )
)
问题文件:

  problem map
 | 1 | 2 | 3 | 4 | 5 |
-|---|--- ---|---|---|
a| P | _ | _ | G | F |
b| _ | C | _ | G | C |
 |---|---|---|---|---|





(define
    (problem pacman-level-1)
    (:domain pacman_hard)
    (:objects
        a1 a2 a3 a4 a5 b1 b2 b3 b4 b5 - pos
        n0 n1 n2 - int
    )

    (:init
        (PacmanAt a1)
        (GhostAt a4)
        (GhostAt b4)
        (CapsuleAt b2)
        (CapsuleAt b5)
        (FoodAt a5)

        (PowerCurr n0)
        (PowerLose n1 n0)
        (PowerLose n2 n1)

        (PowerGain n0 n2)
        (PowerGain n1 n2)
        (PowerGain n2 n2)


        (Adjacent a1 a2)
        (Adjacent a1 b1)
        (Adjacent b1 a1)
        (Adjacent b1 b2)
        (Adjacent a2 a1)
        (Adjacent a2 b2)
        (Adjacent a2 a3)
        (Adjacent b2 a2)
        (Adjacent b2 b1)
        (Adjacent b2 b3)
        (Adjacent a3 a2)
        (Adjacent a3 b3)
        (Adjacent a3 a4)
        (Adjacent b3 b2)
        (Adjacent b3 a3)
        (Adjacent b3 b4)
        (Adjacent a4 a3)
        (Adjacent a4 b4)
        (Adjacent a4 a5)
        (Adjacent b4 b3)
        (Adjacent b4 a4)
        (Adjacent b4 b5)
        (Adjacent a5 a4)
        (Adjacent a5 b5)
        (Adjacent b5 b4)
        (Adjacent b5 a5)
    )

    (:goal
        ; this would guarantee the pacman has eaten all food and ghosts.
        (forall (?p - pos) 
            (and (not (FoodAt ?p)) (not (GhostAt ?p))) 
        )
    )
)
它返回的计划是: (移动a1 b1 n0 n2 n2) (移动b1 b2 n0 n2 n2) (移动b2 b3 n2) (移动b3 b4 n2 n1 n2) (移动b4 a4 n1 n0 n2) (移动a4 a5 n0 n2)

正确的计划:
(移动a1 b1)(移动b1 b2)(移动b2 b3)(移动b3 b4)(移动b4 b5)(移动b4 b4)(移动b4 a4)(移动a4 a5)

另外,指定您正在使用的计划器(及其配置)总是很有用的

我已将您的问题加载到联机编辑器中:

当我尝试解决问题时,它给出了一个类似的计划(至少是计划的开始)。我建议做同样的事情(解决按钮在顶部),看看计划。右侧显示接地动作。首先要注意的是,您的
Powerlose
先决条件是
子句的一部分,而另一部分肯定是满足的(即
(ghostat b1)
为false)。因此,前提条件的这一方面得到了满足


希望这能澄清可能发生的事情

我用的是同一个计划者。我真的很困惑为什么第一个动作中c的值是n2。我只初始化Powerlose(n2,n1),Powerlose(n1,n0),并且我没有改变Powerlose的效果,那么我不知道为什么c以n2开头。我真的是个新手。你认为是
还是
的问题?就像计划者首先给
c
一个值
n2
,因为
(不是(ghostat b1))
被满足,所以“断电(n0,n2)”被添加到添加列表中?@Dan,你能将结果域发布到会话并共享吗?这是一个非常有趣的模型。@Jan你可以联系Nir Lipovetzky——他把这个吃豆人任务作为他的人工智能课程的一部分。