Class LMApproximator

java.lang.Object
com.graphhopper.routing.lm.LMApproximator
All Implemented Interfaces:
WeightApproximator

public class LMApproximator extends Object implements WeightApproximator
This class is a weight approximation based on precalculated landmarks.
Author:
Peter Karich
  • 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

      public LMApproximator setEpsilon(double epsilon)
      Increase approximation with higher epsilon
    • approximate

      public double approximate(int v)
      Specified by:
      approximate in interface WeightApproximator
      Returns:
      minimal weight of the specified currentNode to the 'to' node
    • setTo

      public void setTo(int t)
      Specified by:
      setTo in interface WeightApproximator
    • reverse

      public WeightApproximator 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 interface WeightApproximator
    • getSlack

      public double getSlack()
      Specified by:
      getSlack in interface WeightApproximator
    • toString

      public String toString()
      Overrides:
      toString in class Object