- 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) classRoadAStar.VirtualCandidateThis is a graph point connected to aRoadAStar.VirtualPointthat is a valid candidate for the A* algorithm.(package private) static classRoadAStar.VirtualConnectionThis is the relationship between aRoadAStar.VirtualPointand aRoadAStar.VirtualSegment.(package private) static classRoadAStar.VirtualPointThis virtual point corresponds to a virtual graph connection point that could be the start or the end of the A* search.(package private) static classRoadAStar.VirtualSegmentIs 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 booleaninvalidPathSegmentFound(int index, RoadSegment segment, RoadPath path)Invoked when a segment could not be added into the path.RoadPathsolve(RoadConnection startPoint, RoadConnection endPoint)Run the A* algorithm assuming that the graph is oriented is an orientation tool was passed to the constructor.RoadPathsolve(RoadConnection startPoint, Point2D<?,?> endPoint, RoadNetwork network)Run the A* algorithm from the nearest segment to startPoint to the nearest segment to endPoint.RoadPathsolve(Point2D<?,?> startPoint, RoadConnection endPoint, RoadNetwork network)Run the A* algorithm from the nearest segment to startPoint to the nearest segment to endPoint.RoadPathsolve(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:AStarRun 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:
solvein classAStar<RoadPath,RoadSegment,RoadConnection>- Parameters:
startPoint- is the starting point.endPoint- is the point to reach.- Returns:
- the found path, or
nullif 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
nullif 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
nullif 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
nullif none found.
-
translateCandidate
protected AStarNode<RoadSegment,RoadConnection> translateCandidate(RoadConnection endPoint, AStarNode<RoadSegment,RoadConnection> node)
Description copied from class:AStarTranslate 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 repliesnullif 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:
translateCandidatein 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
nullif the node corresponds to the endPoint.
-
invalidPathSegmentFound
protected boolean invalidPathSegmentFound(int index, RoadSegment segment, RoadPath path)Description copied from class:AStarInvoked when a segment could not be added into the path.In standard AStar implementation, this function replies
false.- Overrides:
invalidPathSegmentFoundin 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:
trueif the path building should continue,falseif the path building should stop and replies anullpath.
-
-