Package org.goplanit.assignment.ltm.sltm
Class RootedBush<V extends DirectedVertex,ES extends EdgeSegment>
- java.lang.Object
-
- org.goplanit.assignment.ltm.sltm.RootedBush<V,ES>
-
- All Implemented Interfaces:
Comparable<IdAble>
,Bush
,IdAble
- Direct Known Subclasses:
ConjugateDestinationBush
,RootedLabelledBush
public abstract class RootedBush<V extends DirectedVertex,ES extends EdgeSegment> extends Object implements Bush
A rooted bush is an acyclic directed graph comprising of implicit paths along a network. It has a single root which can be any vertex with only outgoing edge segments. while acyclic its direction can be either be in up or downstream direction compared to the super network it is situated on.The vertices in the bush represent link segments in the physical network, whereas each edge represents a turn from one link to another. This way each splitting rate uniquely relates to a single turn and all outgoing edges of a vertex represent all turns of a node's incoming link
- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description protected IdGroupingToken
bushGroupingToken
token for id generation unique within this bushprotected Map<CentroidVertex,Double>
originDemandsPcuH
the origin demands (PCU/h) of the bush all representing a root (starting point) within the DAGprotected boolean
requireTopologicalSortUpdate
track if underlying acyclic graph is modified, if so, an update of the topological sort is required flagged by this member
-
Constructor Summary
Constructors Constructor Description RootedBush(RootedBush<V,ES> other, boolean deepCopy)
Copy constructorRootedBush(IdGroupingToken idToken, DirectedVertex rootVertex, boolean inverted, UntypedACyclicSubGraph<V,ES> dag)
Constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
addOriginDemandPcuH(CentroidVertex originCentroidVertex, double demandPcuH)
Track origin demands for bushabstract MinMaxPathResult
computeMinMaxShortestPaths(double[] linkSegmentCosts, int totalTransportNetworkVertices)
Compute the min-max path tree rooted in location depending on underlying dag configuration of derived implementation and given the provided (network wide) costs.abstract RootedBush<V,ES>
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.protected UntypedACyclicSubGraph<V,ES>
getDag()
Access to the underlying dagIterator<V>
getDirectedVertexIterator()
Collect iterator for all unique directed vertices in the bushlong
getId()
Collect id of the entityDouble
getOriginDemandPcuH(CentroidVertex originVertex)
Get the origin demand for a given originSet<CentroidVertex>
getOriginVertices()
Origins (with non-zero flow) registered on this bushV
getRootVertex()
root vertex of the bushprotected abstract CentroidVertex
getRootZoneVertex()
Each rooted bush is expected to have a zone attached to its root vertex, which is to be returned hereboolean
isInverted()
Indicates if bush has inverted direction w.r.t.abstract RootedBush<V,ES>
shallowClone()
Create a shallow copy of this entityabstract void
syncToNetworkFlows(double[] flowAcceptanceFactors)
Conduct an update of the bush turn flows based on the network flow acceptance factors by conducting a bush DAG loading and updating the turn sending flows from the root, i.e., scale them back with the flow acceptance factor whenever one is encountered.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.goplanit.assignment.ltm.sltm.Bush
getShortestSearchType, getTopologicalIterator
-
Methods inherited from interface org.goplanit.utils.id.IdAble
compareTo, idEquals, idHashCode
-
-
-
-
Field Detail
-
originDemandsPcuH
protected Map<CentroidVertex,Double> originDemandsPcuH
the origin demands (PCU/h) of the bush all representing a root (starting point) within the DAG
-
bushGroupingToken
protected final IdGroupingToken bushGroupingToken
token for id generation unique within this bush
-
requireTopologicalSortUpdate
protected boolean requireTopologicalSortUpdate
track if underlying acyclic graph is modified, if so, an update of the topological sort is required flagged by this member
-
-
Constructor Detail
-
RootedBush
public RootedBush(IdGroupingToken idToken, DirectedVertex rootVertex, boolean inverted, UntypedACyclicSubGraph<V,ES> dag)
Constructor- Parameters:
idToken
- the token to base the id generation onrootVertex
- the root vertex of the bush which can be the end or starting point depending whether or not direction is invertedinverted
- when true bush ends at root vertex and all other vertices precede it, when false the root is the starting point and all other vertices succeed itdag
- to use for the subgraph representation
-
RootedBush
public RootedBush(RootedBush<V,ES> other, boolean deepCopy)
Copy constructor- Parameters:
other
- to copydeepCopy
- when true, create a eep copy, shallow copy otherwise
-
-
Method Detail
-
addOriginDemandPcuH
protected void addOriginDemandPcuH(CentroidVertex originCentroidVertex, double demandPcuH)
Track origin demands for bush- Parameters:
originCentroidVertex
- to setdemandPcuH
- demand to set
-
getDag
protected UntypedACyclicSubGraph<V,ES> getDag()
Access to the underlying dag- Returns:
- dag of the bush
-
syncToNetworkFlows
public abstract void syncToNetworkFlows(double[] flowAcceptanceFactors)
Conduct an update of the bush turn flows based on the network flow acceptance factors by conducting a bush DAG loading and updating the turn sending flows from the root, i.e., scale them back with the flow acceptance factor whenever one is encountered.- Parameters:
flowAcceptanceFactors
- to use
-
computeMinMaxShortestPaths
public abstract MinMaxPathResult computeMinMaxShortestPaths(double[] linkSegmentCosts, int totalTransportNetworkVertices)
Compute the min-max path tree rooted in location depending on underlying dag configuration of derived implementation 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- 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
-
shallowClone
public abstract RootedBush<V,ES> shallowClone()
Create a shallow copy of this entity- Specified by:
shallowClone
in interfaceBush
- Specified by:
shallowClone
in interfaceIdAble
- Returns:
- shallow copy of entity
-
deepClone
public abstract RootedBush<V,ES> 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
-
getId
public long getId()
Collect id of the entity
-
getRootVertex
public V getRootVertex()
root vertex of the bush- Returns:
- root vertex of the bush
-
isInverted
public boolean isInverted()
Indicates if bush has inverted direction w.r.t. its root- Returns:
- true when inverted, false otherwise
-
getOriginVertices
public Set<CentroidVertex> getOriginVertices()
Origins (with non-zero flow) registered on this bush- Returns:
- origins on this bush
-
getOriginDemandPcuH
public Double getOriginDemandPcuH(CentroidVertex originVertex)
Get the origin demand for a given origin- Parameters:
originVertex
- to collect demand for- Returns:
- demand (if any)
-
getDirectedVertexIterator
public Iterator<V> getDirectedVertexIterator()
Collect iterator for all unique directed vertices in the bush- Returns:
- iterator
-
getRootZoneVertex
protected abstract CentroidVertex getRootZoneVertex()
Each rooted bush is expected to have a zone attached to its root vertex, which is to be returned here- Returns:
- root zone
-
-