mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
fixed bug #95
This commit is contained in:
parent
7620988273
commit
312ebc8313
1 changed files with 12 additions and 3 deletions
|
|
@ -9,7 +9,7 @@ import jsprit.core.util.CalculationUtils;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ljsljslfjs
|
*
|
||||||
* @author stefan
|
* @author stefan
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
@ -27,9 +27,19 @@ import jsprit.core.util.CalculationUtils;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ConstraintsStatus fulfilled(JobInsertionContext iFacts, TourActivity prevAct, TourActivity newAct, TourActivity nextAct, double prevActDepTime) {
|
public ConstraintsStatus fulfilled(JobInsertionContext iFacts, TourActivity prevAct, TourActivity newAct, TourActivity nextAct, double prevActDepTime) {
|
||||||
|
double latestVehicleArrival = iFacts.getNewVehicle().getLatestArrival();
|
||||||
|
if(latestVehicleArrival < prevAct.getTheoreticalEarliestOperationStartTime() ||
|
||||||
|
latestVehicleArrival < newAct.getTheoreticalEarliestOperationStartTime() ||
|
||||||
|
latestVehicleArrival < nextAct.getTheoreticalEarliestOperationStartTime()){
|
||||||
|
return ConstraintsStatus.NOT_FULFILLED_BREAK;
|
||||||
|
}
|
||||||
if(newAct.getTheoreticalLatestOperationStartTime() < prevAct.getTheoreticalEarliestOperationStartTime()){
|
if(newAct.getTheoreticalLatestOperationStartTime() < prevAct.getTheoreticalEarliestOperationStartTime()){
|
||||||
return ConstraintsStatus.NOT_FULFILLED_BREAK;
|
return ConstraintsStatus.NOT_FULFILLED_BREAK;
|
||||||
}
|
}
|
||||||
|
double arrTimeAtNextOnDirectRouteWithNewVehicle = prevActDepTime + routingCosts.getTransportTime(prevAct.getLocationId(), nextAct.getLocationId(), prevActDepTime, iFacts.getNewDriver(), iFacts.getNewVehicle());
|
||||||
|
if(arrTimeAtNextOnDirectRouteWithNewVehicle > nextAct.getTheoreticalLatestOperationStartTime()){
|
||||||
|
return ConstraintsStatus.NOT_FULFILLED_BREAK;
|
||||||
|
}
|
||||||
if(newAct.getTheoreticalEarliestOperationStartTime() > nextAct.getTheoreticalLatestOperationStartTime()){
|
if(newAct.getTheoreticalEarliestOperationStartTime() > nextAct.getTheoreticalLatestOperationStartTime()){
|
||||||
return ConstraintsStatus.NOT_FULFILLED;
|
return ConstraintsStatus.NOT_FULFILLED;
|
||||||
}
|
}
|
||||||
|
|
@ -47,8 +57,7 @@ import jsprit.core.util.CalculationUtils;
|
||||||
if(arrTimeAtNextAct > latestArrTimeAtNextAct){
|
if(arrTimeAtNextAct > latestArrTimeAtNextAct){
|
||||||
return ConstraintsStatus.NOT_FULFILLED;
|
return ConstraintsStatus.NOT_FULFILLED;
|
||||||
}
|
}
|
||||||
double arrTimeAtNextOnDirectRouteWithNewVehicle = prevActDepTime + routingCosts.getTransportTime(prevAct.getLocationId(), nextAct.getLocationId(), prevActDepTime, iFacts.getNewDriver(), iFacts.getNewVehicle());
|
// if vehicle cannot even manage direct-route - break
|
||||||
//if vehicle cannot even manage direct-route - break
|
|
||||||
if(arrTimeAtNextOnDirectRouteWithNewVehicle > latestArrTimeAtNextAct){
|
if(arrTimeAtNextOnDirectRouteWithNewVehicle > latestArrTimeAtNextAct){
|
||||||
return ConstraintsStatus.NOT_FULFILLED_BREAK;
|
return ConstraintsStatus.NOT_FULFILLED_BREAK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue