mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
commit
7cb0c694c7
5 changed files with 19 additions and 4 deletions
|
|
@ -583,9 +583,18 @@ public class VrpXMLReader {
|
|||
Double fix = typeConfig.getDouble("costs.fixed");
|
||||
Double timeC = typeConfig.getDouble("costs.time");
|
||||
Double distC = typeConfig.getDouble("costs.distance");
|
||||
if(typeConfig.containsKey("costs.service")){
|
||||
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 (timeC != null) typeBuilder.setCostPerTime(timeC);
|
||||
if (timeC != null) typeBuilder.setCostPerTransportTime(timeC);
|
||||
if (distC != null) typeBuilder.setCostPerDistance(distC);
|
||||
VehicleType type = typeBuilder.build();
|
||||
String id = type.getTypeId();
|
||||
|
|
|
|||
|
|
@ -383,7 +383,9 @@ public class VrpXMLWriter {
|
|||
|
||||
xmlConfig.setProperty(typePathString + "(" + typeCounter + ").costs.fixed", type.getVehicleCostParams().fix);
|
||||
xmlConfig.setProperty(typePathString + "(" + typeCounter + ").costs.distance", type.getVehicleCostParams().perDistanceUnit);
|
||||
xmlConfig.setProperty(typePathString + "(" + typeCounter + ").costs.time", type.getVehicleCostParams().perTimeUnit);
|
||||
xmlConfig.setProperty(typePathString + "(" + typeCounter + ").costs.time", type.getVehicleCostParams().perTransportTimeUnit);
|
||||
xmlConfig.setProperty(typePathString + "(" + typeCounter + ").costs.service", type.getVehicleCostParams().perServiceTimeUnit);
|
||||
xmlConfig.setProperty(typePathString + "(" + typeCounter + ").costs.wait", type.getVehicleCostParams().perWaitingTimeUnit);
|
||||
typeCounter++;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ public class FastVehicleRoutingTransportCostsMatrix extends AbstractForwardVehic
|
|||
throw new IllegalArgumentException("index of from " + from + " to " + to + " < 0 ");
|
||||
if (vehicle == null) return getDistance(from.getIndex(), to.getIndex());
|
||||
VehicleTypeImpl.VehicleCostParams costParams = vehicle.getType().getVehicleCostParams();
|
||||
return costParams.perDistanceUnit * getDistance(from.getIndex(), to.getIndex()) + costParams.perTimeUnit * getTransportTime(from, to, departureTime, driver, vehicle);
|
||||
return costParams.perDistanceUnit * getDistance(from.getIndex(), to.getIndex()) + costParams.perTransportTimeUnit * getTransportTime(from, to, departureTime, driver, vehicle);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -257,7 +257,7 @@ public class VehicleRoutingTransportCostsMatrix extends AbstractForwardVehicleRo
|
|||
public double getTransportCost(Location from, Location to, double departureTime, Driver driver, Vehicle vehicle) {
|
||||
if (vehicle == null) return getDistance(from.getId(), to.getId());
|
||||
VehicleCostParams costParams = vehicle.getType().getVehicleCostParams();
|
||||
return costParams.perDistanceUnit * getDistance(from.getId(), to.getId()) + costParams.perTimeUnit * getTime(from.getId(), to.getId());
|
||||
return costParams.perDistanceUnit * getDistance(from.getId(), to.getId()) + costParams.perTransportTimeUnit * getTime(from.getId(), to.getId());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,6 +106,10 @@
|
|||
maxOccurs="1" default="0.0"/>
|
||||
<xs:element name="time" type="xs:decimal" minOccurs="0"
|
||||
maxOccurs="1" default="0.0"/>
|
||||
<xs:element name="service" type="xs:decimal" minOccurs="0"
|
||||
maxOccurs="1" default="0.0"/>
|
||||
<xs:element name="wait" type="xs:decimal" minOccurs="0"
|
||||
maxOccurs="1" default="0.0"/>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue