Examples of VehicleType


Examples of jsprit.core.problem.vehicle.VehicleType

public class OpenRoutesTest {
 
  @Test
  public void whenDealingWithOpenRouteAndShipments_insertionShouldNotRequireRouteToBeClosed(){
    VehicleType type = VehicleTypeImpl.Builder.newInstance("type").build();
   
    Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setLatestArrival(11.)
        .setType(type).setReturnToDepot(false).setStartLocationCoordinate(Coordinate.newInstance(0, 0)).build();
   
    Shipment shipment = Shipment.Builder.newInstance("s").setPickupCoord(Coordinate.newInstance(5, 0))
View Full Code Here

Examples of jsprit.core.problem.vehicle.VehicleType

   
  }
 
  @Test
  public void whenDealingWithOpenRoute_insertionShouldNotRequireRouteToBeClosed(){
    VehicleType type = VehicleTypeImpl.Builder.newInstance("type").build();
    Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setLatestArrival(9.)
        .setType(type).setReturnToDepot(false).setStartLocationCoordinate(Coordinate.newInstance(0, 0)).build();
   
    Service service = Service.Builder.newInstance("s").setCoord(Coordinate.newInstance(5, 0)).build();
   
View Full Code Here

Examples of jsprit.core.problem.vehicle.VehicleType

 
 
 
  @Test
  public void whenDealingWithOpenRouteAndShipments_algorithmShouldCalculateCorrectCosts(){
    VehicleType type = VehicleTypeImpl.Builder.newInstance("type").build();
    Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setLatestArrival(20.)
        .setType(type).setReturnToDepot(false).setStartLocationCoordinate(Coordinate.newInstance(0, 0)).build();
   
    Shipment shipment = Shipment.Builder.newInstance("s").setPickupCoord(Coordinate.newInstance(5, 0))
        .setDeliveryCoord(Coordinate.newInstance(10, 0)).build();
View Full Code Here

Examples of jsprit.core.problem.vehicle.VehicleType

   
  }
 
  @Test
  public void whenDealingWithOpenRoute_algorithmShouldCalculateCorrectCosts(){
    VehicleType type = VehicleTypeImpl.Builder.newInstance("type").build();
    Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setLatestArrival(10.)
        .setType(type).setReturnToDepot(false).setStartLocationCoordinate(Coordinate.newInstance(0, 0)).build();
   
    Service service = Service.Builder.newInstance("s").setCoord(Coordinate.newInstance(5, 0)).build();
   
View Full Code Here

Examples of jsprit.core.problem.vehicle.VehicleType

    private StateManager stateManager;

    @Before
    public void doBefore(){
        Vehicle vehicle = mock(Vehicle.class);
        VehicleType type = mock(VehicleType.class);
        when(type.getCapacityDimensions()).thenReturn(Capacity.Builder.newInstance().addDimension(0,20).build());
        when(vehicle.getType()).thenReturn(type);

        VehicleRoutingProblem.Builder serviceProblemBuilder = VehicleRoutingProblem.Builder.newInstance();
        Service s1 = Service.Builder.newInstance("s").addSizeDimension(0,10).setLocationId("loc").build();
        Service s2 = Service.Builder.newInstance("s2").addSizeDimension(0,5).setLocationId("loc").build();
View Full Code Here

Examples of jsprit.core.problem.vehicle.VehicleType

    assertEquals(4.,matrix.getTransportTime("to", "from", 0.0, null, null),0.1);
  }
 
  @Test
  public void whenAddingTimeToAsymmetricMatrixUsingStringAsKey_itShouldReturnCorrectCostValues(){
    VehicleType type = VehicleTypeImpl.Builder.newInstance("t").setCostPerDistance(0.).setCostPerTime(1.).build();
    Vehicle vehicle = mock(Vehicle.class);
    when(vehicle.getType()).thenReturn(type);
    VehicleRoutingTransportCostsMatrix.Builder matrixBuilder = VehicleRoutingTransportCostsMatrix.Builder.newInstance(false);
    matrixBuilder.addTransportTime("from", "to", 2.);
    matrixBuilder.addTransportTime("to", "from", 4.);
View Full Code Here

Examples of jsprit.core.problem.vehicle.VehicleType

    VehicleRoutingTransportCostsMatrix.Builder matrixBuilder = VehicleRoutingTransportCostsMatrix.Builder.newInstance(true);
    matrixBuilder.addTransportDistance("1", "2", 20.);
    matrixBuilder.addTransportTime("1", "2", 2.);
    VehicleRoutingTransportCostsMatrix matrix = matrixBuilder.build();
    Vehicle vehicle = mock(Vehicle.class);
    VehicleType type = VehicleTypeImpl.Builder.newInstance("t").setCostPerDistance(1.).setCostPerTime(2.).build();
    when(vehicle.getType()).thenReturn(type);
    assertEquals(24.,matrix.getTransportCost("1", "2", 0.0, null, vehicle),0.1);
    assertEquals(24.,matrix.getTransportCost("2", "1", 0.0, null, vehicle),0.1);
  }
View Full Code Here

Examples of jsprit.core.problem.vehicle.VehicleType

  @Test
  public void whenAddingTimeAndDistanceToSymmetricMatrixUsingStringAsKey_itShouldReturnCorrectValues(){
    VehicleRoutingTransportCostsMatrix.Builder matrixBuilder = VehicleRoutingTransportCostsMatrix.Builder.newInstance(true);
    matrixBuilder.addTransportTime("from", "to", 2.);
    Vehicle vehicle = mock(Vehicle.class);
    VehicleType type = VehicleTypeImpl.Builder.newInstance("t").setCostPerDistance(1.).setCostPerTime(2.).build();
    when(vehicle.getType()).thenReturn(type);
    VehicleRoutingTransportCostsMatrix matrix = matrixBuilder.build();
    assertEquals(4.,matrix.getTransportCost("from", "to", 0.0, null, vehicle),0.1);
    assertEquals(4.,matrix.getTransportCost("to", "from", 0.0, null, vehicle),0.1);
  }
View Full Code Here

Examples of jsprit.core.problem.vehicle.VehicleType

    VehicleRoutingTransportCostsMatrix.Builder matrixBuilder = VehicleRoutingTransportCostsMatrix.Builder.newInstance(false);
    matrixBuilder.addTransportTime("1", "2", 2.);
    matrixBuilder.addTransportTime("2", "1", 8.);
    VehicleRoutingTransportCostsMatrix matrix = matrixBuilder.build();
    Vehicle vehicle = mock(Vehicle.class);
    VehicleType type = VehicleTypeImpl.Builder.newInstance("t").setCostPerDistance(1.).setCostPerTime(2.).build();
    when(vehicle.getType()).thenReturn(type);
    assertEquals(4.,matrix.getTransportCost("1", "2", 0.0, null, vehicle),0.1);
    assertEquals(16.,matrix.getTransportCost("2", "1", 0.0, null, vehicle),0.1);
  }
View Full Code Here

Examples of jsprit.core.problem.vehicle.VehicleType

    matrixBuilder.addTransportDistance("from", "to", 1.);
    matrixBuilder.addTransportTime("to", "from", 4.);
    matrixBuilder.addTransportDistance("to", "from", 3.);
    VehicleRoutingTransportCostsMatrix matrix = matrixBuilder.build();
    Vehicle vehicle = mock(Vehicle.class);
    VehicleType type = VehicleTypeImpl.Builder.newInstance("t").setCostPerDistance(1.).setCostPerTime(2.).build();
    when(vehicle.getType()).thenReturn(type);
    assertEquals(5.,matrix.getTransportCost("from", "to", 0.0, null, vehicle),0.1);
    assertEquals(11.,matrix.getTransportCost("to", "from", 0.0, null, vehicle),0.1);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.