Package jsprit.core.problem.misc

Examples of jsprit.core.problem.misc.JobInsertionContext


  @Test
  public void whenLoadPlusPickupSizeJustFitIntoVehicle_itShouldReturnTrue(){
    Service service = mock(Pickup.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 whenLoadPlusServiceSizeDoesNotExceedsVehicleCapacity_itShouldReturnTrue(){
    Service service = mock(Service.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 whenLoadPlusServiceSizeExceedsVehicleCapacityInAllDimension_itShouldReturnFalse(){
    Service service = mock(Service.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 whenLoadPlusServiceSizeExceedsVehicleCapacityInOneDimension_itShouldReturnFalse(){
    Service service = mock(Service.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 whenLoadPlusServiceSizeJustFitIntoVehicle_itShouldReturnTrue(){
    Service service = mock(Service.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

    RouteAndActivityStateGetter stateGetter = mock(RouteAndActivityStateGetter.class);
    when(stateGetter.getRouteState(route, InternalStates.LOAD_AT_BEGINNING, Capacity.class)).thenReturn(atBeginning);
    when(stateGetter.getRouteState(route, InternalStates.LOAD_AT_END, Capacity.class)).thenReturn(atEnd);
    when(stateGetter.getRouteState(route, InternalStates.MAXLOAD, Capacity.class)).thenReturn(atBeginning);
   
    JobInsertionContext iContext = mock(JobInsertionContext.class);
    when(iContext.getJob()).thenReturn(service);
    when(iContext.getRoute()).thenReturn(route);
   
    VehicleType type = mock(VehicleType.class);
    when(type.getCapacityDimensions()).thenReturn(Capacity.Builder.newInstance().addDimension(0, 2).addDimension(1, 1).addDimension(2, 2).build());
    Vehicle vehicle = mock(Vehicle.class);
    when(vehicle.getType()).thenReturn(type);
   
    when(iContext.getNewVehicle()).thenReturn(vehicle);
   
    ServiceLoadRouteLevelConstraint constraint = new ServiceLoadRouteLevelConstraint(stateGetter);
    assertFalse(constraint.fulfilled(iContext));
  }
View Full Code Here

    RouteAndActivityStateGetter stateGetter = mock(RouteAndActivityStateGetter.class);
    when(stateGetter.getRouteState(route, InternalStates.LOAD_AT_BEGINNING, Capacity.class)).thenReturn(atBeginning);
    when(stateGetter.getRouteState(route, InternalStates.LOAD_AT_END, Capacity.class)).thenReturn(atEnd);
    when(stateGetter.getRouteState(route, InternalStates.MAXLOAD, Capacity.class)).thenReturn(atBeginning);
   
    JobInsertionContext iContext = mock(JobInsertionContext.class);
    when(iContext.getJob()).thenReturn(service);
    when(iContext.getRoute()).thenReturn(route);
   
    VehicleType type = mock(VehicleType.class);
    when(type.getCapacityDimensions()).thenReturn(Capacity.Builder.newInstance().addDimension(0, 2).addDimension(1, 1).addDimension(2, 2).build());
    vehicle = mock(Vehicle.class);
    when(vehicle.getType()).thenReturn(type);
   
    when(iContext.getNewVehicle()).thenReturn(vehicle);
   
    ServiceLoadRouteLevelConstraint constraint = new ServiceLoadRouteLevelConstraint(stateGetter);
    assertFalse(constraint.fulfilled(iContext));
  }
View Full Code Here

    RouteAndActivityStateGetter stateGetter = mock(RouteAndActivityStateGetter.class);
    when(stateGetter.getRouteState(route, InternalStates.LOAD_AT_BEGINNING, Capacity.class)).thenReturn(atBeginning);
    when(stateGetter.getRouteState(route, InternalStates.LOAD_AT_END, Capacity.class)).thenReturn(atEnd);
    when(stateGetter.getRouteState(route, InternalStates.MAXLOAD, Capacity.class)).thenReturn(atBeginning);
   
    JobInsertionContext iContext = mock(JobInsertionContext.class);
    when(iContext.getJob()).thenReturn(service);
    when(iContext.getRoute()).thenReturn(route);
   
    VehicleType type = mock(VehicleType.class);
    when(type.getCapacityDimensions()).thenReturn(Capacity.Builder.newInstance().addDimension(0, 2).addDimension(1, 1).addDimension(2, 2).build());
    vehicle = mock(Vehicle.class);
    when(vehicle.getType()).thenReturn(type);
   
    when(iContext.getNewVehicle()).thenReturn(vehicle);
   
    ServiceLoadRouteLevelConstraint constraint = new ServiceLoadRouteLevelConstraint(stateGetter);
    assertFalse(constraint.fulfilled(iContext));
  }
View Full Code Here

        VehicleRoutingProblem vrp = VehicleRoutingProblem.Builder.newInstance().addVehicle(vehicle).addJob(pickup).addJob(pickup2).build();

    VehicleRoute route = VehicleRoute.Builder.newInstance(vehicle).setJobActivityFactory(vrp.getJobActivityFactory()).addService(pickup2).build();

    stateManager.informInsertionStarts(Arrays.asList(route), null);
        JobInsertionContext iContext = new JobInsertionContext(route,pickup,vehicle,null,0.);
    assertFalse(new ServiceLoadRouteLevelConstraint(stateManager).fulfilled(iContext));
  }
View Full Code Here

        vrp = VehicleRoutingProblem.Builder.newInstance().addJob(s1).addJob(s2).addJob(shipment).addVehicle(vehicle).build();

    stateManager = new StateManager(vrp);

    iFacts = new JobInsertionContext(null, null, vehicle, null, 0.0);
    constraint = new PickupAndDeliverShipmentLoadActivityLevelConstraint(stateManager);
  }
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.