Class Heap
java.lang.Object
topics.branchandbound.util.Heap
To save and sort the nodes that are going to be used
- Author:
- vicegd
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClears the priority queuebooleanempty()Checks whether the priority queue is emptyintGets the heuristic of the best node in the priority queueRetrieves and removes the first element of the priority queueextractUsedNodesFrom(Node node) Extracts the nodes from a specific node (e.g., the solution) to the root nodevoidInserts a new node in the priority queue
-
Field Details
-
nodes
-
-
Constructor Details
-
Heap
public Heap()Constructor for Heap objects
-
-
Method Details
-
createEmpty
public void createEmpty()Clears the priority queue -
insert
Inserts a new node in the priority queue- Parameters:
node- Node to be inserted
-
empty
public boolean empty()Checks whether the priority queue is empty- Returns:
- True if the queue is empty. False otherwise.
-
estimateBest
public int estimateBest()Gets the heuristic of the best node in the priority queue- Returns:
- Value of the heuristic of the best node in the queue
-
extractBestNode
Retrieves and removes the first element of the priority queue- Returns:
- Best node of the priority queue
-
extractUsedNodesFrom
-