Class DefaultGroupPlanner

java.lang.Object
com.tnsai.coordination.planning.DefaultGroupPlanner
All Implemented Interfaces:
GroupPlanner

public class DefaultGroupPlanner extends Object implements GroupPlanner
Default group planner that decomposes goals using agent capabilities.

The decomposition strategy:

  1. Query each agent's PlannerHandle for registered goals matching the parent goal
  2. Assign sub-goals to agents that have the matching goal in their role
  3. Agents without a PlannerHandle receive a generic sub-goal if they are the only option
  4. Sub-goals with no dependencies run in phase 0 (parallel), dependent ones in later phases

Usage


 GroupPlanner planner = DefaultGroupPlanner.create();
 GoalDecomposition result = planner.decompose("build_shelter", agents, state);

 // Phase 0: parallel independent sub-goals
 // Phase 1+: sequential dependent sub-goals
 for (var entry : result.byPhase().entrySet()) {
     System.out.println("Phase " + entry.getKey() + ": " + entry.getValue());
 }
 
  • Method Details

    • create

      public static DefaultGroupPlanner create()
      Creates a new DefaultGroupPlanner instance.
    • decompose

      public GoalDecomposition decompose(String goalName, List<com.tnsai.agents.Agent> agents, Map<String,Object> state)
      Description copied from interface: GroupPlanner
      Decomposes a high-level goal into sub-goals assigned to agents.
      Specified by:
      decompose in interface GroupPlanner
      Parameters:
      goalName - the goal to decompose
      agents - available agents in the group
      state - current shared state (beliefs) of the group
      Returns:
      decomposition with sub-goal assignments and ordering
    • canDecompose

      public boolean canDecompose(String goalName, List<com.tnsai.agents.Agent> agents)
      Description copied from interface: GroupPlanner
      Checks whether this planner can decompose the given goal.
      Specified by:
      canDecompose in interface GroupPlanner
      Parameters:
      goalName - the goal to check
      agents - available agents
      Returns:
      true if the goal can be decomposed across the agents