Beispiel #1
0
 @Override
 public void begin(VehicleRoute route) {
   this.route = route;
   pickupCounter = 0;
   pickupAtBeginningCounter = 0;
   deliveryCounter = 0;
   deliverAtEndCounter = 0;
   pickedUp = Capacity.Builder.newInstance().build();
   delivered = Capacity.Builder.newInstance().build();
 }
Beispiel #2
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 #3
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()));
 }
Beispiel #4
0
 private void clearSolutionIndicators() {
   tp_distance = 0.;
   tp_time = 0.;
   waiting_time = 0.;
   service_time = 0.;
   operation_time = 0.;
   tw_violation = 0.;
   cap_violation = Capacity.Builder.newInstance().build();
   fixed_costs = 0.;
   variable_transport_costs = 0.;
   total_costs = 0.;
   hasBackhaulConstraintViolation = false;
   hasShipmentConstraintViolation = false;
   hasSkillConstraintViolation = false;
   noPickups = 0;
   noPickupsAtBeginning = 0;
   noDeliveries = 0;
   noDeliveriesAtEnd = 0;
   pickupLoad = Capacity.Builder.newInstance().build();
   pickupLoadAtBeginning = Capacity.Builder.newInstance().build();
   deliveryLoad = Capacity.Builder.newInstance().build();
   deliveryLoadAtEnd = Capacity.Builder.newInstance().build();
 }