Class RoadLocation


  • public class RoadLocation
    extends Location
    The cost between 2 locations was precalculated on a real road network route. The cost itself might be the distance in km, the travel time, the fuel usage or a weighted function of any of those. Used with DistanceType.ROAD_DISTANCE.
    • Constructor Detail

      • RoadLocation

        public RoadLocation()
      • RoadLocation

        public RoadLocation​(long id,
                            double latitude,
                            double longitude)
    • Method Detail

      • setTravelDistanceMap

        public void setTravelDistanceMap​(Map<RoadLocation,​Double> travelDistanceMap)
      • getDistanceTo

        public long getDistanceTo​(Location location)
        Description copied from class: Location
        The distance's unit of measurement depends on the TspSolution's DistanceType. It can be in miles or km, but for most cases it's in the TSPLIB's unit of measurement.
        Specified by:
        getDistanceTo in class Location
        Parameters:
        location - never null
        Returns:
        a positive number, the distance multiplied by 1000 to avoid floating point arithmetic rounding errors