Package jsprit.core.problem.misc

Examples of jsprit.core.problem.misc.JobInsertionContext


        assertFalse(skillConstraint.fulfilled(insertionContext));
    }

    @Test
    public void whenRouteToBeOvertakenRequiresSkillsThatVehicleDoesNotHave2_itShouldReturnFalse(){
        JobInsertionContext insertionContext = new JobInsertionContext(route,vrp.getJobs().get("s4"),vehicle2,route.getDriver(),0.);
        assertFalse(skillConstraint.fulfilled(insertionContext));
    }
View Full Code Here


        assertFalse(skillConstraint.fulfilled(insertionContext));
    }

    @Test
    public void whenRouteToBeOvertakenRequiresSkillsThatVehicleDoesHave_itShouldReturnTrue(){
        JobInsertionContext insertionContext = new JobInsertionContext(route,vrp.getJobs().get("s4"),vehicle,route.getDriver(),0.);
        assertTrue(skillConstraint.fulfilled(insertionContext));
    }
View Full Code Here

        VehicleType type = VehicleTypeImpl.Builder.newInstance("type").addCapacityDimension(0,3).build();
        VehicleImpl vehicle = VehicleImpl.Builder.newInstance("v").setType(type).setStartLocationId("loc").build();
        VehicleRoutingProblem vrp = VehicleRoutingProblem.Builder.newInstance().addVehicle(vehicle).addJob(service).addJob(serviceInRoute).build();
        VehicleRoute route = VehicleRoute.Builder.newInstance(vehicle).setJobActivityFactory(vrp.getJobActivityFactory()).addService(serviceInRoute).build();
        stateManager.informInsertionStarts(Arrays.asList(route), null);
    JobInsertionContext iContext = new JobInsertionContext(route,service,vehicle,null,0.);

    assertFalse(new ServiceLoadRouteLevelConstraint(stateManager).fulfilled(iContext));
  }
View Full Code Here

  @Test
  public void whenLoadPlusDeliverySizeDoesNotExceedsVehicleCapacity_itShouldReturnTrue(){
    Service service = mock(Delivery.class);
    when(service.getSize()).thenReturn(Capacity.Builder.newInstance().addDimension(0, 1).addDimension(1, 1).addDimension(2, 1).build());
   
    JobInsertionContext iContext = mock(JobInsertionContext.class);
    when(iContext.getJob()).thenReturn(service);
    when(iContext.getRoute()).thenReturn(route);
    when(iContext.getNewVehicle()).thenReturn(vehicle);
   
    assertTrue(constraint.fulfilled(iContext));
  }
View Full Code Here

  @Test
  public void whenLoadPlusDeliverySizeExceedsVehicleCapacityInAllDimension_itShouldReturnFalse(){
    Service service = mock(Delivery.class);
    when(service.getSize()).thenReturn(Capacity.Builder.newInstance().addDimension(0, 3).addDimension(1, 3).addDimension(2, 3).build());
   
    JobInsertionContext iContext = mock(JobInsertionContext.class);
    when(iContext.getJob()).thenReturn(service);
    when(iContext.getRoute()).thenReturn(route);
    when(iContext.getNewVehicle()).thenReturn(vehicle);
   
    assertFalse(constraint.fulfilled(iContext));
  }
View Full Code Here

  @Test
  public void whenLoadPlusDeliverySizeExceedsVehicleCapacityInOneDimension_itShouldReturnFalse(){
    Service service = mock(Delivery.class);
    when(service.getSize()).thenReturn(Capacity.Builder.newInstance().addDimension(0, 1).addDimension(1, 1).addDimension(2, 3).build());
   
    JobInsertionContext iContext = mock(JobInsertionContext.class);
    when(iContext.getJob()).thenReturn(service);
    when(iContext.getRoute()).thenReturn(route);
    when(iContext.getNewVehicle()).thenReturn(vehicle);
   
    assertFalse(constraint.fulfilled(iContext));
  }
View Full Code Here

  @Test
  public void whenLoadPlusDeliverySizeJustFitIntoVehicle_itShouldReturnTrue(){
    Service service = mock(Delivery.class);
    when(service.getSize()).thenReturn(Capacity.Builder.newInstance().addDimension(0, 2).addDimension(1, 2).addDimension(2, 2).build());
   
    JobInsertionContext iContext = mock(JobInsertionContext.class);
    when(iContext.getJob()).thenReturn(service);
    when(iContext.getRoute()).thenReturn(route);
    when(iContext.getNewVehicle()).thenReturn(vehicle);
   
    assertTrue(constraint.fulfilled(iContext));
  }
View Full Code Here

  @Test
  public void whenLoadPlusPickupSizeDoesNotExceedsVehicleCapacity_itShouldReturnTrue(){
    Service service = mock(Pickup.class);
    when(service.getSize()).thenReturn(Capacity.Builder.newInstance().addDimension(0, 1).addDimension(1, 1).addDimension(2, 1).build());
   
    JobInsertionContext iContext = mock(JobInsertionContext.class);
    when(iContext.getJob()).thenReturn(service);
    when(iContext.getRoute()).thenReturn(route);
    when(iContext.getNewVehicle()).thenReturn(vehicle);
   
    assertTrue(constraint.fulfilled(iContext));
  }
View Full Code Here

  @Test
  public void whenLoadPlusPickupSizeExceedsVehicleCapacityInAllDimension_itShouldReturnFalse(){
    Service service = mock(Pickup.class);
    when(service.getSize()).thenReturn(Capacity.Builder.newInstance().addDimension(0, 3).addDimension(1, 3).addDimension(2, 3).build());
   
    JobInsertionContext iContext = mock(JobInsertionContext.class);
    when(iContext.getJob()).thenReturn(service);
    when(iContext.getRoute()).thenReturn(route);
    when(iContext.getNewVehicle()).thenReturn(vehicle);
   
    assertFalse(constraint.fulfilled(iContext));
  }
View Full Code Here

  @Test
  public void whenLoadPlusPickupSizeExceedsVehicleCapacityInOneDimension_itShouldReturnFalse(){
    Service service = mock(Pickup.class);
    when(service.getSize()).thenReturn(Capacity.Builder.newInstance().addDimension(0, 1).addDimension(1, 1).addDimension(2, 3).build());
   
    JobInsertionContext iContext = mock(JobInsertionContext.class);
    when(iContext.getJob()).thenReturn(service);
    when(iContext.getRoute()).thenReturn(route);
    when(iContext.getNewVehicle()).thenReturn(vehicle);
   
    assertFalse(constraint.fulfilled(iContext));
  }
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.