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

issue #58 - fix bug

This commit is contained in:
Stefan Schroeder 2013-12-05 18:16:18 +01:00
parent 4c2651087b
commit ad93dfeb47
3 changed files with 8 additions and 1 deletions

View file

@ -441,10 +441,15 @@ public class VrpXMLReader{
String penalty = typeConfig.getString("[@type]");
if(penalty != null){
if(penalty.equals("penalty")){
type = new PenaltyVehicleType(type);
String penaltyFactor = typeConfig.getString("[@penaltyFactor]");
if(penaltyFactor != null){
type = new PenaltyVehicleType(type,Double.parseDouble(penaltyFactor));
}
else type = new PenaltyVehicleType(type);
id = id + "_penalty";
}
}
types.put(id, type);
}

View file

@ -248,6 +248,7 @@ public class VrpXMLWriter {
for(VehicleType type : vrp.getTypes()){
if(type instanceof PenaltyVehicleType){
xmlConfig.setProperty(typePathString + "("+typeCounter+")[@type]", "penalty");
xmlConfig.setProperty(typePathString + "("+typeCounter+")[@penaltyFactor]", ((PenaltyVehicleType)type).getPenaltyFactor());
}
xmlConfig.setProperty(typePathString + "("+typeCounter+").id", type.getTypeId());
xmlConfig.setProperty(typePathString + "("+typeCounter+").capacity", type.getCapacity());

View file

@ -82,6 +82,7 @@
</xs:element>
</xs:all>
<xs:attribute name="type" type="xs:string" use="optional" />
<xs:attribute name="penaltyFactor" type="xs:string" use="optional" />
</xs:complexType>
</xs:element>
</xs:sequence>