Beispiel #1
0
 /**
  * @param route to get the capacity violation from (at end of the route)
  * @return violation, i.e. all dimensions and their corresponding violation. For example, if
  *     vehicle has two capacity dimension with dimIndex=0 and dimIndex=1 and dimIndex=1 is
  *     violated by 4 units then this method returns
  *     [[dimIndex=0][dimValue=0][dimIndex=1][dimValue=4]]
  */
 public Capacity getCapacityViolationAtEnd(VehicleRoute route) {
   if (route == null) throw new IllegalArgumentException("route is missing.");
   Capacity atEnd = getLoadAtEnd(route);
   return Capacity.max(
       Capacity.Builder.newInstance().build(),
       Capacity.subtract(atEnd, route.getVehicle().getType().getCapacityDimensions()));
 }
Beispiel #2
0
 /**
  * @param route to get the capacity violation from (at activity of the route)
  * @return violation, i.e. all dimensions and their corresponding violation. For example, if
  *     vehicle has two capacity dimension with dimIndex=0 and dimIndex=1 and dimIndex=1 is
  *     violated by 4 units then this method returns
  *     [[dimIndex=0][dimValue=0][dimIndex=1][dimValue=4]]
  */
 public Capacity getCapacityViolationAfterActivity(TourActivity activity, VehicleRoute route) {
   if (route == null) throw new IllegalArgumentException("route is missing.");
   if (activity == null) throw new IllegalArgumentException("activity is missing.");
   Capacity afterAct = getLoadRightAfterActivity(activity, route);
   return Capacity.max(
       Capacity.Builder.newInstance().build(),
       Capacity.subtract(afterAct, route.getVehicle().getType().getCapacityDimensions()));
 }