1
0
Fork 0
mirror of https://github.com/graphhopper/jsprit.git synced 2020-01-24 07:45:05 +01:00

service and wait are optionnal

This commit is contained in:
braktar 2016-05-25 10:06:30 +02:00
parent bc7fa35461
commit eef7b73b30

View file

@ -583,14 +583,19 @@ public class VrpXMLReader {
Double fix = typeConfig.getDouble("costs.fixed"); Double fix = typeConfig.getDouble("costs.fixed");
Double timeC = typeConfig.getDouble("costs.time"); Double timeC = typeConfig.getDouble("costs.time");
Double distC = typeConfig.getDouble("costs.distance"); Double distC = typeConfig.getDouble("costs.distance");
Double serviceC = typeConfig.getDouble("costs.service"); if(typeConfig.containsKey("costs.service")){
Double waitC = typeConfig.getDouble("costs.wait"); Double serviceC = typeConfig.getDouble("costs.service");
if (serviceC != null) typeBuilder.setCostPerServiceTime(serviceC);
}
if(typeConfig.containsKey("costs.wait")){
Double waitC = typeConfig.getDouble("costs.wait");
if (waitC != null) typeBuilder.setCostPerWaitingTime(waitC);
}
if (fix != null) typeBuilder.setFixedCost(fix); if (fix != null) typeBuilder.setFixedCost(fix);
if (timeC != null) typeBuilder.setCostPerTransportTime(timeC); if (timeC != null) typeBuilder.setCostPerTransportTime(timeC);
if (distC != null) typeBuilder.setCostPerDistance(distC); if (distC != null) typeBuilder.setCostPerDistance(distC);
if (serviceC != null) typeBuilder.setCostPerServiceTime(serviceC);
if (waitC != null) typeBuilder.setCostPerWaitingTime(waitC);
VehicleType type = typeBuilder.build(); VehicleType type = typeBuilder.build();
String id = type.getTypeId(); String id = type.getTypeId();
types.put(id, type); types.put(id, type);