Package com.tnsai.coordination.planning
Record Class GoalDecomposition
java.lang.Object
java.lang.Record
com.tnsai.coordination.planning.GoalDecomposition
- Record Components:
parentGoal- the original goal that was decomposedsubGoals- the decomposed sub-goals with agent assignments
Result of decomposing a goal across a group of agents.
Contains the list of sub-goals with their assignments and provides utilities for execution ordering and phase grouping.
-
Constructor Summary
ConstructorsConstructorDescriptionGoalDecomposition(String parentGoal, List<SubGoal> subGoals) Creates an instance of aGoalDecompositionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbyPhase()Groups sub-goals by phase for batch execution.static GoalDecompositionReturns an empty decomposition for the given goal.final booleanIndicates whether some other object is "equal to" this one.Returns sub-goals ordered by phase (execution order).Returns sub-goals assigned to a specific agent.final inthashCode()Returns a hash code value for this object.booleanisEmpty()Returns true if the decomposition is empty (no sub-goals).Returns the value of theparentGoalrecord component.intReturns the total number of phases.intsize()Returns the number of sub-goals.subGoals()Returns the value of thesubGoalsrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
GoalDecomposition
Creates an instance of aGoalDecompositionrecord class.- Parameters:
parentGoal- the value for theparentGoalrecord componentsubGoals- the value for thesubGoalsrecord component
-
-
Method Details
-
executionOrder
Returns sub-goals ordered by phase (execution order). Sub-goals in the same phase can run in parallel. -
byPhase
Groups sub-goals by phase for batch execution.- Returns:
- map from phase number to sub-goals in that phase
-
forAgent
Returns sub-goals assigned to a specific agent.- Parameters:
agentId- the agent ID- Returns:
- sub-goals assigned to this agent
-
phaseCount
public int phaseCount()Returns the total number of phases. -
isEmpty
public boolean isEmpty()Returns true if the decomposition is empty (no sub-goals). -
size
public int size()Returns the number of sub-goals. -
empty
Returns an empty decomposition for the given goal. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
parentGoal
Returns the value of theparentGoalrecord component.- Returns:
- the value of the
parentGoalrecord component
-
subGoals
Returns the value of thesubGoalsrecord component.- Returns:
- the value of the
subGoalsrecord component
-