Class HeapThreads
java.lang.Object
topics.branchandbound.util.threads.HeapThreads
To save and sort the nodes that are going to be used
- Author:
- vicegd
-
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
-
Constructor Details
-
HeapThreads
public HeapThreads()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
-