Package jsprit.core.problem.solution.route.activity

Examples of jsprit.core.problem.solution.route.activity.PickupShipment


 
  @Test
  public void whenPickupActivityIsInsertedAndLoadIsSufficient_returnFullFilled(){
    PickupService pickupService = (PickupService) vrp.getActivities(s1).get(0);
    PickupService anotherService = (PickupService) vrp.getActivities(s2).get(0);
    PickupShipment pickupShipment = (PickupShipment) vrp.getActivities(shipment).get(0);
   
    assertEquals(ConstraintsStatus.FULFILLED,constraint.fulfilled(iFacts, pickupService, pickupShipment, anotherService, 0.0));
  }
View Full Code Here


 
  @Test
  public void whenPickupActivityIsInsertedAndLoadIsNotSufficient_returnNOT_FullFilled(){
        PickupService pickupService = (PickupService) vrp.getActivities(s1).get(0);
        PickupService anotherService = (PickupService) vrp.getActivities(s2).get(0);
        PickupShipment pickupShipment = (PickupShipment) vrp.getActivities(shipment).get(0);

        stateManager.putInternalTypedActivityState(pickupService, InternalStates.LOAD, Capacity.Builder.newInstance().addDimension(0, 2).build());
//    when(stateManager.getActivityState(pickupService, StateFactory.LOAD)).thenReturn(StateFactory.createState(2.0));
    assertEquals(ConstraintsStatus.NOT_FULFILLED,constraint.fulfilled(iFacts, pickupService, pickupShipment, anotherService, 0.0));
  }
View Full Code Here

  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

    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);
View Full Code Here

    assertEquals(2,iData.getDeliveryInsertionIndex());
  }

    private List<AbstractActivity> getTourActivities(Shipment shipment) {
        List<AbstractActivity> acts = new ArrayList<AbstractActivity>();
        PickupShipment pick = new PickupShipment(shipment);
        DeliverShipment del = new DeliverShipment(shipment);
        acts.add(pick);
        acts.add(del);
        return acts;
    }
View Full Code Here

     
    });

        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);
View Full Code Here

    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);
View Full Code Here

    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);

View Full Code Here

    assertEquals(route.getEnd().getLocationId(),vehicle.getEndLocationId());
  }

    private List<AbstractActivity> getTourActivities(Shipment shipmentToInsert) {
        List<AbstractActivity> acts = new ArrayList<AbstractActivity>();
        acts.add(new PickupShipment(shipmentToInsert));
        acts.add(new DeliverShipment(shipmentToInsert));
        return acts;
    }
View Full Code Here

TOP

Related Classes of jsprit.core.problem.solution.route.activity.PickupShipment

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.