public class DistanceMetric extends Object
DistanceMetric.Ellipsoid
).
In the legacy mode (when ellipsoid is not set), distances are computed using Euclidian distance and 1 unit is considered 10 meters.
Modifier and Type | Class and Description |
---|---|
static class |
DistanceMetric.Ellipsoid |
Constructor and Description |
---|
DistanceMetric()
Default properties
|
DistanceMetric(DataProperties properties)
Configured using properties
|
DistanceMetric(DistanceMetric.Ellipsoid model)
With provided ellipsoid
|
DistanceMetric(DistanceMetric.Ellipsoid model,
double speed)
With provided ellipsoid and student speed
|
Modifier and Type | Method and Description |
---|---|
void |
addTravelTime(Long roomId1,
Long roomId2,
Integer travelTimeInMinutes)
Add travel time between two locations
|
protected double |
deg2rad(double deg)
Degrees to radians
|
boolean |
doComputeDistanceConflictsBetweenNonBTBClasses()
True if distances should be considered between classes that are NOT back-to-back.
|
double |
getDistanceInMeters(Double lat1,
Double lon1,
Double lat2,
Double lon2)
Deprecated.
Use @{link
getDistanceInMeters(Long, Double, Double, Long, Double, Double) instead (to include travel time matrix when available). |
double |
getDistanceInMeters(Long roomId1,
Double lat1,
Double lon1,
Long roomId2,
Double lat2,
Double lon2)
Return travel distance between two locations.
|
int |
getDistanceInMinutes(double lat1,
double lon1,
double lat2,
double lon2)
Deprecated.
Use @{link
getDistanceInMinutes(Long, Double, Double, Long, Double, Double) instead (to include travel time matrix when available). |
Integer |
getDistanceInMinutes(Long roomId1,
Double lat1,
Double lon1,
Long roomId2,
Double lat2,
Double lon2)
Return travel time between two locations.
|
double |
getInstructorDiscouragedLimit()
Back-to-back classes in rooms within this limit have discouraged preference
|
double |
getInstructorLongTravelInMinutes()
When Distances.ComputeDistanceConflictsBetweenNonBTBClasses is enabled, distance limit (in minutes)
for a long travel.
|
double |
getInstructorNoPreferenceLimit()
Back-to-back classes in rooms within this limit have neutral preference
|
double |
getInstructorProhibitedLimit()
Back-to-back classes in rooms within this limit have strongly discouraged preference, it is prohibited to exceed this limit.
|
int |
getMaxTravelDistanceInMinutes()
Maximal travel distance between rooms when no coordinates are given
|
String |
getShortDistanceAccommodationReference()
Reference of the accommodation of students that need short distances
|
Integer |
getTravelTimeInMinutes(Long roomId1,
Long roomId2)
Return travel time between two locations.
|
Map<Long,Map<Long,Integer>> |
getTravelTimes()
Return travel times matrix
|
boolean |
isLegacy()
True if legacy mode is used (Euclidian distance where 1 unit is 10 meters)
|
static void |
main(String[] args)
Few tests
|
double |
minutes2meters(int min)
Converts minutes to meters.
|
public DistanceMetric()
public DistanceMetric(DistanceMetric.Ellipsoid model)
model
- ellipsoid modelpublic DistanceMetric(DistanceMetric.Ellipsoid model, double speed)
model
- ellipsoid modelspeed
- student speed in meters per minutepublic DistanceMetric(DataProperties properties)
properties
- solver configurationprotected double deg2rad(double deg)
deg
- degrees@Deprecated public double getDistanceInMeters(Double lat1, Double lon1, Double lat2, Double lon2)
getDistanceInMeters(Long, Double, Double, Long, Double, Double)
instead (to include travel time matrix when available).lat1
- first coordinate's latitudelon1
- first coordinate's longitudelat2
- second coordinate's latitudelon2
- second coordinate's longitude@Deprecated public int getDistanceInMinutes(double lat1, double lon1, double lat2, double lon2)
getDistanceInMinutes(Long, Double, Double, Long, Double, Double)
instead (to include travel time matrix when available).lat1
- first coordinate's latitudelon1
- first coordinate's longitudelat2
- second coordinate's latitudelon2
- second coordinate's longitudepublic double minutes2meters(int min)
min
- minutes to travelpublic double getInstructorNoPreferenceLimit()
public double getInstructorDiscouragedLimit()
public double getInstructorProhibitedLimit()
public double getInstructorLongTravelInMinutes()
public boolean isLegacy()
public int getMaxTravelDistanceInMinutes()
public void addTravelTime(Long roomId1, Long roomId2, Integer travelTimeInMinutes)
roomId1
- first room's idroomId2
- second room's idtravelTimeInMinutes
- travel time in minutespublic Integer getTravelTimeInMinutes(Long roomId1, Long roomId2)
roomId1
- first room's idroomId2
- second room's idpublic Integer getDistanceInMinutes(Long roomId1, Double lat1, Double lon1, Long roomId2, Double lat2, Double lon2)
roomId1
- first room's idlat1
- first room's latitudelon1
- first room's longituderoomId2
- second room's idlat2
- second room's latitudelon2
- second room's longitudepublic double getDistanceInMeters(Long roomId1, Double lat1, Double lon1, Long roomId2, Double lat2, Double lon2)
roomId1
- first room's idlat1
- first room's latitudelon1
- first room's longituderoomId2
- second room's idlat2
- second room's latitudelon2
- second room's longitudepublic Map<Long,Map<Long,Integer>> getTravelTimes()
public boolean doComputeDistanceConflictsBetweenNonBTBClasses()
public String getShortDistanceAccommodationReference()