我正在查看和阅读这样的资源:
和这个:
我用 A* 做了一个前向搜索规划器;但我现在正试图向后搜索效率增益。
奥金特别说
图 2 所示的计划示例由具有恒定布尔值的前提条件和效果的动作组成,但重要的是要指出前提条件和效果也可以由变量表示。计划者在从目标回归时解决这些变量。变量为规划器增加了力量和灵活性,因为它现在可以满足更一般的先决条件。例如,具有将角色移动到可变目的地效果的 Goto 动作比移动到恒定的预定位置的 Goto 动作强大得多。
因此,在实施之前,我并没有尝试将其可视化;但我无法弄清楚如何解决远离需要它们的变量:
KEY CURRENT GOAL
itemStockpiled false true
------------------------------------------
StockpileItem Effect: itemStockpiled true
Precond: hasItem ?itemId? **** How can I test this?
agentAtPosition ?stockPos?
itemStockpiled true true
hasItem 0 ?itemId?
agentAtPosition ??? ?stockPos?
------------------------------------------
Goto Effect: agentAtPosition ?stockPos? **** Where is this?
itemStockpiled true true
hasItem 0 ?itemId?
agentAtPosition ?stockPos? ?stockPos?
------------------------------------------
PickupItem Effect: hasItem ?itemId?
Precond: agentAtPosition ?itemPos?
itemStockpiled true true
hasItem ?itemId? ?itemId?
agentAtPosition ?stockPos? ?itemPos? **** So we need to go
back to the item from
the stockpile pos
------------------------------------------
Goto Effect: agentAtPosition ?itemPos? **** Where is this?
Precond: foundItem true
itemStockpiled true true
hasItem ?itemId? ?itemId?
agentAtPosition ?itemPos? ?itemPos?
foundItem false true
------------------------------------------
FindItem Effect: foundItem true
itemStockpiled true true
hasItem ?itemId? ?itemId?
agentAtPosition ?itemPos? ?itemPos?
foundItem true true
------------------------------------------
你会在上面的评论中看到,在我知道我在哪里找到路径之前,我不明白如何检查路径是否存在。对于该项目,我想我可以有一个“hasItem”的布尔标志,并在一个变量中跟踪 itemId,该变量在FindItem
成功之前不会填充(然后在执行路径时使用);但这将如何与GoTo
动作一起使用?
如果我使用世界状态变量“agentAtPosition”作为Goto
; 它将设置在计划中的两个不同点;这意味着需要“agentAtPosition”为真的后续动作已经满足了它们的先决条件,有效地结束了计划,错误地认为它找到了一条路径:
KEY CURRENT GOAL
itemStockpiled false true
------------------------------------------
StockpileItem Effect: itemStockpiled true
Precond: hasItem true
agentAtPosition true
itemStockpiled true true
hasItem false true
agentAtPosition false true
------------------------------------------
Goto Effect: agentAtPosition true
itemStockpiled true true
hasItem false true
agentAtPosition true true
------------------------------------------
PickupItem Effect: hasItem true
Precond: agentAtPosition true
itemStockpiled true true
hasItem true true
agentAtPosition true true
------------------------------------------
我该如何解决这个问题?