Package jsprit.core.problem.solution.route

Examples of jsprit.core.problem.solution.route.VehicleRoute


            @Override
            public double getDistance(String fromLocationId, String toLocationId) {
                return vrp.getTransportCosts().getTransportCost(fromLocationId,toLocationId,0.,null,null);
            }
        });
        VehicleRoute route = solution.getRoutes().iterator().next();
        TourActivity act = route.getStart();
        Capacity cap = analyser.getCapacityViolationAfterActivity(act,route);
        for(int i=0;i<cap.getNuOfDimensions();i++){
            assertTrue(cap.get(i) == 0);
        }
    }
View Full Code Here


            @Override
            public double getDistance(String fromLocationId, String toLocationId) {
                return vrp.getTransportCosts().getTransportCost(fromLocationId,toLocationId,0.,null,null);
            }
        });
        VehicleRoute route = solution.getRoutes().iterator().next();
        Capacity cap = analyser.getCapacityViolationAtBeginning(route);
        assertEquals(25,cap.get(0));
    }
View Full Code Here

            @Override
            public double getDistance(String fromLocationId, String toLocationId) {
                return vrp.getTransportCosts().getTransportCost(fromLocationId,toLocationId,0.,null,null);
            }
        });
        VehicleRoute route = solution.getRoutes().iterator().next();
        Capacity cap = analyser.getCapacityViolationAfterActivity(route.getStart(), route);
        assertEquals(25,cap.get(0));
    }
View Full Code Here

            @Override
            public double getDistance(String fromLocationId, String toLocationId) {
                return vrp.getTransportCosts().getTransportCost(fromLocationId,toLocationId,0.,null,null);
            }
        });
        VehicleRoute route = solution.getRoutes().iterator().next();
        Capacity cap = analyser.getCapacityViolationAfterActivity(route.getActivities().get(0),route);
        assertEquals(35,cap.get(0));
    }
View Full Code Here

      catch (ExecutionException e) {
        e.printStackTrace();
        logger.error(e.getCause().toString());
        System.exit(1);
      }
            VehicleRoute newRoute = VehicleRoute.emptyRoute();
            InsertionData newIData = bestInsertionCostCalculator.getInsertionData(newRoute, unassignedJob, NO_NEW_VEHICLE_YET, NO_NEW_DEPARTURE_TIME_YET, NO_NEW_DRIVER_YET, bestInsertionCost);
            if(newIData.getInsertionCost() < bestInsertionCost){
                bestInsertion = new Insertion(newRoute,newIData);
                vehicleRoutes.add(newRoute);
                batches.get(random.nextInt(batches.size())).routes.add(newRoute);
View Full Code Here

    assertEquals(0, iData.getDeliveryInsertionIndex());
  }
 
  @Test
  public void whenInsertingThirdJobWithVehicle_itCalculatesMarginalCostChanges(){
    VehicleRoute route = VehicleRoute.Builder.newInstance(vehicle, driver).setJobActivityFactory(vrp.getJobActivityFactory()).addService(first).addService(third).build();
    states.informInsertionStarts(Arrays.asList(route), null);
   
    InsertionData iData = serviceInsertion.getInsertionData(route, second, vehicle, vehicle.getEarliestDeparture(), null, Double.MAX_VALUE);
    assertEquals(0.0, iData.getInsertionCost(), 0.2);
    assertEquals(1, iData.getDeliveryInsertionIndex());
View Full Code Here

    assertEquals(1, iData.getDeliveryInsertionIndex());
  }
 
  @Test
  public void whenInsertingThirdJobWithNewVehicle_itCalculatesMarginalCostChanges(){
    VehicleRoute route = VehicleRoute.Builder.newInstance(vehicle, driver).setJobActivityFactory(vrp.getJobActivityFactory()).addService(first).addService(third).build();
    states.informInsertionStarts(Arrays.asList(route), null);
   
    InsertionData iData = serviceInsertion.getInsertionData(route, second, newVehicle, newVehicle.getEarliestDeparture(), null, Double.MAX_VALUE);
    assertEquals(40.0, iData.getInsertionCost(), 0.2);
    assertEquals(1, iData.getDeliveryInsertionIndex());
View Full Code Here

    assertEquals(1, iData.getDeliveryInsertionIndex());
  }
 
  @Test
  public void whenInsertingASecondJobWithAVehicle_itCalculatesLocalMarginalCostChanges(){
    VehicleRoute route = VehicleRoute.Builder.newInstance(vehicle, driver).setJobActivityFactory(vrp.getJobActivityFactory()).addService(first).addService(second).build();
    states.informInsertionStarts(Arrays.asList(route), null);
   
    InsertionData iData = serviceInsertion.getInsertionData(route, third, vehicle, vehicle.getEarliestDeparture(), null, Double.MAX_VALUE);
    assertEquals(0.0, iData.getInsertionCost(), 0.2);
    assertEquals(2, iData.getDeliveryInsertionIndex());
View Full Code Here

  }
 
  @Test
  public void whenInsertingASecondJobWithANewVehicle_itCalculatesLocalMarginalCostChanges(){

    VehicleRoute route = VehicleRoute.Builder.newInstance(vehicle, driver).setJobActivityFactory(vrp.getJobActivityFactory()).addService(first).addService(second).build();

    states.informInsertionStarts(Arrays.asList(route), null);
   
    InsertionData iData = serviceInsertion.getInsertionData(route, third, newVehicle, newVehicle.getEarliestDeparture(), null, Double.MAX_VALUE);
    assertEquals(50.0, iData.getInsertionCost(), 0.2);
View Full Code Here

    assertEquals(2, iData.getDeliveryInsertionIndex());
  }
 
  @Test
  public void whenInsertingJobAndCurrRouteIsEmpty_accessEggressCalcShouldReturnZero(){
    VehicleRoute route = VehicleRoute.Builder.newInstance(VehicleImpl.createNoVehicle(), DriverImpl.noDriver()).build();
    AdditionalAccessEgressCalculator accessEgressCalc = new AdditionalAccessEgressCalculator(costs);
    Job job = Service.Builder.newInstance("1").addSizeDimension(0, 0).setLocationId("1").setTimeWindow(TimeWindow.newInstance(0.0, 100.0)).build();
    JobInsertionContext iContex = new JobInsertionContext(route, job, newVehicle, mock(Driver.class), 0.0);
    assertEquals(0.0, accessEgressCalc.getCosts(iContex),0.01);
  }
View Full Code Here

TOP

Related Classes of jsprit.core.problem.solution.route.VehicleRoute

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.