Class Node

java.lang.Object
solvers.queueingnet.treeAlgorithms.Node

public class Node extends Object
Class representing a tree node.
Author:
Ben Homer, 2014.
  • Field Details

    • stations

      public TreeSet<Integer> stations
      The stations this node represents.
    • weight

      public int weight
      The weight of this node (used during tree planting).
    • marked

      public boolean marked
      The marked flag.
    • parent

      protected Node parent
      This node's parent node.
    • leftChild

      protected Node leftChild
      This node's left child.
    • rightChild

      protected Node rightChild
      This node's right child.
    • pcs

      public TreeSet<Integer> pcs
      This node's set of partially covered classes. Stored locally to avoid constant recomputation. TreeSet used to maintain consistent ordering (ascending).
    • fcs

      public TreeSet<Integer> fcs
      This node's set of fully covered classes.
    • Gmap

      The partially covered g-array for this node.
    • backupGmaps

      In certain cases when we store multiple Gmaps at a node, backupGmaps can be used to store these extra Gmaps, else this remains unused.
    • mvaRes

      Tree MVA related
  • Constructor Details

    • Node

      public Node()
      Constructor.
  • Method Details

    • parent

      public Node parent()
      Returns the parent node.
    • leftChild

      public Node leftChild()
      Returns the left child node.
    • rightChild

      public Node rightChild()
      Returns the right child node.
    • setLeftChild

      public void setLeftChild(Node leftChild)
      Sets the left child node.
      Parameters:
      leftChild - The left child node.
    • setRightChild

      public void setRightChild(Node rightChild)
      Sets the right child node.
      Parameters:
      rightChild - The right child node.
    • setParent

      public void setParent(Node parent)
      Sets this parent.
      Parameters:
      parent - The parent of this node.
    • recalculateWeight

      public void recalculateWeight()
      Recalculates this node's weight.
    • recalculateCoveredClasses

      public void recalculateCoveredClasses()
      Recalculates both the partially and fully covered classes for this node.
    • getAllCoveredClasses

      public TreeSet<Integer> getAllCoveredClasses()
      Gets set of both fully and partially covered classes at this node.
      Returns:
      The set of all covered classes.
    • merge

      public Node merge(Node s)
      Merges this node with another node by combining the stations. (N.B. does not recalculate partially covered classes).
      Parameters:
      s - The node to merge with.
      Returns:
      The merged node.
    • isLeaf

      public boolean isLeaf()
      Determines whether this node is a leaf node.
      Returns:
      A boolean indicating whether this node is a leaf node.
    • childrenAreLeaves

      public boolean childrenAreLeaves()
      Determines whether both children of this node are leaves.
      Returns:
      A boolean indicating whether both children are leaves.
    • getMVARes

      public MVAResults getMVARes(PopulationVector N)
      Retrieves the stored MVA results for a specified population vector.
      Parameters:
      N - The population vector.
      Returns:
      The MVA results as an MVAResults object.
    • store

      public void store(PopulationVector backupVector, PopulationVector key, BigDecimal value, boolean backup)
      Stores a nromalisation constant locally.
      Parameters:
      backupVector - The backup population vector to store the value at.
      key - The population vector to use as a key.
      value - The actual value to store.
      backup - Whether to use the backup store or single g-array store.
    • getGarr

      public BigDecimal getGarr(PopulationVector p)
      Gets a g-array values from the single g-array store at the specified population vector.
      Parameters:
      p - The population vector.
      Returns:
      The g-array value.
    • getBackupGarr

      public BigDecimal getBackupGarr(PopulationVector p1, PopulationVector p2)
      Gets a g-array values from the backup g-array store using the specified backup and key population vectors.
      Parameters:
      p1 - The backup population vector.
      p2 - The key population vector.
      Returns:
      The g-array value.
    • backupContains

      public boolean backupContains(PopulationVector p)
      Checks whether the backup g-array store contains the population vector.
      Parameters:
      p - The population vector.
      Returns:
      Boolean indicating whether backup g-array store contains the population vector.
    • getG

      public BigDecimal getG()
      Returns the first value in the g-array (at the root this will be the normalisation constant).
      Returns:
      The normalisation constant.
    • getBackupG

      public BigDecimal getBackupG(PopulationVector p)
      Returns the first value in the backup g-array for specified population vector (at the root this will be the normalisation constant).
      Parameters:
      p - the p value
      Returns:
      The normalisation constant.
    • childrenSuitableForFeedbackFiltering

      public boolean childrenSuitableForFeedbackFiltering(QNModel qnm)
      Checks whether this node is suitable for feedback filtering. This will be true if: 1. Both children are leaf nodes. 2. At least one is a fixed-rate station.
      Parameters:
      qnm - The queueing network model being solved.
      Returns:
      A boolean indicating whether this node is suitable for feedback filtering.
    • childrenOverlappedPcsHaveLargePopulation

      public boolean childrenOverlappedPcsHaveLargePopulation(PopulationVector popVec)
      Checks whether this node's children have a large population overlap in their partially covered classes. This is defined to be true if the overlap is greater than the FEEDBACK_FILTERING_OVERLAP_POP_THRESHOLD constant defined in Config.
      Parameters:
      popVec - The full population vector.
      Returns:
      A boolean indicating whether the population overlap is large.
    • clearGmap

      public void clearGmap()
      Clears g-arrays recursively from this node downwards in the tree.
    • clone

      public Node clone()
      Creates a clone of this node.
      Overrides:
      clone in class Object
      Returns:
      The cloned node.
    • print

      public void print()
      Prints a summary of this node.
    • printGmap

      public void printGmap()
      Prints the local g-array.