Package jsprit.core.problem.job

Examples of jsprit.core.problem.job.Shipment


  @Test
  public void whenReadingJobs_pickupLocationIdShipment4IsReadCorrectly(){
    VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
    new VrpXMLReader(builder, null).read(inFileName);
    VehicleRoutingProblem vrp = builder.build();
    Shipment s = (Shipment) vrp.getJobs().get("4");
    assertEquals("[x=10.0][y=10.0]",s.getPickupLocationId());
  }
View Full Code Here


  @Test
  public void whenReadingJobs_deliveryLocationIdShipment4IsReadCorrectly(){
    VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
    new VrpXMLReader(builder, null).read(inFileName);
    VehicleRoutingProblem vrp = builder.build();
    Shipment s = (Shipment) vrp.getJobs().get("4");
    assertEquals("[x=10.0][y=0.0]",s.getDeliveryLocationId());
  }
View Full Code Here

  @Test
  public void whenReadingJobs_pickupServiceTimeOfShipment4IsReadCorrectly(){
    VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
    new VrpXMLReader(builder, null).read(inFileName);
    VehicleRoutingProblem vrp = builder.build();
    Shipment s = (Shipment) vrp.getJobs().get("4");
    assertEquals(0.0,s.getPickupServiceTime(),0.01);
  }
View Full Code Here

  @Test
  public void whenReadingJobs_deliveryServiceTimeOfShipment4IsReadCorrectly(){
    VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
    new VrpXMLReader(builder, null).read(inFileName);
    VehicleRoutingProblem vrp = builder.build();
    Shipment s = (Shipment) vrp.getJobs().get("4");
    assertEquals(100.0,s.getDeliveryServiceTime(),0.01);
  }
View Full Code Here

public class DefaultShipmentActivityFactoryTest {
 
  @Test
  public void whenCreatingPickupActivityWithShipment_itShouldReturnPickupShipment(){
    DefaultShipmentActivityFactory factory = new DefaultShipmentActivityFactory();
    Shipment shipment = Shipment.Builder.newInstance("s")
        .setPickupLocationId("pLoc").setDeliveryLocationId("dLoc").build();
    TourActivity act = factory.createPickup(shipment);
    assertNotNull(act);
    assertTrue(act instanceof PickupShipment);
  }
View Full Code Here

  }
 
  @Test
  public void whenCreatingDeliverActivityWithShipment_itShouldReturnDeliverShipment(){
    DefaultShipmentActivityFactory factory = new DefaultShipmentActivityFactory();
    Shipment shipment = Shipment.Builder.newInstance("s")
        .setPickupLocationId("pLoc").setDeliveryLocationId("dLoc").build();
    TourActivity act = factory.createDelivery(shipment);
    assertNotNull(act);
    assertTrue(act instanceof DeliverShipment);
  }
View Full Code Here

    private void addLocationToTentativeLocations(Job job) {
      if(job instanceof Service) {
        tentative_coordinates.put(((Service)job).getLocationId(), ((Service)job).getCoord());
      }
      else if(job instanceof Shipment){
        Shipment shipment = (Shipment)job;
        tentative_coordinates.put(shipment.getPickupLocationId(), shipment.getPickupCoord());
        tentative_coordinates.put(shipment.getDeliveryLocationId(), shipment.getDeliveryCoord());
      }
    }
View Full Code Here

            if(job instanceof Service) {
                Service service = (Service) job;
        addService(service);
      }
      else if(job instanceof Shipment){
        Shipment shipment = (Shipment)job;
                addShipment(shipment);
      }
            List<AbstractActivity> jobActs = jobActivityFactory.createActivities(job);
            for(AbstractActivity act : jobActs){
                act.setIndex(activityIndexCounter);
View Full Code Here

    }

        private void registerLocation(Job job) {
            if (job instanceof Service) tentative_coordinates.put(((Service) job).getLocationId(), ((Service) job).getCoord());
            if (job instanceof Shipment) {
                Shipment shipment = (Shipment) job;
                tentative_coordinates.put(shipment.getPickupLocationId(), shipment.getPickupCoord());
                tentative_coordinates.put(shipment.getDeliveryLocationId(), shipment.getDeliveryCoord());
            }
        }
View Full Code Here

    for(Relation rel : relations){
      counter++;
      String from = rel.from;
      String to = rel.to;
      int demand = rel.demand;
      Shipment s = Shipment.Builder.newInstance(counter.toString()).addSizeDimension(0, demand)
          .setPickupCoord(customers.get(from).coord).setPickupServiceTime(customers.get(from).serviceTime)
          .setPickupTimeWindow(TimeWindow.newInstance(customers.get(from).start, customers.get(from).end))
          .setDeliveryCoord(customers.get(to).coord).setDeliveryServiceTime(customers.get(to).serviceTime)
          .setDeliveryTimeWindow(TimeWindow.newInstance(customers.get(to).start, customers.get(to).end)).build();
      vrpBuilder.addJob(s);
View Full Code Here

TOP

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

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.