Package com.graphhopper.routing.lm
Class LMApproximator
java.lang.Object
com.graphhopper.routing.lm.LMApproximator
- All Implemented Interfaces:
WeightApproximator
This class is a weight approximation based on precalculated landmarks.
- Author:
- Peter Karich
-
Constructor Summary
ConstructorsConstructorDescriptionLMApproximator
(Graph graph, Weighting lmWeighting, Weighting routingWeighting, int maxBaseNodes, LandmarkStorage lms, int activeCount, double factor, boolean reverse) -
Method Summary
Modifier and TypeMethodDescriptiondouble
approximate
(int v) static LMApproximator
forLandmarks
(Graph g, Weighting weighting, LandmarkStorage lms, int activeLM) double
getSlack()
reverse()
Makes a 'reverse' copy of itself to make it possible using the two objects independent e.g.setEpsilon
(double epsilon) Increase approximation with higher epsilonvoid
setTo
(int t) toString()
-
Constructor Details
-
LMApproximator
public LMApproximator(Graph graph, Weighting lmWeighting, Weighting routingWeighting, int maxBaseNodes, LandmarkStorage lms, int activeCount, double factor, boolean reverse)
-
-
Method Details
-
forLandmarks
public static LMApproximator forLandmarks(Graph g, Weighting weighting, LandmarkStorage lms, int activeLM) - Parameters:
weighting
- the weighting used for the current path calculation, not necessarily the same that we used for the LM preparation. All edge weights must be larger or equal compared to those used for the preparation.
-
setEpsilon
Increase approximation with higher epsilon -
approximate
public double approximate(int v) - Specified by:
approximate
in interfaceWeightApproximator
- Returns:
- minimal weight of the specified currentNode to the 'to' node
-
setTo
public void setTo(int t) - Specified by:
setTo
in interfaceWeightApproximator
-
reverse
Description copied from interface:WeightApproximator
Makes a 'reverse' copy of itself to make it possible using the two objects independent e.g. on different threads. Do not copy state depending on the current approximate calls. 'reverse' means the WeightApproximator should handle approximate calls towards the 'from' instead towards the 'to'.- Specified by:
reverse
in interfaceWeightApproximator
-
getSlack
public double getSlack()- Specified by:
getSlack
in interfaceWeightApproximator
-
toString
-