Package jsprit.core.problem.job

Examples of jsprit.core.problem.job.Service


    assertFalse(constraint.fulfilled(iContext));
  }
 
  @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);
View Full Code Here


    assertTrue(constraint.fulfilled(iContext));
  }
 
  @Test
  public void whenAddingAServiceAndNewVehicleDoesNotHaveTheCapacity_itShouldReturnFalse(){
    Service service = mock(Service.class);
    when(service.getSize()).thenReturn(Capacity.Builder.newInstance().addDimension(0, 2).build());
   
    Capacity atBeginning = Capacity.Builder.newInstance().addDimension(0, 1).addDimension(1, 2).addDimension(2, 1).build();
    Capacity atEnd = Capacity.Builder.newInstance().addDimension(0, 0).addDimension(1, 0).addDimension(2, 0).build();
   
    RouteAndActivityStateGetter stateGetter = mock(RouteAndActivityStateGetter.class);
View Full Code Here

    assertFalse(constraint.fulfilled(iContext));
  }
 
  @Test
  public void whenAddingADeliveryAndNewVehicleDoesNotHaveTheCapacity_itShouldReturnFalse(){
    Service service = mock(Delivery.class);
    when(service.getSize()).thenReturn(Capacity.Builder.newInstance().addDimension(0, 2).build());
   
    Capacity atBeginning = Capacity.Builder.newInstance().addDimension(0, 1).addDimension(1, 2).addDimension(2, 1).build();
    Capacity atEnd = Capacity.Builder.newInstance().addDimension(0, 0).addDimension(1, 0).addDimension(2, 0).build();
   
    RouteAndActivityStateGetter stateGetter = mock(RouteAndActivityStateGetter.class);
View Full Code Here

    assertFalse(constraint.fulfilled(iContext));
  }
 
  @Test
  public void whenNewVehicleCapacityIsNotSufficiant1_returnFalse(){
    final Service pickup = createPickup("pick",2);
    final Service pickup2 = createPickup("pick2",3);

        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(pickup).addJob(pickup2).build();
View Full Code Here

  }
 
  @Test
  public void whenNewVehicleCapacityIsNotSufficiant2_returnFalse(){
    Pickup service = (Pickup) createPickup("pick",2);
        Service serviceInRoute = createPickup("pick1",3);
        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);
View Full Code Here

  }

 
  @Test
  public void whenTwoDeliveriesHaveTheSameUnderlyingJob_theyAreEqual(){
    Service s1 = Service.Builder.newInstance("s").setLocationId("loc").build();
    Service s2 = Service.Builder.newInstance("s").setLocationId("loc").build();
   
    ServiceActivity d1 = ServiceActivity.newInstance(s1);
    ServiceActivity d2 = ServiceActivity.newInstance(s2);
   
    assertTrue(d1.equals(d2));
View Full Code Here

    assertTrue(d1.equals(d2));
  }
 
  @Test
  public void whenTwoDeliveriesHaveTheDifferentUnderlyingJob_theyAreNotEqual(){
    Service s1 = Service.Builder.newInstance("s").setLocationId("loc").build();
    Service s2 = Service.Builder.newInstance("s1").setLocationId("loc").build();
   
    ServiceActivity d1 = ServiceActivity.newInstance(s1);
    ServiceActivity d2 = ServiceActivity.newInstance(s2);
   
    assertFalse(d1.equals(d2));
View Full Code Here

      }
      else{
        Coordinate customerCoord = makeCoord(tokens[0].trim(),tokens[1].trim());
        int demand = Integer.parseInt(tokens[2].trim());
        String customer = Integer.valueOf(counter-1).toString();
        Service service = Service.Builder.newInstance(customer).addSizeDimension(0, demand).setServiceTime(serviceTime).setCoord(customerCoord).build();
        vrpBuilder.addJob(service);
      }
      counter++;
    }
    close(reader);
View Full Code Here

    @Before
    public void doBefore(){
        VehicleType type = VehicleTypeImpl.Builder.newInstance("t").build();
        VehicleImpl vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("start").setType(type).build();
        Service service = Service.Builder.newInstance("s").setLocationId("loc").addRequiredSkill("skill1").build();
        Service service2 = Service.Builder.newInstance("s2").setLocationId("loc").addRequiredSkill("skill1").addRequiredSkill("skill2").addRequiredSkill("skill3").build();
        Service service3 = Service.Builder.newInstance("s3").setLocationId("loc").addRequiredSkill("skill4").addRequiredSkill("skill5").build();
        VehicleRoutingProblem vrp = VehicleRoutingProblem.Builder.newInstance().addVehicle(vehicle).addJob(service)
                .addJob(service2).addJob(service3).build();
        route = VehicleRoute.Builder.newInstance(vehicle).setJobActivityFactory(vrp.getJobActivityFactory()).addService(service).addService(service2).addService(service3).build();

        stateManager = new StateManager(vrp);
View Full Code Here

      }
    }

    private void addJobToFinalJobMapAndCreateActivities(Job job){
            if(job instanceof Service) {
                Service service = (Service) job;
        addService(service);
      }
      else if(job instanceof Shipment){
        Shipment shipment = (Shipment)job;
                addShipment(shipment);
View Full Code Here

TOP

Related Classes of jsprit.core.problem.job.Service

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.