Package org.goplanit.algorithms.shortest
Class ConjugateShortestPathGeneralised
- java.lang.Object
-
- org.goplanit.algorithms.shortest.ShortestPathGeneralised
-
- org.goplanit.algorithms.shortest.ConjugateShortestPathGeneralised
-
public class ConjugateShortestPathGeneralised extends ShortestPathGeneralised
Conjugate version of shortest path algorithm. The only difference is found in that the original network edge segment costs are now obtained on the turn level, where each conjugate edge segment (turn) collects its cost by means of its incoming original edge segment. Note that for the final turn this means the last edge segemnt's cost is missed which is compensated for at the end In its current form, it assumes a macroscopic network and macroscopic link segments to operate on- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description protected ConjugateConnectoidNodes
conjugateConnectoidNodes
needed to track the costs to the centroids on the final original edge segments-
Fields inherited from class org.goplanit.algorithms.shortest.ShortestPathGeneralised
currentSource, edgeSegmentCosts, getEdgeSegmentsInDirection, getVertexAtExtreme, numberOfVertices
-
-
Constructor Summary
Constructors Constructor Description ConjugateShortestPathGeneralised(double[] originalEdgeSegmentCosts, int numberOfConjugateVertices, ConjugateConnectoidNodes conjugateConnectoidNodes)
Constructor for an edge cost based Dijkstra algorithm for finding shortest paths.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Double
getEdgeSegmentCost(EdgeSegment edgeSegment)
For a conjugate network we obtain the conjugate edge segment cost by means of the incoming original edge segment of the turn, i.e., conjugate edge segmentprotected double[]
internalExecute(BiPredicate<Double,Double> verifyVertex, Consumer<EdgeSegment> shortestAlternativeEdgeSegmentConsumer)
Generalised shortest-X search-
Methods inherited from class org.goplanit.algorithms.shortest.ShortestPathGeneralised
execute, executeAllToOne, executeOneToAll, initialiseOpenVertices
-
-
-
-
Field Detail
-
conjugateConnectoidNodes
protected final ConjugateConnectoidNodes conjugateConnectoidNodes
needed to track the costs to the centroids on the final original edge segments
-
-
Constructor Detail
-
ConjugateShortestPathGeneralised
public ConjugateShortestPathGeneralised(double[] originalEdgeSegmentCosts, int numberOfConjugateVertices, ConjugateConnectoidNodes conjugateConnectoidNodes)
Constructor for an edge cost based Dijkstra algorithm for finding shortest paths.- Parameters:
originalEdgeSegmentCosts
- original network (non-conjugate) edge segment costs, both physical and virtualnumberOfConjugateVertices
- number of conjugate verticesconjugateConnectoidNodes
- conjugate connectoid nodes needed to extract the cost on the last original edge segments to reach the original centroids
-
-
Method Detail
-
internalExecute
protected double[] internalExecute(BiPredicate<Double,Double> verifyVertex, Consumer<EdgeSegment> shortestAlternativeEdgeSegmentConsumer)
Generalised shortest-X search- Overrides:
internalExecute
in classShortestPathGeneralised
- Parameters:
verifyVertex
- predicate to test if the new cost to reach vertex is considered shortest compared to existing costshortestAlternativeEdgeSegmentConsumer
- process the "shortest" alternative edge segment when verified by the predicate- Returns:
- found shortest costs for vertices, where the most recent found "shortest" cost is the one available in the array
-
getEdgeSegmentCost
protected Double getEdgeSegmentCost(EdgeSegment edgeSegment)
For a conjugate network we obtain the conjugate edge segment cost by means of the incoming original edge segment of the turn, i.e., conjugate edge segment- Overrides:
getEdgeSegmentCost
in classShortestPathGeneralised
- Parameters:
edgeSegment
- to use- Returns:
- cost of traversing edge segment
-
-