Class HeapThreads

java.lang.Object
topics.branchandbound.util.threads.HeapThreads

public class HeapThreads extends Object
To save and sort the nodes that are going to be used
Author:
vicegd
  • Constructor Details

    • HeapThreads

      public HeapThreads()
      Constructor for Heap objects
  • Method Details

    • createEmpty

      public void createEmpty()
      Clears the priority queue
    • insert

      public void insert(Node node)
      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

      public Node extractBestNode()
      Retrieves and removes the first element of the priority queue
      Returns:
      Best node of the priority queue
    • extractUsedNodesFrom

      public ArrayList<Node> extractUsedNodesFrom(Node node)
      Extracts the nodes from a specific node (e.g., the solution) to the root node
      Parameters:
      node - Node from which we want to extract the path to the root node
      Returns:
      List with the path from the specific node to the root node