|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.cpsolver.ifs.util.DistanceMetric
public class DistanceMetric
Common class for computing distances and back-to-back instructor / student conflicts.
When property Distances.Ellipsoid is set, the distances are computed using the given (e.g., WGS84, see DistanceMetric.Ellipsoid
).
In the legacy mode (when ellipsoid is not set), distances are computed using Euclidian distance and 1 unit is considered 10 meters.
For student back-to-back conflicts, Distances.Speed (in meters per minute) is considered and compared with the break time
of the earlier class.
For instructors, the preference is computed using the distance in meters and the three constants
Instructor.NoPreferenceLimit (distance <= limit -> no preference), Instructor.DiscouragedLimit (distance <= limit -> discouraged),
Instructor.ProhibitedLimit (distance <= limit -> strongly discouraged), the back-to-back placement is prohibited when the distance is over the last limit.
Nested Class Summary | |
---|---|
static class |
DistanceMetric.Ellipsoid
|
Constructor Summary | |
---|---|
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 |
Method Summary | |
---|---|
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 |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DistanceMetric()
public DistanceMetric(DistanceMetric.Ellipsoid model)
public DistanceMetric(DistanceMetric.Ellipsoid model, double speed)
public DistanceMetric(DataProperties properties)
Method Detail |
---|
protected double deg2rad(double deg)
@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).
@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).
public double minutes2meters(int min)
public 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)
public Integer getTravelTimeInMinutes(Long roomId1, Long roomId2)
public Integer getDistanceInMinutes(Long roomId1, Double lat1, Double lon1, Long roomId2, Double lat2, Double lon2)
public double getDistanceInMeters(Long roomId1, Double lat1, Double lon1, Long roomId2, Double lat2, Double lon2)
public Map<Long,Map<Long,Integer>> getTravelTimes()
public boolean doComputeDistanceConflictsBetweenNonBTBClasses()
public static void main(String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |