Class Game
java.lang.Object
topics.branchandbound.utils.Node
topics.branchandbound.rectangles.Game
- All Implemented Interfaces:
Comparable<Node>
Board State for Rectangle Placement
Represents a distinct physical configuration of the board within the execution tree of the Branch and Bound algorithm. It manages the insertion of rectangular pieces, enforces geometric constraints (boundaries, overlaps, adjacency), and calculates the heuristic bounding box area.
- Author:
- vicegd
-
Field Summary
Fields inherited from class Node
depth, heuristicValue, id, parentId -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidComputes the bounding box area of all placed pieces.expand()Generates all mathematically valid 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
-
Game
-
Game
Constructs a child node representing a subsequent placement state.- Parameters:
board- The new board configuration matrix.pieces- The sequence 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 successfully placed.
-
toString
-