mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
fix bug #297
This commit is contained in:
parent
ab0acfb1d6
commit
3699fd5f99
1 changed files with 3 additions and 1 deletions
|
|
@ -71,7 +71,8 @@ public class MaxDistanceConstraint implements HardActivityConstraint{
|
|||
public ConstraintsStatus fulfilled(JobInsertionContext iFacts, TourActivity prevAct, TourActivity newAct, TourActivity nextAct, double prevActDepTime) {
|
||||
if(!hasMaxDistance(iFacts.getNewVehicle())) return ConstraintsStatus.FULFILLED;
|
||||
Double currentDistance = 0d;
|
||||
if(!iFacts.getRoute().isEmpty()){
|
||||
boolean routeIsEmpty = iFacts.getRoute().isEmpty();
|
||||
if(!routeIsEmpty){
|
||||
currentDistance = stateManager.getRouteState(iFacts.getRoute(),iFacts.getNewVehicle(), distanceId,Double.class);
|
||||
}
|
||||
double maxDistance = getMaxDistance(iFacts.getNewVehicle());
|
||||
|
|
@ -80,6 +81,7 @@ public class MaxDistanceConstraint implements HardActivityConstraint{
|
|||
double distancePrevAct2NewAct = distanceCalculator.getDistance(prevAct.getLocation(), newAct.getLocation(), iFacts.getNewDepTime(), iFacts.getNewVehicle());
|
||||
double distanceNewAct2nextAct = distanceCalculator.getDistance(newAct.getLocation(), nextAct.getLocation(), iFacts.getNewDepTime(), iFacts.getNewVehicle());
|
||||
double distancePrevAct2NextAct = distanceCalculator.getDistance(prevAct.getLocation(), nextAct.getLocation(), prevActDepTime, iFacts.getNewVehicle());
|
||||
if(routeIsEmpty) distancePrevAct2NextAct = 0;
|
||||
if(nextAct instanceof End && !iFacts.getNewVehicle().isReturnToDepot()){
|
||||
distanceNewAct2nextAct = 0;
|
||||
distancePrevAct2NextAct = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue