Package jsprit.core.problem.vehicle

Examples of jsprit.core.problem.vehicle.Vehicle


    logger.info("set vehicleSwitchAllowed to " + vehicleSwitchAllowed);
    this.vehicleSwitchAllowed = vehicleSwitchAllowed;
  }

  public InsertionData getInsertionData(final VehicleRoute currentRoute, final Job jobToInsert, final Vehicle vehicle, double newVehicleDepartureTime, final Driver driver, final double bestKnownCost) {
    Vehicle selectedVehicle = currentRoute.getVehicle();
    Driver selectedDriver = currentRoute.getDriver();
    InsertionData bestIData = InsertionData.createEmptyInsertionData();
    double bestKnownCost_ = bestKnownCost;
    Collection<Vehicle> relevantVehicles = new ArrayList<Vehicle>();
    if(!(selectedVehicle instanceof NoVehicle)) {
View Full Code Here


    Shipment s = mock(Shipment.class);
    Shipment s2 = mock(Shipment.class);
    Capacity capacity = Capacity.Builder.newInstance().build();
    when(s.getSize()).thenReturn(capacity);
    when(s2.getSize()).thenReturn(capacity);
    Vehicle vehicle = mock(Vehicle.class);
    when(vehicle.isReturnToDepot()).thenReturn(true);
    when(vehicle.getStartLocationId()).thenReturn("vehLoc");
    when(vehicle.getEndLocationId()).thenReturn("vehLoc");
    VehicleRoute.Builder builder = VehicleRoute.Builder.newInstance(vehicle, mock(Driver.class));
    builder.addPickup(s);
    builder.addPickup(s2);
    builder.addDelivery(s);
    builder.addDelivery(s2);
View Full Code Here

    Shipment s2 = mock(Shipment.class);
    Capacity capacity = Capacity.Builder.newInstance().build();
    when(s.getSize()).thenReturn(capacity);
    when(s2.getSize()).thenReturn(capacity);
    when(s2.getDeliveryLocationId()).thenReturn("delLoc");
    Vehicle vehicle = mock(Vehicle.class);
    when(vehicle.isReturnToDepot()).thenReturn(false);
    when(vehicle.getStartLocationId()).thenReturn("vehLoc");
    VehicleRoute.Builder builder = VehicleRoute.Builder.newInstance(vehicle, mock(Driver.class));
    builder.addPickup(s);
    builder.addPickup(s2);
    builder.addDelivery(s);
    builder.addDelivery(s2);
View Full Code Here

    Shipment s2 = mock(Shipment.class);
    Capacity capacity = Capacity.Builder.newInstance().build();
    when(s.getSize()).thenReturn(capacity);
    when(s2.getSize()).thenReturn(capacity);
    when(s2.getDeliveryLocationId()).thenReturn("delLoc");
    Vehicle vehicle = mock(Vehicle.class);
    when(vehicle.isReturnToDepot()).thenReturn(false);
    when(vehicle.getStartLocationId()).thenReturn("vehLoc");
    VehicleRoute.Builder builder = VehicleRoute.Builder.newInstance(vehicle, mock(Driver.class));
    builder.addPickup(s);
    builder.addPickup(s2);
    builder.addDelivery(s);
    builder.addDelivery(s2);
View Full Code Here

    Shipment s2 = mock(Shipment.class);
    Capacity capacity = Capacity.Builder.newInstance().build();
    when(s.getSize()).thenReturn(capacity);
    when(s2.getSize()).thenReturn(capacity);
    when(s2.getDeliveryLocationId()).thenReturn("delLoc");
    Vehicle vehicle = mock(Vehicle.class);
    when(vehicle.isReturnToDepot()).thenReturn(false);
    when(vehicle.getStartLocationId()).thenReturn("vehLoc");
    when(vehicle.getLatestArrival()).thenReturn(200.0);
    VehicleRoute.Builder builder = VehicleRoute.Builder.newInstance(vehicle, mock(Driver.class));
    builder.addPickup(s);
    builder.addPickup(s2);
    builder.addDelivery(s);
    builder.addDelivery(s2);
View Full Code Here

 
  public double getCosts(JobInsertionContext insertionContext){
    double delta_access = 0.0;
    double delta_egress = 0.0;
    VehicleRoute currentRoute = insertionContext.getRoute();
    Vehicle newVehicle = insertionContext.getNewVehicle();
    Driver newDriver = insertionContext.getNewDriver();
    double newVehicleDepartureTime = insertionContext.getNewDepTime();
    if(!currentRoute.isEmpty()){
      double accessTransportCostNew = routingCosts.getTransportCost(newVehicle.getStartLocationId(), currentRoute.getActivities().get(0).getLocationId(), newVehicleDepartureTime, newDriver, newVehicle);
      double accessTransportCostOld = routingCosts.getTransportCost(currentRoute.getStart().getLocationId(), currentRoute.getActivities().get(0).getLocationId(), currentRoute.getDepartureTime(), currentRoute.getDriver(), currentRoute.getVehicle());
     
      delta_access = accessTransportCostNew - accessTransportCostOld;
     
      if(newVehicle.isReturnToDepot()){
        TourActivity lastActivityBeforeEndOfRoute = currentRoute.getActivities().get(currentRoute.getActivities().size()-1);
        double lastActivityEndTimeWithOldVehicleAndDepartureTime = lastActivityBeforeEndOfRoute.getEndTime();
        double lastActivityEndTimeEstimationWithNewVehicleAndNewDepartureTime = Math.max(0.0, lastActivityEndTimeWithOldVehicleAndDepartureTime + (newVehicleDepartureTime - currentRoute.getDepartureTime()));
        double egressTransportCostNew = routingCosts.getTransportCost(lastActivityBeforeEndOfRoute.getLocationId(), newVehicle.getEndLocationId() , lastActivityEndTimeEstimationWithNewVehicleAndNewDepartureTime, newDriver, newVehicle);
        double egressTransportCostOld = routingCosts.getTransportCost(lastActivityBeforeEndOfRoute.getLocationId(), currentRoute.getEnd().getLocationId(), lastActivityEndTimeWithOldVehicleAndDepartureTime, currentRoute.getDriver(), currentRoute.getVehicle());
       
        delta_egress = egressTransportCostNew - egressTransportCostOld;
      }
    }
View Full Code Here

    }
  }
 
  @Test
  public void whenBuildingRouteWithVehicleThatHasDifferentStartAndEndLocation_routeMustHaveCorrectStartLocation(){
    Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("start").setEndLocationId("end").build();
    VehicleRoute vRoute = VehicleRoute.Builder.newInstance(vehicle, DriverImpl.noDriver()).build();
    assertTrue(vRoute.getStart().getLocationId().equals("start"));
  }
View Full Code Here

    assertTrue(vRoute.getStart().getLocationId().equals("start"));
  }
 
  @Test
  public void whenBuildingRouteWithVehicleThatHasDifferentStartAndEndLocation_routeMustHaveCorrectEndLocation(){
    Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("start").setEndLocationId("end").build();
    VehicleRoute vRoute = VehicleRoute.Builder.newInstance(vehicle, DriverImpl.noDriver()).build();
    assertTrue(vRoute.getEnd().getLocationId().equals("end"));
  }
View Full Code Here

    assertTrue(vRoute.getEnd().getLocationId().equals("end"));
  }
 
  @Test
  public void whenBuildingRouteWithVehicleThatHasSameStartAndEndLocation_routeMustHaveCorrectStartLocation(){
    Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("start").setEndLocationId("start").build();
    VehicleRoute vRoute = VehicleRoute.Builder.newInstance(vehicle, DriverImpl.noDriver()).build();
    assertTrue(vRoute.getStart().getLocationId().equals("start"));
  }
View Full Code Here

    assertTrue(vRoute.getStart().getLocationId().equals("start"));
  }
 
  @Test
  public void whenBuildingRouteWithVehicleThatHasSameStartAndEndLocation_routeMustHaveCorrectEndLocation(){
    Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("start").setEndLocationId("start").build();
    VehicleRoute vRoute = VehicleRoute.Builder.newInstance(vehicle, DriverImpl.noDriver()).build();
    assertTrue(vRoute.getEnd().getLocationId().equals("start"));
  }
View Full Code Here

TOP

Related Classes of jsprit.core.problem.vehicle.Vehicle

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.