Class InterleavingNode
java.lang.Object
topics.branchandbound.utils.Node
topics.branchandbound.stringinterleaving.InterleavingNode
- All Implemented Interfaces:
Comparable<Node>
State Node for String Interleaving
Represents a single point in the state space tree. Since we are using a Priority Queue (Heap) in Branch and Bound, each node must be an immutable snapshot of the current interleaving process.
- Author:
- vicegd
-
Field Summary
Fields inherited from class Node
depth, heuristicValue, id, parentId -
Constructor Summary
ConstructorsConstructorDescriptionInterleavingNode(String a, String b) Root Node Constructor.InterleavingNode(InterleavingNode parent, String newInterleaving, int posA, int posB) Child Node Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidHeuristic: Distance to completion.expand()Generates all mathematically valid state configurations extending from this specific topological juncture.booleanDetermines whether the current node represents a fully resolved configuration satisfying all problem constraints.toString()Methods inherited from class Node
compareTo, equals, getDepth, getHeuristicValue, getId, getParentId, hashCode, initialValuePruneLimit
-
Constructor Details
-
InterleavingNode
-
InterleavingNode
Child Node Constructor.
-
-
Method Details
-
calculateHeuristicValue
public void calculateHeuristicValue()Heuristic: Distance to completion. Since Heap extracts the minimum value first, negative values representing shallow nodes will be extracted first, forcing a Breadth-First Search (BFS) behavior.- Specified by:
calculateHeuristicValuein classNode
-
expand
-
isSolution
public boolean isSolution()Description copied from class:NodeDetermines whether the current node represents a fully resolved configuration satisfying all problem constraints.- Specified by:
isSolutionin classNode- Returns:
trueif the state is a complete mathematical solution;falseotherwise.
-
toString
-