Package com.tnsai.coordination.planning
Class DefaultGroupPlanner
java.lang.Object
com.tnsai.coordination.planning.DefaultGroupPlanner
- All Implemented Interfaces:
GroupPlanner
Default group planner that decomposes goals using agent capabilities.
The decomposition strategy:
- Query each agent's PlannerHandle for registered goals matching the parent goal
- Assign sub-goals to agents that have the matching goal in their role
- Agents without a PlannerHandle receive a generic sub-goal if they are the only option
- 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 Summary
Modifier and TypeMethodDescriptionbooleancanDecompose(String goalName, List<com.tnsai.agents.Agent> agents) Checks whether this planner can decompose the given goal.static DefaultGroupPlannercreate()Creates a new DefaultGroupPlanner instance.Decomposes a high-level goal into sub-goals assigned to agents.
-
Method Details
-
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:GroupPlannerDecomposes a high-level goal into sub-goals assigned to agents.- Specified by:
decomposein interfaceGroupPlanner- Parameters:
goalName- the goal to decomposeagents- available agents in the groupstate- current shared state (beliefs) of the group- Returns:
- decomposition with sub-goal assignments and ordering
-
canDecompose
Description copied from interface:GroupPlannerChecks whether this planner can decompose the given goal.- Specified by:
canDecomposein interfaceGroupPlanner- Parameters:
goalName- the goal to checkagents- available agents- Returns:
- true if the goal can be decomposed across the agents
-