@Override public int compare(Visit a, Visit b) { return new CompareToBuilder() // TODO experiment with (aLatitude - bLatitude) % 10 .append(a.getLocation().getLatitude(), b.getLocation().getLatitude()) .append(a.getLocation().getLongitude(), b.getLocation().getLongitude()) .append(a.getId(), b.getId()) .toComparison(); }
@Override public double getNearbyDistance(Visit origin, Standstill destination) { long distance = origin.getDistanceTo(destination); // If arriving early also inflicts a cost (more than just not using the vehicle more), such as // the driver's wage, use this: // if (origin instanceof TimeWindowedCustomer && destination instanceof // TimeWindowedCustomer) { // distance += ((TimeWindowedCustomer) // origin).getTimeWindowGapTo((TimeWindowedCustomer) destination); // } return distance; }