Class AvoidEdgesWeighting

java.lang.Object
com.graphhopper.routing.weighting.AbstractAdjustedWeighting
com.graphhopper.routing.weighting.AvoidEdgesWeighting
All Implemented Interfaces:
Weighting

public class AvoidEdgesWeighting extends AbstractAdjustedWeighting
Increases the weight for a certain set of edges by a given factor and thus makes them less likely to be part of a shortest path
Author:
Robin Boldt
  • Field Details

    • avoidedEdges

      protected com.carrotsearch.hppc.IntSet avoidedEdges
  • Constructor Details

    • AvoidEdgesWeighting

      public AvoidEdgesWeighting(Weighting superWeighting)
  • Method Details

    • setEdgePenaltyFactor

      public AvoidEdgesWeighting setEdgePenaltyFactor(double edgePenaltyFactor)
    • setAvoidedEdges

      public AvoidEdgesWeighting setAvoidedEdges(com.carrotsearch.hppc.IntSet avoidedEdges)
    • 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.
      Specified by:
      calcEdgeWeight in interface Weighting
      Overrides:
      calcEdgeWeight in class AbstractAdjustedWeighting
      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()