Class ConjugateBushTurnData
- java.lang.Object
-
- org.goplanit.assignment.ltm.sltm.conjugate.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 Summary
Constructors Constructor Description ConjugateBushTurnData(ConjugateBushTurnData bushTurnData)
copy constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 remainsdouble
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 desiredboolean
containsTurnSendingFlow(ConjugateEdgeSegment turnSegment)
Verify if the turn sending flow for a given turn is positivedouble
getSplittingRate(ConjugateEdgeSegment turnSegment)
Collect the splitting rate for a given conjugate link segment.double[]
getSplittingRates(ConjugateDirectedVertex conjugateVertex)
Collect the splitting rates for a given conjugate node (original link segment).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 returneddouble
getTotalSendingFlowFromPcuH(ConjugateDirectedVertex node)
Total sending flows s_a from given original segment collected by means of the conjugate nodedouble
getTurnSendingFlowPcuH(ConjugateEdgeSegment turnSegment)
Get the turn sending flow for a given turnboolean
hasTurnFlows()
Verify if any turn flows have been registeredvoid
removeTurn(ConjugateEdgeSegment turnSegment)
Remove the turn entirelyboolean
setTurnSendingFlow(ConjugateEdgeSegment turnSegment, double turnSendingFlow, boolean allowTurnRemoval)
Update the turn sending flow for a given turnConjugateBushTurnData
shallowClone()
Shallow copy
-
-
-
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 turnturnSendingFlow
- to updateallowTurnRemoval
- 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 turnflowPcuH
- 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 turnflowPcuH
- to addallowTurnRemoval
- 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 tooriginalNetworkSegmentFlowAcceptanceFactors
- 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
-
shallowClone
public ConjugateBushTurnData shallowClone()
Shallow copy- Returns:
- shallow copy
-
hasTurnFlows
public boolean hasTurnFlows()
Verify if any turn flows have been registered- Returns:
- true if so, false otherwise
-
-