- java.lang.Object
-
- org.arakhne.afc.math.graph.astar.AStar<RoadPath,RoadSegment,RoadConnection>
-
- org.arakhne.afc.gis.road.path.astar.RoadAStar
-
public class RoadAStar extends AStar<RoadPath,RoadSegment,RoadConnection>
This class provides an implementation of the A* algorithm dedicated to roads.- Since:
- 14.0
- Version:
- 17.0 2020-01-04 14:41:55
- Author:
- Stéphane GALLAND
- Maven Group Id:
- org.arakhne.afc.gis
- Maven Artifact Id:
- gisroad
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
RoadAStar.VirtualCandidate
This is a graph point connected to aRoadAStar.VirtualPoint
that is a valid candidate for the A* algorithm.(package private) static class
RoadAStar.VirtualConnection
This is the relationship between aRoadAStar.VirtualPoint
and aRoadAStar.VirtualSegment
.(package private) static class
RoadAStar.VirtualPoint
This virtual point corresponds to a virtual graph connection point that could be the start or the end of the A* search.(package private) static class
RoadAStar.VirtualSegment
Is a road segment that connects a virtual point to a real road connection.-
Nested classes/interfaces inherited from class org.arakhne.afc.math.graph.astar.AStar
AStar.Candidate, AStar.CloseComparator<ST extends GraphSegment<ST,PT>,PT extends GraphPoint<PT,ST>>, AStar.OpenComparator<ST extends GraphSegment<ST,PT>,PT extends GraphPoint<PT,ST>>
-
-
Constructor Summary
Constructors Constructor Description RoadAStar()
Create the A* algorithm with theeuclidian distance heuristic
.RoadAStar(RoadAStarPathFactory pathFactory)
Create the A* algorithm with theeuclidian distance heuristic
.RoadAStar(AStarHeuristic<? super RoadConnection> heuristic)
Constructor.RoadAStar(AStarHeuristic<? super RoadConnection> heuristic, RoadAStarPathFactory pathFactory)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
invalidPathSegmentFound(int index, RoadSegment segment, RoadPath path)
Invoked when a segment could not be added into the path.RoadPath
solve(RoadConnection startPoint, RoadConnection endPoint)
Run the A* algorithm assuming that the graph is oriented is an orientation tool was passed to the constructor.RoadPath
solve(RoadConnection startPoint, Point2D<?,?> endPoint, RoadNetwork network)
Run the A* algorithm from the nearest segment to startPoint to the nearest segment to endPoint.RoadPath
solve(Point2D<?,?> startPoint, RoadConnection endPoint, RoadNetwork network)
Run the A* algorithm from the nearest segment to startPoint to the nearest segment to endPoint.RoadPath
solve(Point2D<?,?> startPoint, Point2D<?,?> endPoint, RoadNetwork network)
Run the A* algorithm from the nearest segment to startPoint to the nearest segment to endPoint.protected AStarNode<RoadSegment,RoadConnection>
translateCandidate(RoadConnection endPoint, AStarNode<RoadSegment,RoadConnection> node)
Translate the A* node.-
Methods inherited from class org.arakhne.afc.math.graph.astar.AStar
addAStarListener, addToPath, computeCostFor, computeCostFor, estimate, getCostComputer, getEvaluationHeuristic, getPathFactory, getSegmentOrientationTool, getSegmentReplacer, isClosedNodeReopeningEnabled, newAStarNode, newPath, removeAStarListener, replaceSegment, setClosedNodeReopeningEnabled, setCostComputer, setEvaluationHeuristic, setPathFactory, setPathType, setSegmentOrientationTool, setSegmentReplacer, solve
-
-
-
-
Constructor Detail
-
RoadAStar
public RoadAStar()
Create the A* algorithm with theeuclidian distance heuristic
.
-
RoadAStar
public RoadAStar(AStarHeuristic<? super RoadConnection> heuristic)
Constructor.- Parameters:
heuristic
- is the heuristic that must be use by the A* algorithm.
-
RoadAStar
public RoadAStar(RoadAStarPathFactory pathFactory)
Create the A* algorithm with theeuclidian distance heuristic
.- Parameters:
pathFactory
- is the factory to use to create a road path.
-
RoadAStar
public RoadAStar(AStarHeuristic<? super RoadConnection> heuristic, RoadAStarPathFactory pathFactory)
Constructor.- Parameters:
heuristic
- is the heuristic that must be use by the A* algorithm.pathFactory
- is the factory to use to create a road path.
-
-
Method Detail
-
solve
public RoadPath solve(RoadConnection startPoint, RoadConnection endPoint)
Description copied from class:AStar
Run the A* algorithm assuming that the graph is oriented is an orientation tool was passed to the constructor.The orientation of the graph may also be overridden by the implementations of the
A* nodes
.- Overrides:
solve
in classAStar<RoadPath,RoadSegment,RoadConnection>
- Parameters:
startPoint
- is the starting point.endPoint
- is the point to reach.- Returns:
- the found path, or
null
if none found.
-
solve
public RoadPath solve(Point2D<?,?> startPoint, Point2D<?,?> endPoint, RoadNetwork network)
Run the A* algorithm from the nearest segment to startPoint to the nearest segment to endPoint.- Parameters:
startPoint
- is the starting point.endPoint
- is the point to reach.network
- is the road network to explore.- Returns:
- the found path, or
null
if none found.
-
solve
public RoadPath solve(RoadConnection startPoint, Point2D<?,?> endPoint, RoadNetwork network)
Run the A* algorithm from the nearest segment to startPoint to the nearest segment to endPoint.- Parameters:
startPoint
- is the starting point.endPoint
- is the point to reach.network
- is the road network to explore.- Returns:
- the found path, or
null
if none found.
-
solve
public RoadPath solve(Point2D<?,?> startPoint, RoadConnection endPoint, RoadNetwork network)
Run the A* algorithm from the nearest segment to startPoint to the nearest segment to endPoint.- Parameters:
startPoint
- is the starting point.endPoint
- is the point to reach.network
- is the road network to explore.- Returns:
- the found path, or
null
if none found.
-
translateCandidate
protected AStarNode<RoadSegment,RoadConnection> translateCandidate(RoadConnection endPoint, AStarNode<RoadSegment,RoadConnection> node)
Description copied from class:AStar
Translate the A* node. This function is invoked prior to any treatment with the given A* node. It is assumed that this function replies a good translation of the given node for the A* algorithm; or it repliesnull
if the given node is the target node of the A* algorithm, ie. it corresponds to the given endPoint.By default, this function replies the node itself.
- Overrides:
translateCandidate
in classAStar<RoadPath,RoadSegment,RoadConnection>
- Parameters:
endPoint
- is the end point given to solve function.node
- is the current A* node to translate.- Returns:
- the translation of the node, or
null
if the node corresponds to the endPoint.
-
invalidPathSegmentFound
protected boolean invalidPathSegmentFound(int index, RoadSegment segment, RoadPath path)
Description copied from class:AStar
Invoked when a segment could not be added into the path.In standard AStar implementation, this function replies
false
.- Overrides:
invalidPathSegmentFound
in classAStar<RoadPath,RoadSegment,RoadConnection>
- Parameters:
index
- is the index of the invalid segment.segment
- is the segment that cannot be addedpath
- is the current state of the path.- Returns:
true
if the path building should continue,false
if the path building should stop and replies anull
path.
-
-