Package jsprit.core.problem.vehicle

Examples of jsprit.core.problem.vehicle.Vehicle


public class CalcWithTimeSchedulingTest {
 
 
  public void timeScheduler(){
    VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
    Vehicle vehicle = VehicleImpl.Builder.newInstance("myVehicle").setEarliestStart(0.0).setLatestArrival(100.0).
        setStartLocationCoordinate(Coordinate.newInstance(0, 0)).setStartLocationId("0,0")
        .setType(VehicleTypeImpl.Builder.newInstance("myType").addCapacityDimension(0, 20).setCostPerDistance(1.0).build()).build();
    vrpBuilder.addVehicle(vehicle);
    vrpBuilder.addJob(Service.Builder.newInstance("myService").addSizeDimension(0, 2).setLocationId("0,20").setCoord(Coordinate.newInstance(0, 20)).build());
    vrpBuilder.setFleetSize(FleetSize.INFINITE);
View Full Code Here


   
    VehicleImpl.Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
    vehicleBuilder.setStartLocationId("1");
    vehicleBuilder.setType(bigType);
    vehicleBuilder.setLatestArrival(220);
    Vehicle bigVehicle = vehicleBuilder.build();
   
    /*
     * start building the problem
     */
    VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
View Full Code Here

  }
 
  @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.);
    VehicleRoutingTransportCostsMatrix matrix = matrixBuilder.build();
//    assertEquals(2.,matrix.getTransportTime("from", "to", 0.0, null, null),0.1);
View Full Code Here

  public void whenAddingTimeAndDistanceToSymmetricMatrix_itShouldReturnCorrectValues(){
    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

 
  @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

  public void whenAddingTimeAndDistanceToAsymmetricMatrix_itShouldReturnCorrectValues(){
    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

    matrixBuilder.addTransportTime("from", "to", 2.);
    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

 
 
  @Test
  public void whenAddingTimeAndDistanceToAsymmetricMatrixUsingStringAsKey_itShouldReturnCorrectCostValues(){
    VehicleType type = VehicleTypeImpl.Builder.newInstance("t").setCostPerDistance(2.).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.addTransportDistance("from", "to", 3.);
    matrixBuilder.addTransportTime("to", "from", 4.);
    matrixBuilder.addTransportDistance("to", "from", 5.);
View Full Code Here

    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();
        serviceProblemBuilder.addJob(s1).addJob(s2);
View Full Code Here

   
    matrixBuilder.addTransportDistance("to", "from", 1.);
    matrixBuilder.addTransportTime("to", "from", 2.);
   
    VehicleRoutingTransportCostsMatrix matrix = matrixBuilder.build();
    Vehicle vehicle = mock(Vehicle.class);
    VehicleType type = VehicleTypeImpl.Builder.newInstance("t").setCostPerDistance(1.).setCostPerTime(0.).build();
    when(vehicle.getType()).thenReturn(type);
    assertEquals(1.,matrix.getDistance("from", "to"),0.1);
    assertEquals(1.,matrix.getDistance("to", "from"),0.1);
    assertEquals(1.,matrix.getTransportCost("from", "to", 0.0, null, vehicle),0.1);
    assertEquals(1.,matrix.getTransportCost("to", "from", 0.0, null, vehicle),0.1);
  }
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.