Package jsprit.core.problem.job

Examples of jsprit.core.problem.job.Pickup


  }

    
  @Test
  public void whenPickupsAreAdded_vrpShouldContainThem(){
    Pickup s1 = mock(Pickup.class);
    when(s1.getId()).thenReturn("s1");
    Pickup s2 = mock(Pickup.class);
    when(s2.getId()).thenReturn("s2");
   
    VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
    vrpBuilder.addJob(s1).addJob(s2);
   
    VehicleRoutingProblem vrp = vrpBuilder.build();
View Full Code Here


    assertEquals(s2,vrp.getJobs().get("s2"));
  }
 
  @Test
  public void whenPickupsAreAddedAllAtOnce_vrpShouldContainThem(){
    Pickup s1 = mock(Pickup.class);
    when(s1.getId()).thenReturn("s1");
    Pickup s2 = mock(Pickup.class);
    when(s2.getId()).thenReturn("s2");
   
    VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
    vrpBuilder.addAllJobs(Arrays.asList(s1,s2));
   
    VehicleRoutingProblem vrp = vrpBuilder.build();
View Full Code Here

        VehicleImpl vehicle = VehicleImpl.Builder.newInstance("v1").setType(type)
                .setStartLocationCoordinate(Coordinate.newInstance(-5, 0))
                .setLatestArrival(150.)
                .build();

        Pickup s1 = (Pickup) Pickup.Builder.newInstance("s1")
                .setTimeWindow(TimeWindow.newInstance(10, 20))
                .setCoord(Coordinate.newInstance(-10, 1))
                .addSizeDimension(0, 10)
                .build();
        Delivery s2 = (Delivery) Delivery.Builder.newInstance("s2")
                .setCoord(Coordinate.newInstance(-10, 10))
                .setTimeWindow(TimeWindow.newInstance(10, 20))
                .addSizeDimension(0, 20)
                .build();
        Shipment shipment1 = Shipment.Builder.newInstance("ship1").setPickupCoord(Coordinate.newInstance(-15, 2)).setDeliveryCoord(Coordinate.newInstance(-16, 5))
                .addSizeDimension(0, 15)
                .setPickupServiceTime(20.).setDeliveryServiceTime(20.)
                .setPickupTimeWindow(TimeWindow.newInstance(10,20)).setDeliveryTimeWindow(TimeWindow.newInstance(10,20))
                .build();

        Pickup s3 = (Pickup) Pickup.Builder.newInstance("s3")
                .setTimeWindow(TimeWindow.newInstance(10, 20))
                .setCoord(Coordinate.newInstance(10, 1))
                .addSizeDimension(0, 10)
                .build();
        Delivery s4 = (Delivery) Delivery.Builder.newInstance("s4").setCoord(Coordinate.newInstance(10, 10))
View Full Code Here

  }

    @Test
    public void whenAddingPickup_itShouldBeTreatedAsPickup(){

        Pickup pickup = (Pickup) Pickup.Builder.newInstance("pick").setLocationId("pickLoc").build();
        VehicleImpl vehicle = VehicleImpl.Builder.newInstance("vehicle").setStartLocationId("startLoc").build();
        VehicleRoute route = VehicleRoute.Builder.newInstance(vehicle).addService(pickup).build();

        TourActivity act = route.getActivities().get(0);
        assertTrue(act.getName().equals("pickup"));
View Full Code Here

    }

    @Test
    public void whenAddingPickup_itShouldBeAdded(){

        Pickup pickup = (Pickup) Pickup.Builder.newInstance("pick").setLocationId("pickLoc").build();
        VehicleImpl vehicle = VehicleImpl.Builder.newInstance("vehicle").setStartLocationId("startLoc").build();
        VehicleRoute route = VehicleRoute.Builder.newInstance(vehicle).addPickup(pickup).build();

        TourActivity act = route.getActivities().get(0);
        assertTrue(act.getName().equals("pickup"));
View Full Code Here

  }
 
  @Test
  public void whenInsertingServiceWhileNoCapIsAvailable_itMustReturnTheCorrectInsertionIndex(){
    Delivery delivery = (Delivery) Delivery.Builder.newInstance("del").addSizeDimension(0, 41).setLocationId("10,10").build();
    Pickup pickup = (Pickup) Pickup.Builder.newInstance("pick").addSizeDimension(0, 15).setLocationId("0,10").build();

    VehicleType type = VehicleTypeImpl.Builder.newInstance("t").addCapacityDimension(0, 50).setCostPerDistance(1).build();
    VehicleImpl vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("0,0").setType(type).build();

        final VehicleRoutingProblem vrp = VehicleRoutingProblem.Builder.newInstance().addJob(delivery).addJob(pickup).addVehicle(vehicle).build();
View Full Code Here

        Service service = Service.Builder.newInstance("s1").setLocationId("s1_loc").setCoord(Coordinate.newInstance(40, 10))
                .addSizeDimension(0, 20).addSizeDimension(1, 40)
                .setServiceTime(1.)
                .addRequiredSkill("joo-foo")
                .build();
        Pickup service2 = (Pickup) Pickup.Builder.newInstance("pickup2").setLocationId("s2_loc").setCoord(Coordinate.newInstance(40, 10))
                .addSizeDimension(0, 10).addSizeDimension(1, 30)
                .setServiceTime(2.)
                .setTimeWindow(TimeWindow.newInstance(10, 200))
                .addRequiredSkill("screw-driver").build();
        VehicleType type = VehicleTypeImpl.Builder.newInstance("small").addCapacityDimension(0,100).addCapacityDimension(1,400)
View Full Code Here

  }
 
  @Test
  public void whenCreatingActivityWithPickup_itShouldReturnPickupService(){
    DefaultTourActivityFactory factory = new DefaultTourActivityFactory();
    Pickup service = (Pickup) Pickup.Builder.newInstance("service").setLocationId("loc").build();
    TourActivity act = factory.createActivity(service);
    assertNotNull(act);
    assertTrue(act instanceof PickupService);
  }
