Class AirLocation
- java.lang.Object
-
- org.optaplanner.examples.common.domain.AbstractPersistable
-
- org.optaplanner.examples.tsp.domain.location.Location
-
- org.optaplanner.examples.tsp.domain.location.AirLocation
-
public class AirLocation extends Location
The cost between 2 locations is a straight line: the euclidean distance between their GPS coordinates. Used withDistanceType.AIR_DISTANCE.
-
-
Constructor Summary
Constructors Constructor Description AirLocation()AirLocation(long id, double latitude, double longitude)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetDistanceTo(Location location)The distance's unit of measurement depends on theTspSolution'sDistanceType.-
Methods inherited from class org.optaplanner.examples.tsp.domain.location.Location
getAirDistanceDoubleTo, getAngle, getLatitude, getLongitude, getName, setLatitude, setLongitude, setName, toString
-
Methods inherited from class org.optaplanner.examples.common.domain.AbstractPersistable
getId, setId
-
-
-
-
Method Detail
-
getDistanceTo
public long getDistanceTo(Location location)
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
-
-