Class RoadLocation
java.lang.Object
org.optaplanner.examples.common.domain.AbstractPersistable
org.optaplanner.examples.tsp.domain.location.Location
org.optaplanner.examples.tsp.domain.location.RoadLocation
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.-
Field Summary
FieldsFields inherited from class org.optaplanner.examples.tsp.domain.location.Location
latitude, longitude, nameFields inherited from class org.optaplanner.examples.common.domain.AbstractPersistable
id -
Constructor Summary
ConstructorsConstructorDescriptionRoadLocation(long id) RoadLocation(long id, double latitude, double longitude) -
Method Summary
Modifier and TypeMethodDescriptionlonggetDistanceTo(Location location) The distance's unit of measurement depends on theTspSolution'sDistanceType.voidsetTravelDistanceMap(Map<RoadLocation, Double> travelDistanceMap) Methods inherited from class org.optaplanner.examples.tsp.domain.location.Location
getAirDistanceDoubleTo, getAngle, getLatitude, getLongitude, getName, setLatitude, setLongitude, setName, toStringMethods inherited from class org.optaplanner.examples.common.domain.AbstractPersistable
getId, setId
-
Field Details
-
travelDistanceMap
-
-
Constructor Details
-
RoadLocation
public RoadLocation() -
RoadLocation
public RoadLocation(long id) -
RoadLocation
public RoadLocation(long id, double latitude, double longitude)
-
-
Method Details
-
getTravelDistanceMap
-
setTravelDistanceMap
-
getDistanceTo
Description copied from class:LocationThe distance's unit of measurement depends on theTspSolution'sDistanceType. It can be in miles or km, but for most cases it's in the TSPLIB's unit of measurement.- Specified by:
getDistanceToin classLocation- Parameters:
location- never null- Returns:
- a positive number, the distance multiplied by 1000 to avoid floating point arithmetic rounding errors
-