Package jsprit.core.problem.vehicle

Examples of jsprit.core.problem.vehicle.Vehicle


    assertEquals(1000.0,vRoute.getDepartureTime(),0.01);
  }
 
  @Test
  public void whenIniRouteWithNewVehicle_depTimeMustBeSetDepTime(){
    Vehicle vehicle = VehicleImpl.Builder.newInstance("v").setEarliestStart(100).setLatestArrival(200).setStartLocationId("start").setEndLocationId("end").build();
    Vehicle new_vehicle = VehicleImpl.Builder.newInstance("new_v").setEarliestStart(1000).setLatestArrival(2000).setStartLocationId("new_start").setEndLocationId("new_end").build();
    VehicleRoute vRoute = VehicleRoute.Builder.newInstance(vehicle, DriverImpl.noDriver()).build();
    vRoute.setVehicleAndDepartureTime(new_vehicle, 1500.0);
    assertEquals(1500.0,vRoute.getDepartureTime(),0.01);
  }
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

      @Override
      public double getTransportCost(String fromId, String toId,double departureTime, Driver driver, Vehicle vehicle) {
        return EuclideanDistanceCalculator.calculateDistance(coords.get(fromId), coords.get(toId));
      }
    };
    Vehicle oldVehicle = VehicleImpl.Builder.newInstance("oldV").setStartLocationId("oldV").build();
   
    VehicleRoute route = VehicleRoute.Builder.newInstance(oldVehicle, DriverImpl.noDriver())
        .addService(Service.Builder.newInstance("service").addSizeDimension(0, 0).setLocationId("service").build())
        .build();
   
    Vehicle newVehicle = VehicleImpl.Builder.newInstance("newV").setStartLocationId("newV").build();
   
    AdditionalAccessEgressCalculator accessEgressCalc = new AdditionalAccessEgressCalculator(routingCosts);
    Job job = Service.Builder.newInstance("service2").addSizeDimension(0, 0).setLocationId("service").build();
    JobInsertionContext iContex = new JobInsertionContext(route, job, newVehicle, mock(Driver.class), 0.0);
    assertEquals(8.0, accessEgressCalc.getCosts(iContex),0.01);
View Full Code Here

    when(iContext.getJob()).thenReturn(service);
    when(iContext.getRoute()).thenReturn(route);
   
    VehicleType type = mock(VehicleType.class);
    when(type.getCapacityDimensions()).thenReturn(Capacity.Builder.newInstance().addDimension(0, 2).addDimension(1, 1).addDimension(2, 2).build());
    Vehicle vehicle = mock(Vehicle.class);
    when(vehicle.getType()).thenReturn(type);
   
    when(iContext.getNewVehicle()).thenReturn(vehicle);
   
    ServiceLoadRouteLevelConstraint constraint = new ServiceLoadRouteLevelConstraint(stateGetter);
    assertFalse(constraint.fulfilled(iContext));
View Full Code Here

  @Test
  public void whenReadingVrp_vehiclesAreReadCorrectly2(){
    VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
    new VrpXMLReader(builder, null).read(inFileName);
    VehicleRoutingProblem vrp = builder.build();
    Vehicle v1 = getVehicle("v1",vrp.getVehicles());
    assertEquals(20,v1.getType().getCapacityDimensions().get(0));
    assertEquals(100.0,v1.getStartLocationCoordinate().getX(),0.01);
    assertEquals(0.0,v1.getEarliestDeparture(),0.01);
    assertEquals("depotLoc2",v1.getStartLocationId());
    assertNotNull(v1.getType());
    assertEquals("vehType", v1.getType().getTypeId());
    assertEquals(1000.0,v1.getLatestArrival(),0.01);
  }
View Full Code Here

    @Test
    public void whenReadingVehicles_skill1ShouldBeAssigned(){
        VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
        new VrpXMLReader(builder, null).read(inFileName);
        VehicleRoutingProblem vrp = builder.build();
        Vehicle v1 = getVehicle("v1",vrp.getVehicles());
        assertTrue(v1.getSkills().containsSkill("skill1"));
    }
View Full Code Here

    @Test
    public void whenReadingVehicles_skill2ShouldBeAssigned(){
        VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
        new VrpXMLReader(builder, null).read(inFileName);
        VehicleRoutingProblem vrp = builder.build();
        Vehicle v1 = getVehicle("v1",vrp.getVehicles());
        assertTrue(v1.getSkills().containsSkill("skill2"));
    }
View Full Code Here

    @Test
    public void whenReadingVehicles_nuSkillsShouldBeCorrect(){
        VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
        new VrpXMLReader(builder, null).read(inFileName);
        VehicleRoutingProblem vrp = builder.build();
        Vehicle v1 = getVehicle("v1",vrp.getVehicles());
        assertEquals(2, v1.getSkills().values().size());
    }
View Full Code Here

    @Test
    public void whenReadingVehicles_nuSkillsOfV2ShouldBeCorrect(){
        VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
        new VrpXMLReader(builder, null).read(inFileName);
        VehicleRoutingProblem vrp = builder.build();
        Vehicle v = getVehicle("v2",vrp.getVehicles());
        assertEquals(0, v.getSkills().values().size());
    }
View Full Code Here

  @Test
  public void whenReadingFile_v2MustNotReturnToDepot(){
    VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
    new VrpXMLReader(builder, null).read(inFileName);
    VehicleRoutingProblem vrp = builder.build();
    Vehicle v = getVehicle("v2",vrp.getVehicles());
    assertFalse(v.isReturnToDepot());
  }
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.