Class BoardState
java.lang.Object
topics.branchandbound.utils.Node
topics.branchandbound.rectangles.BoardState
- All Implemented Interfaces:
Comparable<Node>
Represents a distinct physical configuration of the board within the state space tree. It tracks placed rectangles, calculates the bounding area heuristic, and generates valid subsequent placements.
-
Field Summary
Fields inherited from class Node
depth, heuristicValue, id, parentId -
Constructor Summary
ConstructorsConstructorDescriptionBoardState(int[][] board, List<Piece> pieces, int depth, UUID parentID) Constructs a child node representing a subsequent placement state.BoardState(int boardSize, List<Piece> pieces) Constructs the root node representing an empty board. -
Method Summary
Modifier and TypeMethodDescriptionvoidComputes the bounding box area of all placed pieces.expand()Generates all mathematically valid mathematical configurations extending from the current state by placing the next available piece.booleanDetermines whether the current node represents a fully resolved configuration.toString()Methods inherited from class Node
compareTo, equals, getDepth, getHeuristicValue, getId, getParentId, hashCode, initialValuePruneLimit
-
Constructor Details
-
BoardState
-
BoardState
Constructs a child node representing a subsequent placement state.- Parameters:
board- The new board configuration.pieces- The list of pieces pending placement.depth- The current depth in the state space tree.parentID- The unique identifier of the parent node.
-
-
Method Details
-
expand
-
calculateHeuristicValue
public void calculateHeuristicValue()Computes the bounding box area of all placed pieces. This serves as the lower-bound heuristic estimate to prune sub-optimal configurations.- Specified by:
calculateHeuristicValuein classNode
-
isSolution
public boolean isSolution()Determines whether the current node represents a fully resolved configuration.- Specified by:
isSolutionin classNode- Returns:
trueif all pieces have been placed;falseotherwise.
-
toString
-