View Full Code Here

    assertFalse(constraint.fulfilled(iContext));
  }
 
  @Test
  public void whenAddingAPickupAndNewVehicleDoesNotHaveTheCapacity_itShouldReturnFalse(){
    Pickup service = mock(Pickup.class);
    when(service.getSize()).thenReturn(Capacity.Builder.newInstance().addDimension(0, 2).build());
   
    Capacity atBeginning = Capacity.Builder.newInstance().addDimension(0, 1).addDimension(1, 2).addDimension(2, 1).build();
    Capacity atEnd = Capacity.Builder.newInstance().addDimension(0, 0).addDimension(1, 0).addDimension(2, 0).build();
   
    RouteAndActivityStateGetter stateGetter = mock(RouteAndActivityStateGetter.class);
View Full Code Here

    assertFalse(new ServiceLoadRouteLevelConstraint(stateManager).fulfilled(iContext));
  }
 
  @Test
  public void whenNewVehicleCapacityIsNotSufficiant2_returnFalse(){
    Pickup service = (Pickup) createPickup("pick",2);
        Service serviceInRoute = createPickup("pick1",3);
        VehicleType type = VehicleTypeImpl.Builder.newInstance("type").addCapacityDimension(0,3).build();
        VehicleImpl vehicle = VehicleImpl.Builder.newInstance("v").setType(type).setStartLocationId("loc").build();
        VehicleRoutingProblem vrp = VehicleRoutingProblem.Builder.newInstance().addVehicle(vehicle).addJob(service).addJob(serviceInRoute).build();
        VehicleRoute route = VehicleRoute.Builder.newInstance(vehicle).setJobActivityFactory(vrp.getJobActivityFactory()).addService(serviceInRoute).build();
View Full Code Here

TOP

Related Classes of jsprit.core.problem.job.Pickup

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.