Class ConjugateBushTurnData


  • public class ConjugateBushTurnData
    extends Object
    Track conjugate edge segment based data, i.e., turn data of a conjugate bush.

    For now we only track (turn) sending flows to minimise bookkeeping and memory usage, turn splitting rates are deduced from the turn sending flows when needed.

    Author:
    markr
    • Constructor Detail

      • ConjugateBushTurnData

        public ConjugateBushTurnData​(ConjugateBushTurnData bushTurnData)
        copy constructor.
        Parameters:
        bushTurnData - to copy
    • Method Detail

      • setTurnSendingFlow

        public boolean setTurnSendingFlow​(ConjugateEdgeSegment turnSegment,
                                          double turnSendingFlow,
                                          boolean allowTurnRemoval)
        Update the turn sending flow for a given turn
        Parameters:
        turnSegment - the turn
        turnSendingFlow - to update
        allowTurnRemoval - when true we allow for removal of turn/edge segment when no flow remains, when false we keep regardless of the remaining flow
        Returns:
        true when turn has any turn sending flow left after setting flow, false when turn sending flow no longer exists
      • addTurnSendingFlow

        public double addTurnSendingFlow​(ConjugateEdgeSegment turnSegment,
                                         double flowPcuH)
        Add turn sending flow for a given turn (can be negative), turn will not be removed if no flow remains
        Parameters:
        turnSegment - the turn
        flowPcuH - to add
        Returns:
        the new turn sending flow after adding the given flow
      • addTurnSendingFlow

        public double addTurnSendingFlow​(ConjugateEdgeSegment turnSegment,
                                         double flowPcuH,
                                         boolean allowTurnRemoval)
        Add turn sending flow for a given turn (can be negative), flow can be removed if desired depending on flags set if desired
        Parameters:
        turnSegment - the turn
        flowPcuH - to add
        allowTurnRemoval - when true we allow for removal of turn/edge segment when no flow remains, when false we keep regardless of the remaining flow
        Returns:
        the new labelled turn sending flow after adding the given flow
      • removeTurn

        public void removeTurn​(ConjugateEdgeSegment turnSegment)
        Remove the turn entirely
        Parameters:
        turnSegment - the turn
      • getTurnSendingFlowPcuH

        public double getTurnSendingFlowPcuH​(ConjugateEdgeSegment turnSegment)
        Get the turn sending flow for a given turn
        Parameters:
        turnSegment - the turn
        Returns:
        turn sending flow, 0 if not present
      • getTotalSendingFlowFromPcuH

        public double getTotalSendingFlowFromPcuH​(ConjugateDirectedVertex node)
        Total sending flows s_a from given original segment collected by means of the conjugate node
        Parameters:
        node - conjugate node to use
        Returns:
        sending flow s_a
      • getTotalAcceptedFlowToPcuH

        public double getTotalAcceptedFlowToPcuH​(ConjugateDirectedVertex node,
                                                 double[] originalNetworkSegmentFlowAcceptanceFactors)
        Collect the accepted flow towards a conjugate node (original edge segment) in the bush, if not present, zero flow is returned
        Parameters:
        node - conjugate node to collect accepted flow towards to
        originalNetworkSegmentFlowAcceptanceFactors - to convert sending flow to accepted flow (based on original edge segment ids)
        Returns:
        bush sending flow found
      • containsTurnSendingFlow

        public boolean containsTurnSendingFlow​(ConjugateEdgeSegment turnSegment)
        Verify if the turn sending flow for a given turn is positive
        Parameters:
        turnSegment - the turn
        Returns:
        true when present, false otherwise
      • getSplittingRates

        public double[] getSplittingRates​(ConjugateDirectedVertex conjugateVertex)
        Collect the splitting rates for a given conjugate node (original link segment). Splitting rates are based on the current turn sending flows s_ab. In case no flows are present zero splitting rates for all turns are returned.
        Parameters:
        conjugateVertex - to collect bush splitting rates for
        Returns:
        splitting rates in primitive array in order of which one iterates over the outgoing edge segments of the conjugate node
      • getSplittingRate

        public double getSplittingRate​(ConjugateEdgeSegment turnSegment)
        Collect the splitting rate for a given conjugate link segment. Splitting rates are based on the current turn sending flows s_ab.

        When collecting multiple splitting rates with the same in link, do not use this method but instead collect all splitting rates at once and then filter the ones you require it is computationally more efficient.

        Parameters:
        turnSegment - the turn to collect splitting rate for
        Returns:
        splitting rate, when turn is not present or not used, zero is returned
      • hasTurnFlows

        public boolean hasTurnFlows()
        Verify if any turn flows have been registered
        Returns:
        true if so, false otherwise