Package jsprit.core.problem.job

Examples of jsprit.core.problem.job.Delivery


    assertEquals(s2,vrp.getJobs().get("s2"));
  }
 
  @Test
  public void whenDelivieriesAreAdded_vrpShouldContainThem(){
    Delivery s1 = mock(Delivery.class);
    when(s1.getId()).thenReturn("s1");
        when(s1.getSize()).thenReturn(Capacity.Builder.newInstance().build());
    Delivery s2 = mock(Delivery.class);
    when(s2.getId()).thenReturn("s2");
        when(s2.getSize()).thenReturn(Capacity.Builder.newInstance().build());

    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 whenDelivieriesAreAddedAllAtOnce_vrpShouldContainThem(){
    Delivery s1 = mock(Delivery.class);
    when(s1.getId()).thenReturn("s1");
        when(s1.getSize()).thenReturn(Capacity.Builder.newInstance().build());
    Delivery s2 = mock(Delivery.class);
    when(s2.getId()).thenReturn("s2");
        when(s2.getSize()).thenReturn(Capacity.Builder.newInstance().build());

    VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
    vrpBuilder.addAllJobs(Arrays.asList(s1,s2));
   
    VehicleRoutingProblem vrp = vrpBuilder.build();
View Full Code Here

        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))
                .addSizeDimension(0, 20)
                .setTimeWindow(TimeWindow.newInstance(10, 20))
                .build();
        Shipment shipment2 = Shipment.Builder.newInstance("ship2").setPickupCoord(Coordinate.newInstance(15, 2))
                .setPickupServiceTime(20.).setDeliveryServiceTime(20.)
View Full Code Here

    }

    @Test
    public void whenAddingDelivery_itShouldBeTreatedAsDelivery(){

        Delivery delivery = (Delivery) Delivery.Builder.newInstance("delivery").setLocationId("deliveryLoc").build();
        VehicleImpl vehicle = VehicleImpl.Builder.newInstance("vehicle").setStartLocationId("startLoc").build();
        VehicleRoute route = VehicleRoute.Builder.newInstance(vehicle).addService(delivery).build();

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

    }

    @Test
    public void whenAddingDelivery_itShouldBeAdded(){

        Delivery delivery = (Delivery) Delivery.Builder.newInstance("delivery").setLocationId("deliveryLoc").build();
        VehicleImpl vehicle = VehicleImpl.Builder.newInstance("vehicle").setStartLocationId("startLoc").build();
        VehicleRoute route = VehicleRoute.Builder.newInstance(vehicle).addDelivery(delivery).build();

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

    insertionCalculator = new ShipmentInsertionCalculator(routingCosts, activityInsertionCostsCalculator, constraintManager);
  }
 
  @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();
View Full Code Here

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

            }
            String[] lineTokens = line.split(",");
      /*
       * build service
       */
            Delivery service = (Delivery) Delivery.Builder.newInstance(lineTokens[0]).addSizeDimension(0, Integer.parseInt(lineTokens[1])).setLocationId(lineTokens[0]).build();
      /*
       * and add it to problem
       */
            vrpBuilder.addJob(service);
        }
View Full Code Here

     * 1: (4,8)
     * 2: (4,12)
     * 3: (16,8)
     * 4: (16,12)
     */
    Delivery delivery1 = (Delivery) Delivery.Builder.newInstance("5").addSizeDimension(0, 1).setCoord(Coordinate.newInstance(4, 8)).build();
    Delivery delivery2 = (Delivery) Delivery.Builder.newInstance("6").addSizeDimension(0, 1).setCoord(Coordinate.newInstance(4, 12)).build();
    Delivery delivery3 = (Delivery) Delivery.Builder.newInstance("7").addSizeDimension(0, 1).setCoord(Coordinate.newInstance(16, 8)).build();
    Delivery delivery4 = (Delivery) Delivery.Builder.newInstance("8").addSizeDimension(0, 1).setCoord(Coordinate.newInstance(16, 12)).build();
   
    VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
    vrpBuilder.addVehicle(vehicle);
    vrpBuilder.addJob(shipment1).addJob(shipment2).addJob(shipment3).addJob(shipment4)
      .addJob(delivery1).addJob(delivery2).addJob(delivery3).addJob(delivery4).build();
View Full Code Here

     * 1: (4,8)
     * 2: (4,12)
     * 3: (16,8)
     * 4: (16,12)
     */
    Delivery delivery1 = (Delivery) Delivery.Builder.newInstance("5").addSizeDimension(0, 1).setCoord(Coordinate.newInstance(4, 8)).build();
    Delivery delivery2 = (Delivery) Delivery.Builder.newInstance("6").addSizeDimension(0, 1).setCoord(Coordinate.newInstance(4, 12)).build();
    Delivery delivery3 = (Delivery) Delivery.Builder.newInstance("7").addSizeDimension(0, 1).setCoord(Coordinate.newInstance(16, 8)).build();
    Delivery delivery4 = (Delivery) Delivery.Builder.newInstance("8").addSizeDimension(0, 1).setCoord(Coordinate.newInstance(16, 12)).build();
   
    VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
    vrpBuilder.addVehicle(vehicle)
//    vrpBuilder.addJob(shipment1).addJob(shipment2).addJob(shipment3).addJob(shipment4)
      .addJob(delivery1).addJob(delivery2).addJob(delivery3).addJob(delivery4).build();
View Full Code Here

TOP

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

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.