1
0
Fork 0
mirror of https://github.com/graphhopper/jsprit.git synced 2020-01-24 07:45:05 +01:00

added internal doc

This commit is contained in:
oblonski 2014-06-02 12:18:25 +02:00
parent b125c22619
commit 8ec2e7459a

View file

@ -28,25 +28,53 @@ import jsprit.core.util.CalculationUtils;
@Override
public ConstraintsStatus fulfilled(JobInsertionContext iFacts, TourActivity prevAct, TourActivity newAct, TourActivity nextAct, double prevActDepTime) {
double latestVehicleArrival = iFacts.getNewVehicle().getLatestArrival();
/*
* if latest arrival of vehicle (at its end) is smaller than earliest operation start times of activities,
* then vehicle can never conduct activities.
*
* |--- vehicle's operation time ---|
* |--- prevAct or newAct or nextAct ---|
*/
if(latestVehicleArrival < prevAct.getTheoreticalEarliestOperationStartTime() ||
latestVehicleArrival < newAct.getTheoreticalEarliestOperationStartTime() ||
latestVehicleArrival < nextAct.getTheoreticalEarliestOperationStartTime()){
return ConstraintsStatus.NOT_FULFILLED_BREAK;
}
/*
* if the latest operation start-time of new activity is smaller than the earliest start of prev. activity,
* then
*
* |--- prevAct ---|
* |--- newAct ---|
*/
if(newAct.getTheoreticalLatestOperationStartTime() < prevAct.getTheoreticalEarliestOperationStartTime()){
return ConstraintsStatus.NOT_FULFILLED_BREAK;
}
/*
* |--- prevAct ---|
* |- earliest arrival of vehicle
* |--- nextAct ---|
*/
double arrTimeAtNextOnDirectRouteWithNewVehicle = prevActDepTime + routingCosts.getTransportTime(prevAct.getLocationId(), nextAct.getLocationId(), prevActDepTime, iFacts.getNewDriver(), iFacts.getNewVehicle());
if(arrTimeAtNextOnDirectRouteWithNewVehicle > nextAct.getTheoreticalLatestOperationStartTime()){
return ConstraintsStatus.NOT_FULFILLED_BREAK;
}
/*
* |--- newAct ---|
* |--- nextAct ---|
*/
if(newAct.getTheoreticalEarliestOperationStartTime() > nextAct.getTheoreticalLatestOperationStartTime()){
return ConstraintsStatus.NOT_FULFILLED;
}
// log.info("check insertion of " + newAct + " between " + prevAct + " and " + nextAct + ". prevActDepTime=" + prevActDepTime);
double arrTimeAtNewAct = prevActDepTime + routingCosts.getTransportTime(prevAct.getLocationId(), newAct.getLocationId(), prevActDepTime, iFacts.getNewDriver(), iFacts.getNewVehicle());
double latestArrTimeAtNewAct = states.getActivityState(newAct, StateFactory.LATEST_OPERATION_START_TIME, Double.class);
/*
* |--- prevAct ---|
* |--- vehicle's arrival @newAct
* latest arrival of vehicle @newAct ---|
*/
if(arrTimeAtNewAct > latestArrTimeAtNewAct){
return ConstraintsStatus.NOT_FULFILLED;
}
@ -54,9 +82,15 @@ import jsprit.core.util.CalculationUtils;
double endTimeAtNewAct = CalculationUtils.getActivityEndTime(arrTimeAtNewAct, newAct);
double arrTimeAtNextAct = endTimeAtNewAct + routingCosts.getTransportTime(newAct.getLocationId(), nextAct.getLocationId(), endTimeAtNewAct, iFacts.getNewDriver(), iFacts.getNewVehicle());
double latestArrTimeAtNextAct = states.getActivityState(nextAct, StateFactory.LATEST_OPERATION_START_TIME, Double.class);
/*
* |--- newAct ---|
* |--- vehicle's arrival @nextAct
* latest arrival of vehicle @nextAct ---|
*/
if(arrTimeAtNextAct > latestArrTimeAtNextAct){
return ConstraintsStatus.NOT_FULFILLED;
}
// if vehicle cannot even manage direct-route - break
if(arrTimeAtNextOnDirectRouteWithNewVehicle > latestArrTimeAtNextAct){
return ConstraintsStatus.NOT_FULFILLED_BREAK;