Package org.goplanit.algorithms.shortest
Class ShortestBushGeneralised
- java.lang.Object
-
- org.goplanit.algorithms.shortest.ShortestPathGeneralised
-
- org.goplanit.algorithms.shortest.ShortestBushGeneralised
-
- All Implemented Interfaces:
ShortestBushAllToOne
,ShortestBushOneToAll
public class ShortestBushGeneralised extends ShortestPathGeneralised implements ShortestBushOneToAll, ShortestBushAllToOne
Shortest bush algorithm. Shortest bush algorithm is a one-to-all/all-to-one implementation (depending on configuration) of all (equal cost) implicit shortest bush comprising of all equal cost paths based on the generalised costs on each link segment (edge). It is identical to Dijkstra's shortest path algorithm except that it creates a bush rooted at the start vertex towards the destination vertex, where each node stores all its equal cheapest predecessor nodes from which the bush can be extracted when traversing it in reverse order.when configured as one-to-all, the result is to be traversed in reverse direction (destination to origin) to obtian apth information, whereas in all-to-one form the result is traversed from origin to destination (as the search itself is reversed in that case). 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 boolean
currEqualShortestCosts
track if most recent tested costs were equal, if so, any processed edge segment is to be added to existing shortest edge segments to complement the bushprotected Object[]
nextEdgeSegments
Track incoming edge segment(s) that are shortest for each vertex in this array.-
Fields inherited from class org.goplanit.algorithms.shortest.ShortestPathGeneralised
currentSource, edgeSegmentCosts, getEdgeSegmentsInDirection, getVertexAtExtreme, numberOfVertices
-
-
Constructor Summary
Constructors Constructor Description ShortestBushGeneralised(double[] edgeSegmentCosts, int numberOfVertices)
Constructor for an edge cost based algorithm for finding shortest bushes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ShortestBushResult
executeAllToOne(DirectedVertex currentDestination)
Construct shortest bush result from all nodes to destination node in the network based on directed LinkSegment edgesShortestBushResult
executeOneToAll(DirectedVertex currentOrigin)
Construct shortest bush result from origin node to all other nodes in the network based on directed LinkSegment edges-
Methods inherited from class org.goplanit.algorithms.shortest.ShortestPathGeneralised
execute, executeAllToOne, executeOneToAll, getEdgeSegmentCost, initialiseOpenVertices, internalExecute
-
-
-
-
Field Detail
-
nextEdgeSegments
protected Object[] nextEdgeSegments
Track incoming edge segment(s) that are shortest for each vertex in this array. In case there is only a single shortest option, the object is an edge segment, otherwise it is a collection of edge segments
-
currEqualShortestCosts
protected boolean currEqualShortestCosts
track if most recent tested costs were equal, if so, any processed edge segment is to be added to existing shortest edge segments to complement the bush
-
-
Constructor Detail
-
ShortestBushGeneralised
public ShortestBushGeneralised(double[] edgeSegmentCosts, int numberOfVertices)
Constructor for an edge cost based algorithm for finding shortest bushes.- Parameters:
edgeSegmentCosts
- Edge segment costs, both physical and connectoidnumberOfVertices
- Vertices, both nodes and centroids
-
-
Method Detail
-
executeOneToAll
public ShortestBushResult executeOneToAll(DirectedVertex currentOrigin)
Construct shortest bush result from origin node to all other nodes in the network based on directed LinkSegment edges- Specified by:
executeOneToAll
in interfaceShortestBushOneToAll
- Parameters:
currentOrigin
- origin vertex of source node- Returns:
- shortest bush result that can be used to extract bushes
-
executeAllToOne
public ShortestBushResult executeAllToOne(DirectedVertex currentDestination)
Construct shortest bush result from all nodes to destination node in the network based on directed LinkSegment edges- Specified by:
executeAllToOne
in interfaceShortestBushAllToOne
- Parameters:
currentDestination
- origin vertex of source node- Returns:
- shortest bush result that can be used to extract bushes
-
-