mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
added further unit tests
This commit is contained in:
parent
3e2f4a41a7
commit
aa1b7214ae
3 changed files with 855 additions and 23 deletions
|
|
@ -48,7 +48,7 @@ public class PickupAndDeliverShipmentLoadActivityLevelConstraint implements Hard
|
|||
* that is MUST be visited. It also assumes that pd-activities are visited in the order they occur in a tour.
|
||||
*
|
||||
*
|
||||
* @param stateManager
|
||||
* @param stateManager the stateManager
|
||||
*/
|
||||
public PickupAndDeliverShipmentLoadActivityLevelConstraint(RouteAndActivityStateGetter stateManager) {
|
||||
super();
|
||||
|
|
@ -65,7 +65,6 @@ public class PickupAndDeliverShipmentLoadActivityLevelConstraint implements Hard
|
|||
return ConstraintsStatus.FULFILLED;
|
||||
}
|
||||
Capacity loadAtPrevAct;
|
||||
// int loadAtPrevAct;
|
||||
if(prevAct instanceof Start){
|
||||
loadAtPrevAct = stateManager.getRouteState(iFacts.getRoute(), StateFactory.LOAD_AT_BEGINNING, Capacity.class);
|
||||
}
|
||||
|
|
@ -76,17 +75,11 @@ public class PickupAndDeliverShipmentLoadActivityLevelConstraint implements Hard
|
|||
if(!Capacity.addup(loadAtPrevAct, newAct.getSize()).isLessOrEqual(iFacts.getNewVehicle().getType().getCapacityDimensions())){
|
||||
return ConstraintsStatus.NOT_FULFILLED;
|
||||
}
|
||||
// if(loadAtPrevAct + newAct.getCapacityDemand() > iFacts.getNewVehicle().getCapacity()){
|
||||
// return ConstraintsStatus.NOT_FULFILLED;
|
||||
// }
|
||||
}
|
||||
if(newAct instanceof DeliverShipment){
|
||||
if(!Capacity.addup(loadAtPrevAct, Capacity.invert(newAct.getSize())).isLessOrEqual(iFacts.getNewVehicle().getType().getCapacityDimensions())){
|
||||
return ConstraintsStatus.NOT_FULFILLED_BREAK;
|
||||
}
|
||||
// if(loadAtPrevAct + Math.abs(newAct.getCapacityDemand()) > iFacts.getNewVehicle().getCapacity()){
|
||||
// return ConstraintsStatus.NOT_FULFILLED_BREAK;
|
||||
// }
|
||||
}
|
||||
return ConstraintsStatus.FULFILLED;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue