Ejemplo n.º 1
0
 private void recalculateSolutionIndicators() {
   for (VehicleRoute route : solution.getRoutes()) {
     tp_distance += getDistance(route);
     tp_time += getTransportTime(route);
     waiting_time += getWaitingTime(route);
     service_time += getServiceTime(route);
     operation_time += getOperationTime(route);
     tw_violation += getTimeWindowViolation(route);
     cap_violation = Capacity.addup(cap_violation, getCapacityViolation(route));
     fixed_costs += getFixedCosts(route);
     variable_transport_costs += getVariableTransportCosts(route);
     if (hasSkillConstraintViolation(route)) hasSkillConstraintViolation = true;
     if (hasShipmentConstraintViolation(route)) hasShipmentConstraintViolation = true;
     if (hasBackhaulConstraintViolation(route)) hasBackhaulConstraintViolation = true;
     noPickups += getNumberOfPickups(route);
     noPickupsAtBeginning += getNumberOfPickupsAtBeginning(route);
     noDeliveries += getNumberOfDeliveries(route);
     noDeliveriesAtEnd += getNumberOfDeliveriesAtEnd(route);
     pickupLoad = Capacity.addup(pickupLoad, getLoadPickedUp(route));
     pickupLoadAtBeginning = Capacity.addup(pickupLoadAtBeginning, getLoadAtBeginning(route));
     deliveryLoad = Capacity.addup(deliveryLoad, getLoadDelivered(route));
     deliveryLoadAtEnd = Capacity.addup(deliveryLoadAtEnd, getLoadAtEnd(route));
   }
   total_costs = solutionCostCalculator.getCosts(this.solution);
 }
Ejemplo n.º 2
0
 @Override
 public void visit(TourActivity activity) {
   if (activity instanceof PickupActivity) {
     pickupCounter++;
     pickedUp = Capacity.addup(pickedUp, ((PickupActivity) activity).getJob().getSize());
     if (activity instanceof PickupService) {
       deliverAtEndCounter++;
     }
   } else if (activity instanceof DeliveryActivity) {
     deliveryCounter++;
     delivered = Capacity.addup(delivered, ((DeliveryActivity) activity).getJob().getSize());
     if (activity instanceof DeliverService) {
       pickupAtBeginningCounter++;
     }
   }
 }