当前位置: 首页>>代码示例>>Java>>正文


Java VehicleRoute类代码示例

本文整理汇总了Java中com.graphhopper.jsprit.core.problem.solution.route.VehicleRoute的典型用法代码示例。如果您正苦于以下问题:Java VehicleRoute类的具体用法?Java VehicleRoute怎么用?Java VehicleRoute使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


VehicleRoute类属于com.graphhopper.jsprit.core.problem.solution.route包,在下文中一共展示了VehicleRoute类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: translate

import com.graphhopper.jsprit.core.problem.solution.route.VehicleRoute; //导入依赖的package包/类
private List<CustomersStillToServe> translate(VehicleRoutingProblemSolution solution, List<CustomersStillToServe> containersToSort) {

		logger.info("Unsorted customers {}", containersToSort);
		
		if (solution.getUnassignedJobs().size() > 0) {
			logger.error("There unassigned joby in the Jsprit solution.");
			throw new RuntimeException("There unassigned joby in the Jsprit solution.");
		}

		List<CustomersStillToServe> sorted = new ArrayList<>();

		for (VehicleRoute vehicleRoute : solution.getRoutes()) {

			for (TourActivity tourActivity : vehicleRoute.getActivities()) {

				if (tourActivity instanceof DeliverService) {
					CustomersStillToServe unloadBy = getUnloadByByLocation(containersToSort, tourActivity.getLocation());
					int amount = tourActivity.getSize().getNuOfDimensions();
					sorted.add(new CustomersStillToServe(unloadBy.getCustomer(), unloadBy.getStoreableParameters(), amount));
				}

			}
		}

		if (sorted.size() != containersToSort.size()) {
			logger.error("There are not searverd customers in the Jsprit solution.");
			throw new RuntimeException("There are not searverd customers in the Jsprit solution.");
		}

		logger.info("Sorted customers {}", sorted);
		return sorted;
	}
 
开发者ID:MayerTh,项目名称:RVRPSimulator,代码行数:33,代码来源:JspritUnloadContainerSorter.java

示例2: fillInRouteStats

import com.graphhopper.jsprit.core.problem.solution.route.VehicleRoute; //导入依赖的package包/类
private void fillInRouteStats() {
	for (final RouteDetail rd : vehicleIdToRouteDetails.values()) {
		VehicleRoute vr = rd.temp.jspritRoute;

		rd.travelCosts[TravelCostType.DISTANCE_KM.ordinal()] = jspritSA.getDistance(vr);
		rd.travelCosts[TravelCostType.TIME.ordinal()] = jspritSA.getTransportTime(vr);
		rd.travelCosts[TravelCostType.COST.ordinal()] = jspritSA.getVariableTransportCosts(vr);
		rd.waitingTime = jspritSA.getWaitingTime(vr);
		rd.timeWindowViolation = jspritSA.getTimeWindowViolation(vr);
		copyQuantities(jspritSA.getCapacityViolation(vr), rd.capacityViolation);
		copyQuantities(jspritSA.getLoadDelivered(vr), rd.deliveredQuantities);
		copyQuantities(jspritSA.getLoadPickedUp(vr), rd.pickedUpQuantities);
		copyQuantities(jspritSA.getLoadAtBeginning(vr), rd.startQuantities);

		rd.pickupsCount = jspritSA.getNumberOfPickups(vr);
		rd.deliveriesCount = jspritSA.getNumberOfDeliveries(vr);
		
		// start and end times
		if(vr.getStart()!=null){
			rd.startTime = vr.getStart().getEndTime();
		}
		if(vr.getEnd()!=null){
			rd.endTime = vr.getEnd().getArrTime();
		}
		rd.time = rd.endTime - rd.startTime;
		
		// update hasViolation
		for (StopDetail sd : rd.stops) {
			if (sd.hasViolation == 1) {
				rd.hasViolation = 1;
			}
		}

		if ((config.isDeliveriesBeforePickups() && jspritSA.hasBackhaulConstraintViolation(vr)) || jspritSA.hasShipmentConstraintViolation(vr) || jspritSA.hasSkillConstraintViolation(vr)) {
			rd.hasViolation = 1;
		}
	}
}
 
开发者ID:PGWelch,项目名称:com.opendoorlogistics,代码行数:39,代码来源:CalculateRouteDetailsV2.java

示例3: informBeforeJobInsertion

import com.graphhopper.jsprit.core.problem.solution.route.VehicleRoute; //导入依赖的package包/类
@Override
public void informBeforeJobInsertion(Job job, InsertionData id, VehicleRoute vr) {}
 
开发者ID:makaw,项目名称:somado,代码行数:3,代码来源:VRPListener.java

示例4: getStopOrder

