Package jsprit.core.problem

Examples of jsprit.core.problem.JobActivityFactory


        RouteLevelActivityInsertionCostsEstimator estimator = new RouteLevelActivityInsertionCostsEstimator(routingCosts,activityCosts,stateManager);
        estimator.setForwardLooking(0);
        ServiceInsertionOnRouteLevelCalculator routeInserter = new ServiceInsertionOnRouteLevelCalculator(routingCosts,
                activityCosts,estimator,constraintManager,constraintManager);
        routeInserter.setStates(stateManager);
        routeInserter.setJobActivityFactory(new JobActivityFactory() {
            @Override
            public List<AbstractActivity> createActivities(Job job) {
                List<AbstractActivity> acts = activityFactory.createActivities(job);
                if(acts.isEmpty()){
                    acts.add(new PickupService(s4));
View Full Code Here


        RouteLevelActivityInsertionCostsEstimator estimator = new RouteLevelActivityInsertionCostsEstimator(routingCosts,activityCosts,stateManager);
        estimator.setForwardLooking(0);
        ServiceInsertionOnRouteLevelCalculator routeInserter = new ServiceInsertionOnRouteLevelCalculator(routingCosts,
                activityCosts,estimator,constraintManager,constraintManager);
        routeInserter.setStates(stateManager);
        routeInserter.setJobActivityFactory(new JobActivityFactory() {
            @Override
            public List<AbstractActivity> createActivities(Job job) {
                List<AbstractActivity> acts = activityFactory.createActivities(job);
                if(acts.isEmpty()){
                    acts.add(new PickupService(s4));
View Full Code Here

        Service service3 = Service.Builder.newInstance("s3").setLocationId("30,0").build();

        vrpBuilder.addJob(service).addJob(service2).addJob(service3);
        vrp = vrpBuilder.build();

        route = VehicleRoute.Builder.newInstance(vehicle).setJobActivityFactory(new JobActivityFactory() {
            @Override
            public List<AbstractActivity> createActivities(Job job) {
                return vrp.copyAndGetActivities(job);
            }
        }).addService(service).addService(service2).addService(service3).build();
View Full Code Here

    ExampleActivityCostFunction activityCosts = new ExampleActivityCostFunction();
    ActivityInsertionCostsCalculator actInsertionCostCalculator = new RouteLevelActivityInsertionCostsEstimator(costs, activityCosts, states);
    serviceInsertion = new ServiceInsertionOnRouteLevelCalculator(costs,activityCosts, actInsertionCostCalculator, cManager, cManager);
    serviceInsertion.setNuOfActsForwardLooking(4);
    serviceInsertion.setStates(states);
        serviceInsertion.setJobActivityFactory(new JobActivityFactory() {
            @Override
            public List<AbstractActivity> createActivities(Job job) {
                return vrp.copyAndGetActivities(job);
            }
        });
View Full Code Here

 
  @Test
  public void whenCalculatingInsertionCostsOfShipment_itShouldReturnCorrectCostValue(){
    Shipment shipment = Shipment.Builder.newInstance("s").addSizeDimension(0, 1).setPickupLocationId("0,10").setDeliveryLocationId("10,0").build();
    VehicleRoute route = VehicleRoute.emptyRoute();
        JobActivityFactory activityFactory = mock(JobActivityFactory.class);
        List<AbstractActivity> activities = new ArrayList<AbstractActivity>();
        activities.add(new PickupShipment(shipment));
        activities.add(new DeliverShipment(shipment));
        when(activityFactory.createActivities(shipment)).thenReturn(activities);
        insertionCalculator.setJobActivityFactory(activityFactory);
    InsertionData iData = insertionCalculator.getInsertionData(route, shipment, vehicle, 0.0, null, Double.MAX_VALUE);
    assertEquals(40.0,iData.getInsertionCost(),0.05);
  }
View Full Code Here

    Shipment shipment2 = Shipment.Builder.newInstance("s2").addSizeDimension(0, 1).setPickupLocationId("10,10").setDeliveryLocationId("0,0").build();
    VehicleRoute route = VehicleRoute.emptyRoute();
    when(vehicleRoutingProblem.copyAndGetActivities(shipment)).thenReturn(getTourActivities(shipment));
        new Inserter(new InsertionListeners(), vehicleRoutingProblem).insertJob(shipment, new InsertionData(0,0,0,vehicle,null), route);

        JobActivityFactory activityFactory = mock(JobActivityFactory.class);
        List<AbstractActivity> activities = new ArrayList<AbstractActivity>();
        activities.add(new PickupShipment(shipment2));
        activities.add(new DeliverShipment(shipment2));
        when(activityFactory.createActivities(shipment2)).thenReturn(activities);
        insertionCalculator.setJobActivityFactory(activityFactory);

    InsertionData iData = insertionCalculator.getInsertionData(route, shipment2, vehicle, 0.0, null, Double.MAX_VALUE);
    assertEquals(0.0,iData.getInsertionCost(),0.05);
    assertEquals(1,iData.getPickupInsertionIndex());
View Full Code Here

        return false;
      }
     
    });

        JobActivityFactory activityFactory = mock(JobActivityFactory.class);
        List<AbstractActivity> activities = new ArrayList<AbstractActivity>();
        activities.add(new PickupShipment(shipment2));
        activities.add(new DeliverShipment(shipment2));
        when(activityFactory.createActivities(shipment2)).thenReturn(activities);
        insertionCalculator.setJobActivityFactory(activityFactory);

        InsertionData iData = insertionCalculator.getInsertionData(route, shipment2, vehicle, 0.0, null, Double.MAX_VALUE);
    assertEquals(InsertionData.createEmptyInsertionData(),iData);
   
View Full Code Here

        when(vehicleRoutingProblem.copyAndGetActivities(shipment2)).thenReturn(getTourActivities(shipment2));
    Inserter inserter = new Inserter(new InsertionListeners(),vehicleRoutingProblem );
    inserter.insertJob(shipment, new InsertionData(0,0,0,vehicle,null), route);
    inserter.insertJob(shipment2, new InsertionData(0,1,2,vehicle,null),route);

        JobActivityFactory activityFactory = mock(JobActivityFactory.class);
        List<AbstractActivity> activities = new ArrayList<AbstractActivity>();
        activities.add(new PickupShipment(shipment3));
        activities.add(new DeliverShipment(shipment3));
        when(activityFactory.createActivities(shipment3)).thenReturn(activities);
        insertionCalculator.setJobActivityFactory(activityFactory);

    InsertionData iData = insertionCalculator.getInsertionData(route, shipment3, vehicle, 0.0, null, Double.MAX_VALUE);
    assertEquals(0.0,iData.getInsertionCost(),0.05);
    assertEquals(0,iData.getPickupInsertionIndex());
View Full Code Here

    VehicleRoute route = VehicleRoute.emptyRoute();
    Inserter inserter = new Inserter(new InsertionListeners(), vehicleRoutingProblem);
    inserter.insertJob(shipment, new InsertionData(0,0,0,vehicle,null), route);
    inserter.insertJob(shipment2, new InsertionData(0,1,2,vehicle,null),route);

        JobActivityFactory activityFactory = mock(JobActivityFactory.class);
        List<AbstractActivity> activities = new ArrayList<AbstractActivity>();
        activities.add(new PickupShipment(shipment3));
        activities.add(new DeliverShipment(shipment3));
        when(activityFactory.createActivities(shipment3)).thenReturn(activities);
        insertionCalculator.setJobActivityFactory(activityFactory);


        InsertionData iData = insertionCalculator.getInsertionData(route, shipment3, vehicle, 0.0, null, Double.MAX_VALUE);
    assertEquals(2.0,iData.getInsertionCost(),0.05);
View Full Code Here

    switcher.put(Shipment.class, insertionCalculator);
   
//    Service service = Service.Builder.newInstance("pick", 1).setLocationId("5,5").build();
    Pickup service = (Pickup)Pickup.Builder.newInstance("pick").addSizeDimension(0, 1).setLocationId("5,5").build();

        JobActivityFactory activityFactory = mock(JobActivityFactory.class);
        List<AbstractActivity> activities = new ArrayList<AbstractActivity>();
        activities.add(new PickupService(service));
        when(activityFactory.createActivities(service)).thenReturn(activities);
        insertionCalculator.setJobActivityFactory(activityFactory);
        serviceInsertionCalc.setJobActivityFactory(activityFactory);

        InsertionData iData = switcher.getInsertionData(route, service, vehicle, 0, DriverImpl.noDriver(), Double.MAX_VALUE);
//    routeActVisitor.visit(route);
View Full Code Here

TOP

Related Classes of jsprit.core.problem.JobActivityFactory

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.