Class TLcdCrossCountryShortestRouteAlgorithm
java.lang.Object
com.luciad.network.algorithm.routing.TLcdCrossCountryShortestRouteAlgorithm
Implementation of a shortest route algorithm, optimized for cross country movement problems.
Cross country movement is the problem of finding the shortest route between two points
in a specific area where no network (nodes and edges) is available. The area has an associated
cost function defining for each two points in the area what the cost is to move from the
first to the second point in a straight line.
The algorithm is based on the well-known Dijkstra algorithm, but is optimized for cross country
movement.
This implementation discretizes the domain in model coordinates. All points and distance that
are passed directly or indirectly (e.g. the bounds of a parameter) to an instance of this class or
returned directly or indirectly (e.g. the points in the returned route) by an instance of this
class are also expressed in this reference, unless explicitely stated otherwise.
- Since:
- 9.1
-
Constructor Summary
ConstructorDescriptionTLcdCrossCountryShortestRouteAlgorithm
(double aXDiscretizationStep, double aYDiscretizationStep) Constructs a newTLcdCrossCountryShortestRouteAlgorithm
with the specified discretization. -
Method Summary
Modifier and TypeMethodDescriptiongetShortestRoute
(ILcdPoint aStartPoint, ILcdPoint aEndPoint, ILcdCrossCountryDistanceFunction aDistanceFunction, ILcdCrossCountryDistanceFunction aHeuristicDistanceFunction, double aMaxSearchDistance) Returns anILcdRoute
describing the shortest route between the start and end point.double
Returns the distance in thex
direction between the nodes of the discretized graph.double
Returns the distance in they
direction between the nodes of the discretized graph.void
setXDiscretizationStep
(double aXDiscretizationStep) Sets the distance in thex
direction between the nodes of the discretized graph.void
setYDiscretizationStep
(double aYDiscretizationStep) Sets the distance in they
direction between the nodes of the discretized graph.
-
Constructor Details
-
TLcdCrossCountryShortestRouteAlgorithm
public TLcdCrossCountryShortestRouteAlgorithm(double aXDiscretizationStep, double aYDiscretizationStep) Constructs a newTLcdCrossCountryShortestRouteAlgorithm
with the specified discretization.- Parameters:
aXDiscretizationStep
- the distance in thex
direction between the nodes of the discretized graphaYDiscretizationStep
- the distance in they
direction between the nodes of the discretized graph- Throws:
IllegalArgumentException
- if the specified x or y discretization step is ≤ 0
-
-
Method Details
-
getXDiscretizationStep
public double getXDiscretizationStep()Returns the distance in thex
direction between the nodes of the discretized graph.- Returns:
- the distance in the
x
direction between the nodes of the discretized graph
-
setXDiscretizationStep
public void setXDiscretizationStep(double aXDiscretizationStep) Sets the distance in thex
direction between the nodes of the discretized graph.- Parameters:
aXDiscretizationStep
- the distance in thex
direction between the nodes of the discretized graph- Throws:
IllegalArgumentException
- if the specified discretization step is ≤ 0
-
getYDiscretizationStep
public double getYDiscretizationStep()Returns the distance in they
direction between the nodes of the discretized graph.- Returns:
- the distance in the
y
direction between the nodes of the discretized graph
-
setYDiscretizationStep
public void setYDiscretizationStep(double aYDiscretizationStep) Sets the distance in they
direction between the nodes of the discretized graph.- Parameters:
aYDiscretizationStep
- the distance in they
direction between the nodes of the discretized graph- Throws:
IllegalArgumentException
- if the specified discretization step is ≤ 0
-
getShortestRoute
public ILcdRoute<ILcdPoint,ILcdPolyline> getShortestRoute(ILcdPoint aStartPoint, ILcdPoint aEndPoint, ILcdCrossCountryDistanceFunction aDistanceFunction, ILcdCrossCountryDistanceFunction aHeuristicDistanceFunction, double aMaxSearchDistance) Returns anILcdRoute
describing the shortest route between the start and end point.- Parameters:
aStartPoint
- the start point.aEndPoint
- the end point.aDistanceFunction
- a function that computes the cost to travel from one point to another.aHeuristicDistanceFunction
- a distance function, indicating the estimated cost to travel from one point to another. This function can be used to accelerate the search process. Note that this estimate should always be an underestimate of the real remaining distance, in order to result in an optimal solution. A heuristic function, although it can greatly increase the performance is not required for the algorithm to work - it may benull
.aMaxSearchDistance
- the maximum distance of the returned route.- Returns:
- the shortest route between the start and end point, or
null
if no such route is found. - Throws:
IllegalArgumentException
- if the start or end point is not inside the bounds of the distance function.
-