[英]Ambulance rescue as vehicle routing (capacitated, time bound)
這是我要解決的問題:
我正在嘗試使用jsprit解決此問題,但無法弄清楚如何執行以下操作:(我想知道我應該研究API的哪一部分)
1)指定有有限的救護車,但它們可以多次旅行。
2)限制患者在死亡或離開醫院之前被送往醫院。
3)對於到達醫院進行分娩的任何救護車,增加1分鍾的卸載時間。
4)讓救護車將病人送至任何醫院,從而選擇更好的路線。
到目前為止,這是我的代碼:
// make vehicle routing problem builder
VehicleRoutingProblem.Builder vrpBuilder =
VehicleRoutingProblem.Builder.newInstance();
// make vehicle type
VehicleTypeImpl.Builder vehicleTypeBuilder =
VehicleTypeImpl.Builder.newInstance("ambulanceWithFourBeds")
.addCapacityDimension(0, 4);
VehicleType vehicleType = vehicleTypeBuilder.build();
// putting multiple vehicles at every hospital
List<Location> locations = state.getVehicleLocations();
int counter = 0;
for (Location location : locations) {
VehicleImpl.Builder vehicleBuilder =
VehicleImpl.Builder.newInstance("ambulance_" + counter++);
vehicleBuilder.setStartLocation(location);
vehicleBuilder.setType(vehicleType);
vrpBuilder.addVehicle(vehicleBuilder.build());
}
List<Patient> patients = state.getPatients();
counter = 0;
for (Patient patient : patients) {
Shipment shipment = Shipment.Builder.newInstance("patient_" + counter++)
.addSizeDimension(0, 1).setDeliveryTimeWindow(patient.getTimeWindow())
.setPickupLocation(Location.newInstance(patient.x, patient.y))
.setDeliveryLocation(patient.getAssignedClusterCentroid()).build();
vrpBuilder.addJob(shipment);
}
vrpBuilder.setRoutingCost(new ManhattanCosts(vrpBuilder.getLocations()));
VehicleRoutingProblem problem = vrpBuilder.build();
嗯,我仍在學習如何提出問題方面的知識。 我幾乎解決了上述問題。 這是我的結果(以及指向整個代碼的鏈接):
對於任何一輛到達醫院進行分娩的救護車,增加1分鍾的卸載時間。 -繼承VehicleRoutingTransportCosts並將所有距離和時間加1。
讓救護車將病人送至任何醫院,從而選擇更好的路線。 -仍未解決。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.