Package org.goplanit.assignment.ltm.sltm
Class OriginBush
- java.lang.Object
-
- org.goplanit.assignment.ltm.sltm.RootedBush<DirectedVertex,EdgeSegment>
-
- org.goplanit.assignment.ltm.sltm.RootedLabelledBush
-
- org.goplanit.assignment.ltm.sltm.OriginBush
-
- All Implemented Interfaces:
Comparable<IdAble>
,Bush
,IdAble
public class OriginBush extends RootedLabelledBush
An origin bush is an acyclic directed graph comprising of implicit paths along a network rooted at a single origin to all destination with non-zero flow. Demand on the bush is placed along its root node which is then split across the graph by (bush specific) splitting rates that reside on each edge. The sum of the edge splitting rates originating from a vertex must always sum to 1.- Author:
- markr
-
-
Field Summary
-
Fields inherited from class org.goplanit.assignment.ltm.sltm.RootedLabelledBush
bushData
-
Fields inherited from class org.goplanit.assignment.ltm.sltm.RootedBush
bushGroupingToken, originDemandsPcuH, requireTopologicalSortUpdate
-
-
Constructor Summary
Constructors Constructor Description OriginBush(OriginBush other, boolean deepCopy)
Copy constructorOriginBush(IdGroupingToken idToken, CentroidVertex origin, double originDemandPcuH, long maxSubGraphEdgeSegments)
ConstructorOriginBush(IdGroupingToken idToken, CentroidVertex origin, long maxSubGraphEdgeSegments)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addOriginDemandPcuH(double demandPcuH)
add origin demand for this origin bushMinMaxPathResult
computeMinMaxShortestPaths(double[] linkSegmentCosts, int totalTransportNetworkVertices)
Compute the min-max path tree rooted at the origin and given the provided (network wide) costs.OriginBush
deepClone()
An id entity should always support a deep copy, i.e., all "owned" members will be deep copied when a clone of this instance is created via this call.CentroidVertex
getOrigin()
collect origin of this bushDouble
getOriginDemandPcuH()
Get the origin demandCentroidVertex
getRootZoneVertex()
Each rooted bush is expected to have a zone attached to its root vertex, which is to be returned hereShortestSearchType
getShortestSearchType()
determine the search type supported by the bush based on the underlying dag's construction, i.e., a destination-based dag results in All-To-One, whereas an origin based dag results in One-To-All searches.Iterator<DirectedVertex>
getTopologicalIterator(boolean originDestinationDirection)
Collect an iterator over topologically sorted bush in origin-destination or destination-origin direction.OriginBush
shallowClone()
Create a shallow copy of this entityString
toString()
-
Methods inherited from class org.goplanit.assignment.ltm.sltm.RootedLabelledBush
addTurnSendingFlow, addTurnSendingFlow, computeSubPathAcceptedFlow, computeSubPathSendingFlow, containsAnyEdgeSegmentOf, containsEdgeSegment, containsTurnSendingFlow, containsTurnSendingFlow, determineIntroduceCycle, determineProportionalFlowCompositionRates, determineSubPathSendingFlow, findBushAlternativeSubpath, getDag, getFirstFlowCompositionLabel, getFlowCompositionLabels, getSendingFlowPcuH, getSendingFlowPcuH, getSplittingRate, getSplittingRate, getSplittingRates, getSplittingRates, getTurnSendingFlow, getTurnSendingFlow, hasFlowCompositionLabel, hasFlowCompositionLabel, isEmpty, relabel, relabelFrom, relabelTo, removeEdgeSegment, removeTurn, syncToNetworkFlows
-
Methods inherited from class org.goplanit.assignment.ltm.sltm.RootedBush
addOriginDemandPcuH, getDirectedVertexIterator, getId, getOriginDemandPcuH, getOriginVertices, getRootVertex, isInverted
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.goplanit.utils.id.IdAble
compareTo, idEquals, idHashCode
-
-
-
-
Constructor Detail
-
OriginBush
public OriginBush(IdGroupingToken idToken, CentroidVertex origin, long maxSubGraphEdgeSegments)
Constructor- Parameters:
idToken
- the token to base the id generation onorigin
- origin of the bushmaxSubGraphEdgeSegments
- The maximum number of edge segments the bush can at most register given the parent network it is a subset of
-
OriginBush
public OriginBush(IdGroupingToken idToken, CentroidVertex origin, double originDemandPcuH, long maxSubGraphEdgeSegments)
Constructor- Parameters:
idToken
- the token to base the id generation onorigin
- origin of the bushoriginDemandPcuH
- demandmaxSubGraphEdgeSegments
- The maximum number of edge segments the bush can at most register given the parent network it is a subset of
-
OriginBush
public OriginBush(OriginBush other, boolean deepCopy)
Copy constructor- Parameters:
other
- to copydeepCopy
- when true, create a eep copy, shallow copy otherwise
-
-
Method Detail
-
computeMinMaxShortestPaths
public MinMaxPathResult computeMinMaxShortestPaths(double[] linkSegmentCosts, int totalTransportNetworkVertices)
Compute the min-max path tree rooted at the origin and given the provided (network wide) costs. The provided costs are at the network level so should contain all the segments active in the bush- Specified by:
computeMinMaxShortestPaths
in classRootedLabelledBush
- Parameters:
linkSegmentCosts
- to usetotalTransportNetworkVertices
- needed to be able to create primitive array recording the (partial) subgraph backward link segment results (efficiently)- Returns:
- minMaxPathResult, null if unable to complete
-
getShortestSearchType
public ShortestSearchType getShortestSearchType()
determine the search type supported by the bush based on the underlying dag's construction, i.e., a destination-based dag results in All-To-One, whereas an origin based dag results in One-To-All searches.- Returns:
- shortest search type compatible with this bush implementation
-
getTopologicalIterator
public Iterator<DirectedVertex> getTopologicalIterator(boolean originDestinationDirection)
Collect an iterator over topologically sorted bush in origin-destination or destination-origin direction. Depending on the derived bush implementation this might require inverting the iteration direction. Hence it is an abstract method here- Parameters:
originDestinationDirection
- when true, iterator runs topological order from origin towards destinatino, when false, they other way around- Returns:
- iterator over topologically ordered bush vertices
-
getRootZoneVertex
public CentroidVertex getRootZoneVertex()
Each rooted bush is expected to have a zone attached to its root vertex, which is to be returned here- Specified by:
getRootZoneVertex
in classRootedBush<DirectedVertex,EdgeSegment>
- Returns:
- root zone
-
shallowClone
public OriginBush shallowClone()
Create a shallow copy of this entity- Specified by:
shallowClone
in interfaceBush
- Specified by:
shallowClone
in interfaceIdAble
- Specified by:
shallowClone
in classRootedLabelledBush
- Returns:
- shallow copy of entity
-
deepClone
public OriginBush deepClone()
An id entity should always support a deep copy, i.e., all "owned" members will be deep copied when a clone of this instance is created via this call. To be used with caution if not called by managed id container related code
-
toString
public String toString()
- Overrides:
toString
in classRootedLabelledBush
-
getOrigin
public CentroidVertex getOrigin()
collect origin of this bush- Returns:
- origin zone
-
addOriginDemandPcuH
public void addOriginDemandPcuH(double demandPcuH)
add origin demand for this origin bush- Parameters:
demandPcuH
- demand to add
-
getOriginDemandPcuH
public Double getOriginDemandPcuH()
Get the origin demand- Returns:
- demand (if any)
-
-