Class Tree


  • public class Tree
    extends java.lang.Object
    Tree representation of a basic solution according to M.S. Bazaraa, J.J. Jarvis, and H.D. Sherali. Linear Programming and Network Flows. Wiley, 2010, 482-488.
    Author:
    brockhoff
    • Field Detail

      • cSrc

        public int cSrc
        Count sources
      • cTar

        public int cTar
        Count targets;
      • branchOfLeavingEdge

        public boolean branchOfLeavingEdge
        True if source is cut off, false else
    • Constructor Detail

      • Tree

        public Tree​(InitTreeArrayStruct inst)
        Build a tree from the given instance
        Parameters:
        inst -
    • Method Detail

      • enterEdgeNUpdate

        public int[] enterEdgeNUpdate​(int[] entering,
                                      double minRedC)
        Add the given edge with the given reducing costs to the tree and restore the the tree by choosing the appropriate edge (minimum flow in the cycle).
        Parameters:
        entering - Entering edge (from, to)
        minRedC - Reducing costs of the edge
        Returns:
        leaving edge (parent, child)
      • identifyCycleAndFlow

        public void identifyCycleAndFlow​(int left,
                                         int right)
        Identifies the cycle and the minimum flow around that cycle Edges of the cycle are stored.
        Parameters:
        left - left entering node
        right - right entering node
      • redCost

        public double redCost​(int from,
                              int to)
        Calculates reducing costs
        Parameters:
        from - edge from
        to - edge to
        Returns:
        Reducing costs of edge (from, to)
      • getFreshTreeIterator

        public TreeIterator getFreshTreeIterator()
        Returns:
        A fresh tree iterator
      • getCurDual

        public double getCurDual()
        Current dual objective function value
        Returns:
      • getSurplusFlow

        public double getSurplusFlow()
        Returns:
        the surplusFlow
      • getPrimalObj

        public double getPrimalObj()
      • getChildren

        public int[] getChildren​(int root)
      • getFlow

        public double getFlow​(int node)
      • getParent

        public int getParent​(int node)
      • getcSrc

        public int getcSrc()
        Returns:
        the cSrc
      • getcTar

        public int getcTar()
        Returns:
        the cTar
      • getCommonPredecessor

        public int getCommonPredecessor​(int left,
                                        int right)
      • getLeavingChild

        public int getLeavingChild()
        Returns:
        the leavingChild
      • setCurForward

        public void setCurForward​(int curForward)
        Parameters:
        curForward - the curForward to set
      • setCurBackward

        public void setCurBackward​(int curBackward)
        Parameters:
        curBackward - the curBackward to set
      • resetMinFlow

        public void resetMinFlow()
        Resets min Flow
      • getOrientation

        public boolean getOrientation​(int node)
        Parameters:
        node -
        Returns:
        true if upwards, false if downwards
      • getRootOrientation

        public boolean getRootOrientation​(int node)
        Returns the orientation of the root "over" the given node
        Parameters:
        node -
        Returns:
        true if upwards, false if downwards
      • setDual

        public void setDual​(double[] dual)
        Parameters:
        dual - the dual to set
      • setCurDual

        public void setCurDual​(double curDual)
        Parameters:
        curDual - the curDual to set