`ClassGoalOrientedPlanner`

java.lang.Object
com.google.adk.planner.goap.GoalOrientedPlanner
All Implemented Interfaces:
Planner

public final class GoalOrientedPlanner extends Object implements Planner
这是一个规划器,它根据输入/输出的依赖关系以及目标(输出结果)来确定代理的执行顺序。

根据代理元数据(其中说明了每个代理读取的数据(inputKeys)和写入的数据(outputKeys)),该规划器使用“反向链式依赖关系解析”(backward-chaining dependency resolution)方法来计算从初始状态到目标状态的执行路径。

示例:

  Agent A: inputs=[], output="person"
  Agent B: inputs=[], output="sign"
  Agent C: inputs=["person", "sign"], output="horoscope"
  Agent D: inputs=["person", "horoscope"], output="writeup"
  Goal: "writeup"

  Resolved groups: [A, B] → [C] → [D]
  (A and B are independent and run in parallel)

支持通过配置来定制故障处理方式。 ReplanPolicy:

支持通过插件方式实现可扩展的搜索策略。 SearchStrategy:反向链接的深度优先搜索(Backward-Chaining DFS)DfsSearchStrategy)或转发 A*(AStarSearchStrategy).

  • 构造函数详细信息

  • 方法详细信息(Method Details)

    • init

      public void init(PlanningContext context)
      描述内容复制自接口文档: Planner
      使用上下文信息及可用的代理来初始化规划器。该函数仅在规划循环开始之前被调用一次。

      默认实现是一个空操作(即什么都不做)。如果需要执行某些设置工作(例如构建依赖关系图),请覆盖该实现。

      Specified by:
      init in interface Planner
    • firstAction

      public io.reactivex.rxjava3.core.Single<PlannerAction> firstAction(PlanningContext context)
      描述内容复制自接口文档: Planner
      请选择要执行的第一个操作。
      Specified by:
      firstAction in interface Planner
    • nextAction

      public io.reactivex.rxjava3.core.Single<PlannerAction> nextAction(PlanningContext context)
      描述内容复制自接口文档: Planner
      根据更新后的状态和事件,选择下一步要执行的操作。
      Specified by:
      nextAction in interface Planner