import com.graphhopper.jsprit.core.problem.solution.route.VehicleRoute; //导入依赖的package包/类
private static List<StopOrder> getStopOrder(ODLApi api, ODLDatastore<? extends ODLTable> ioDb, VRPConfig conf,
		VRPBuilder built, VehicleRoutingProblemSolution bestSolution) {
	ArrayList<StopOrder> ret = new ArrayList<>();
	final InputTablesDfn dfn = new InputTablesDfn(api, conf);
	ODLTableReadOnly jobsTable = ioDb.getTableByImmutableId(dfn.stops.tableId);

	// Get map of vehicle ids to original vehicle records
	ODLTableReadOnly vehiclesTable = ioDb.getTableByImmutableId(dfn.vehicles.tableId);
	Map<String, RowVehicleIndex> vehicleRowIndices = dfn.vehicles.getVehicleIdToRowIndex(vehiclesTable);

	Set<String> usedVehicleIds = api.stringConventions().createStandardisedSet();
	for (VehicleRoute route : bestSolution.getRoutes()) {
		Vehicle vehicle = route.getVehicle();

		// // consider this route a not-load if this is a penalty vehicle ... don't output it....
		// if (PenaltyVehicleType.class.isInstance(vehicle.getType())) {
		// continue;
		// }

		// If fleet size is infinite we have repeated vehicle ids and should use the naming convention to append a
		// number
		String vehicleId = vehicle.getId();
		if (conf.isInfiniteFleetSize()) {
			RowVehicleIndex rvi = vehicleRowIndices.get(vehicleId);
			String baseId = dfn.vehicles.getBaseId(vehiclesTable, rvi.row);

			// find the lowest unused index
			int index = 0;
			while (true) {
				vehicleId = api.stringConventions().getVehicleId(baseId, Integer.MAX_VALUE, index);
				if (usedVehicleIds.contains(vehicleId) == false) {
					break;
				}
				index++;
			}
		}

		usedVehicleIds.add(vehicleId);

		// add entry for each stop and work out initial quantities
		List<TourActivity> activities = route.getActivities();
		int na = activities.size();
		for (int i = 0; i < na; i++) {
			TourActivity activity = activities.get(i);

			if (JobActivity.class.isInstance(activity)) {

				// create order object
				StopOrder order = new StopOrder();
				order.vehicleId = vehicleId;
				BuiltStopRec builtStop = built.getBuiltStop((JobActivity) activity);
				if (builtStop == null) {
					throw new RuntimeException("Could not identify stop with JSPRIT job id "
							+ ((JobActivity) activity).getJob().getId());
				}
				order.stopId = builtStop.getStopIdInStopsTable();

				ret.add(order);

			}

		}

	}

	return ret;
}
 
开发者ID:PGWelch,项目名称:com.opendoorlogistics,代码行数:68,代码来源:VRPComponent.java

示例5: ruinStarts

import com.graphhopper.jsprit.core.problem.solution.route.VehicleRoute; //导入依赖的package包/类
@Override
public void ruinStarts(Collection<VehicleRoute> clctn) {
          
  sendClearSignal();
  for (VehicleRoute vr : clctn) sendDataList(vr);            
          
}
 
开发者ID:makaw,项目名称:somado,代码行数:8,代码来源:VRPListener.java

示例6: ruinEnds

import com.graphhopper.jsprit.core.problem.solution.route.VehicleRoute; //导入依赖的package包/类
@Override
public void ruinEnds(Collection<VehicleRoute> clctn, Collection<Job> clctn1) {
             
  sendClearSignal();      
  for (VehicleRoute vr : clctn) sendDataList(vr);
          
}
 
开发者ID:makaw,项目名称:somado,代码行数:8,代码来源:VRPListener.java

示例7: informInsertionStarts

import com.graphhopper.jsprit.core.problem.solution.route.VehicleRoute; //导入依赖的package包/类
@Override
public void informInsertionStarts(Collection<VehicleRoute> clctn, Collection<Job> clctn1) {

  sendClearSignal();  
  for (VehicleRoute vr : clctn) sendDataList(vr);  
     
}
 
开发者ID:makaw,项目名称:somado,代码行数:8,代码来源:VRPListener.java

示例8: informInsertionEnds

import com.graphhopper.jsprit.core.problem.solution.route.VehicleRoute; //导入依赖的package包/类
@Override
public void informInsertionEnds(Collection<VehicleRoute> clctn) {
    
  sendClearSignal();  
  for (VehicleRoute vr : clctn) sendDataList(vr);  
    
}
 
开发者ID:makaw,项目名称:somado,代码行数:8,代码来源:VRPListener.java

示例9: informJobInserted

import com.graphhopper.jsprit.core.problem.solution.route.VehicleRoute; //导入依赖的package包/类
@Override
public void informJobInserted(Job job, VehicleRoute vr, double d, double d1) {
    
   try {
                          
     int vehicleId = Integer.parseInt(vr.getVehicle().getId());  
     List<Job> tmp = new ArrayList<>();
     tmp.add(job);
     sendData(new VehicleCurrentJobs(vehicleId, tmp));
            
   }
          
   catch (Exception e) { }      
      
}
 
开发者ID:makaw,项目名称:somado,代码行数:16,代码来源:VRPListener.java

示例10: removed

import com.graphhopper.jsprit.core.problem.solution.route.VehicleRoute; //导入依赖的package包/类
@Override
public void removed(Job job, VehicleRoute vr) {

   try {
                          
     int vehicleId = Integer.parseInt(vr.getVehicle().getId());  
     List<Job> tmp = new ArrayList<>();
     tmp.add(job);
     sendDataRemove(new VehicleCurrentJobs(vehicleId, tmp));
            
   }
          
   catch (Exception e) { }     

}
 
开发者ID:makaw,项目名称:somado,代码行数:16,代码来源:VRPListener.java

示例11: sendDataList

import com.graphhopper.jsprit.core.problem.solution.route.VehicleRoute; //导入依赖的package包/类
/**
 * Wysłanie listy danych do obiektu macierzy kosztów
 * @param vr Bieżąca trasa pojazdu
 */
private void sendDataList(VehicleRoute vr) {
 
   try {
                          
     int vehicleId = Integer.parseInt(vr.getVehicle().getId());
     List<Job> jobs = new ArrayList<>(vr.getTourActivities().getJobs());            
     sendData(new VehicleCurrentJobs(vehicleId, jobs));
            
   }
          
   catch (Exception e) { }


 }
 
开发者ID:makaw,项目名称:somado,代码行数:19,代码来源:VRPListener.java


注:本文中的com.graphhopper.jsprit.core.problem.solution.route.VehicleRoute类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。