Class FastestWeighting

java.lang.Object
com.graphhopper.routing.weighting.AbstractWeighting
com.graphhopper.routing.weighting.FastestWeighting
All Implemented Interfaces:
Weighting

public class FastestWeighting extends AbstractWeighting
Calculates the fastest route with the specified vehicle (VehicleEncoder). Calculates the weight in seconds.

Author:
Peter Karich
  • Field Details

    • DESTINATION_FACTOR

      public static String DESTINATION_FACTOR
    • PRIVATE_FACTOR

      public static String PRIVATE_FACTOR
    • SPEED_CONV

      protected static final double SPEED_CONV
      Converting to seconds is not necessary but makes adding other penalties easier (e.g. turn costs or traffic light costs etc)
      See Also:
  • Constructor Details

  • Method Details

    • calcMinWeightPerDistance

      public double calcMinWeightPerDistance()
      Description copied from interface: Weighting
      Used only for the heuristic estimation in A*
      Returns:
      minimal weight per meter. E.g. if you calculate the fastest way the return value is '1/max_velocity' or a shortest weighting would return 1.
    • calcEdgeWeight

      public double calcEdgeWeight(EdgeIteratorState edgeState, boolean reverse)
      Description copied from interface: Weighting
      This method calculates the weight of a given EdgeIteratorState. E.g. a high value indicates that the edge should be avoided during shortest path search. Make sure that this method is very fast and optimized as this is called potentially millions of times for one route or a lot more for nearly any preprocessing phase.
      Parameters:
      edgeState - the edge for which the weight should be calculated
      reverse - if the specified edge is specified in reverse direction e.g. from the reverse case of a bidirectional search.
      Returns:
      the calculated weight with the specified velocity has to be in the range of 0 and +Infinity. Make sure your method does not return NaN which can e.g. occur for 0/0.
    • getName

      public String getName()