Package jsprit.core.problem.misc

Examples of jsprit.core.problem.misc.JobInsertionContext


   * assumption that cost changes can entirely covered by only looking at the predecessor i-1 and its successor i+1.
  
   */
  @Override
  public InsertionData getInsertionData(final VehicleRoute currentRoute, final Job jobToInsert, final Vehicle newVehicle, double newVehicleDepartureTime, final Driver newDriver, final double bestKnownCosts) {
    JobInsertionContext insertionContext = new JobInsertionContext(currentRoute, jobToInsert, newVehicle, newDriver, newVehicleDepartureTime);
        Service service = (Service)jobToInsert;
        int insertionIndex = InsertionData.NO_INDEX;
        TourActivity deliveryAct2Insert = activityFactory.createActivities(service).get(0);
        insertionContext.getAssociatedActivities().add(deliveryAct2Insert);

        /*
        check hard constraints at route level
         */
        if(!hardRouteLevelConstraint.fulfilled(insertionContext)){
View Full Code Here


  }

  @Test
  public void whenAddingTwoSoftRouteConstraint_managerShouldSumCostsCorrectly(){
    SoftRouteConstraint c1 = mock(SoftRouteConstraint.class);
    JobInsertionContext iContext = mock(JobInsertionContext.class);
    when(c1.getCosts(iContext)).thenReturn(1.0);
    SoftRouteConstraint c2 = mock(SoftRouteConstraint.class);
    when(c2.getCosts(iContext)).thenReturn(2.0);
    SoftRouteConstraintManager man = new SoftRouteConstraintManager();
   
View Full Code Here

  }

  @Test
  public void whenAddingTwoSoftConstrainta_managerShouldSumCostsCorrectly(){
    SoftActivityConstraint c1 = mock(SoftActivityConstraint.class);
    JobInsertionContext iContext = mock(JobInsertionContext.class);
    TourActivity act_i = mock(TourActivity.class);
    TourActivity act_k = mock(TourActivity.class);
    TourActivity act_j = mock(TourActivity.class);
    when(c1.getCosts(iContext,act_i,act_k,act_j,0.0)).thenReturn(1.0);
    SoftActivityConstraint c2 = mock(SoftActivityConstraint.class);
View Full Code Here

    public void whenNewJobIsInsertedWithOldVeh_itJustShouldReturnTrue(){

        Service s4 = Service.Builder.newInstance("s4").setLocationId("50,0").build();
        PickupService serviceAct = new PickupService(s4);

        JobInsertionContext insertionContext = new JobInsertionContext(route,s4,vehicle,route.getDriver(),0.);

        HardActivityConstraint twConstraint = new VehicleDependentTimeWindowConstraints(stateManager,routingCosts);

        HardActivityConstraint.ConstraintsStatus status = twConstraint.fulfilled(insertionContext, route.getActivities().get(2), serviceAct, route.getEnd(), 30.);
        assertTrue(status.equals(HardActivityConstraint.ConstraintsStatus.FULFILLED));
View Full Code Here

    public void whenNewJobIsInsertedWithOldVeh_itJustShouldReturnFalse(){

        Service s4 = Service.Builder.newInstance("s4").setLocationId("1000,0").build();
        PickupService serviceAct = new PickupService(s4);

        JobInsertionContext insertionContext = new JobInsertionContext(route,s4,vehicle,route.getDriver(),0.);

        HardActivityConstraint twConstraint = new VehicleDependentTimeWindowConstraints(stateManager,routingCosts);

        HardActivityConstraint.ConstraintsStatus status = twConstraint.fulfilled(insertionContext, route.getActivities().get(2), serviceAct, route.getEnd(), 30.);
        assertFalse(status.equals(HardActivityConstraint.ConstraintsStatus.FULFILLED));
View Full Code Here

    public void whenNewJobIsInsertedInBetweenAct1And2WithOldVeh_itJustShouldReturnTrue(){

        Service s4 = Service.Builder.newInstance("s4").setLocationId("50,0").build();
        PickupService serviceAct = new PickupService(s4);

        JobInsertionContext insertionContext = new JobInsertionContext(route,s4,vehicle,route.getDriver(),0.);

        HardActivityConstraint twConstraint = new VehicleDependentTimeWindowConstraints(stateManager,routingCosts);
        /*
        driverTime = 10 + 10 + 30 + 20 + 30 = 100
         */
 
View Full Code Here

    public void whenNewJobIsInsertedInBetweenAct1And2WithOldVeh_itJustShouldReturnFalse(){

        Service s4 = Service.Builder.newInstance("s4").setLocationId("51,0").build();
        PickupService serviceAct = new PickupService(s4);

        JobInsertionContext insertionContext = new JobInsertionContext(route,s4,vehicle,route.getDriver(),0.);

        /*
        driverTime = 10 + 10 + 31 + 21 + 30 = 102
         */

 
View Full Code Here

        assertEquals(60.,route.getEnd().getArrTime(),0.01);

        Service s4 = Service.Builder.newInstance("s4").setLocationId("40,0").build();
        PickupService serviceAct = new PickupService(s4);

        JobInsertionContext insertionContext = new JobInsertionContext(route,s4,v2,route.getDriver(),0.);

        HardActivityConstraint twConstraint = new VehicleDependentTimeWindowConstraints(stateManager,routingCosts);

        HardActivityConstraint.ConstraintsStatus status = twConstraint.fulfilled(insertionContext, route.getActivities().get(2), serviceAct, route.getEnd(), 30.);
View Full Code Here

        assertEquals(60.,route.getEnd().getArrTime(),0.01);

        Service s4 = Service.Builder.newInstance("s4").setLocationId("40,0").build();
        PickupService serviceAct = new PickupService(s4);

        JobInsertionContext insertionContext = new JobInsertionContext(route,s4,v3,route.getDriver(),0.);

        HardActivityConstraint twConstraint = new VehicleDependentTimeWindowConstraints(stateManager,routingCosts);

        HardActivityConstraint.ConstraintsStatus status = twConstraint.fulfilled(insertionContext, route.getActivities().get(2), serviceAct, route.getEnd(), 30.);
        assertFalse(status.equals(HardActivityConstraint.ConstraintsStatus.FULFILLED));
View Full Code Here

        assertEquals(60.,route.getEnd().getArrTime(),0.01);

        Service s4 = Service.Builder.newInstance("s4").setLocationId("40,0").build();
        PickupService serviceAct = new PickupService(s4);

        JobInsertionContext insertionContext = new JobInsertionContext(route,s4,v4,route.getDriver(),0.);

        HardActivityConstraint twConstraint = new VehicleDependentTimeWindowConstraints(stateManager,routingCosts);

        HardActivityConstraint.ConstraintsStatus status = twConstraint.fulfilled(insertionContext, route.getActivities().get(2), serviceAct, route.getEnd(), 30.);
        assertFalse(status.equals(HardActivityConstraint.ConstraintsStatus.FULFILLED));
View Full Code Here

TOP

Related Classes of jsprit.core.problem.misc.JobInsertionContext

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.