Class AssignmentState
java.lang.Object
topics.branchandbound.utils.Node
topics.branchandbound.agents.AssignmentState
- All Implemented Interfaces:
Comparable<Node>
Represents a distinct state within the Branch and Bound execution tree for the Task Assignment problem. Each node tracks partial assignments and calculates a lower-bound heuristic to guide the search process and prune sub-optimal branches.
*Complexity
- Time Complexity:
O(N!)in the theoretical worst-case, mapping to every permutation. The heuristic bounding radically flattens this curve in practice. - Space Complexity:
O(N)per node. Overall heap consumption depends on the underlying priority queue dimension during traversal.
-
Field Summary
Fields inherited from class Node
depth, heuristicValue, id, parentId -
Constructor Summary
ConstructorsConstructorDescriptionAssignmentState(int problemSize, int[][] costMatrix) Constructs the Root Node of the state space tree, representing the initial unassigned state of the system.AssignmentState(AssignmentState parent, int taskToAssign) Constructs a child state derived from a parent node by assigning a specific task to the next available agent. -
Method Summary
Modifier and TypeMethodDescriptionvoidCalculates the lower bound heuristic estimate for this partial assignment.expand()Generates all mathematically valid mathematical combinations extending from the current state.intEstablishes a preliminary upper bound to initiate the pruning phase.booleanDetermines whether the current node represents a fully resolved combination.toString()Methods inherited from class Node
compareTo, equals, getDepth, getHeuristicValue, getId, getParentId, hashCode
-
Constructor Details
-
AssignmentState
public AssignmentState(int problemSize, int[][] costMatrix) Constructs the Root Node of the state space tree, representing the initial unassigned state of the system.- Parameters:
problemSize- The total number of agents and tasks.costMatrix- The matrix mapping cost values for all agent-task pairs.
-
AssignmentState
Constructs a child state derived from a parent node by assigning a specific task to the next available agent.- Parameters:
parent- The origin state node.taskToAssign- The target task index to assign to the current agent.
-
-
Method Details
-
initialValuePruneLimit
public int initialValuePruneLimit()Establishes a preliminary upper bound to initiate the pruning phase. It uses the minimum cost between the primary and secondary diagonals of the matrix.- Overrides:
initialValuePruneLimitin classNode- Returns:
- The initial upper bound estimate.
-
calculateHeuristicValue
public void calculateHeuristicValue()Calculates the lower bound heuristic estimate for this partial assignment. The logic relies on accumulating the fixed costs of agents already assigned, plus the absolute minimum available costs for the remaining unassigned tasks.- Specified by:
calculateHeuristicValuein classNode
-
expand
-
isSolution
public boolean isSolution()Determines whether the current node represents a fully resolved combination.- Specified by:
isSolutionin classNode- Returns:
trueif all agents have been assigned a task;falseotherwise.
-
toString
-