mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
tested multiple cap-dims for VrpXMLReader
This commit is contained in:
parent
8da2d1e1c5
commit
6e6deef577
2 changed files with 14 additions and 19 deletions
|
|
@ -239,11 +239,6 @@ public class VrpXMLReader{
|
|||
String end = routeConfig.getString("end");
|
||||
if(end == null) throw new IllegalStateException("route end-time is missing.");
|
||||
|
||||
// Start startAct = Start.newInstance(vehicle.getLocationId(), vehicle.getEarliestDeparture(), vehicle.getLatestArrival());
|
||||
// startAct.setEndTime(Double.parseDouble(start));
|
||||
// End endAct = End.newInstance(vehicle.getLocationId(), vehicle.getEarliestDeparture(), vehicle.getLatestArrival());
|
||||
// endAct.setArrTime(Double.parseDouble(end));
|
||||
|
||||
VehicleRoute.Builder routeBuilder = VehicleRoute.Builder.newInstance(vehicle, driver);
|
||||
routeBuilder.setDepartureTime(departureTime);
|
||||
routeBuilder.setRouteEndArrivalTime(Double.parseDouble(end));
|
||||
|
|
@ -332,10 +327,10 @@ public class VrpXMLReader{
|
|||
}
|
||||
else {
|
||||
builder = Shipment.Builder.newInstance(id);
|
||||
List<HierarchicalConfiguration> dimensionConfigs = shipmentConfig.configurationsAt("capacity-dimensions");
|
||||
List<HierarchicalConfiguration> dimensionConfigs = shipmentConfig.configurationsAt("capacity-dimensions.dimension");
|
||||
for(HierarchicalConfiguration dimension : dimensionConfigs){
|
||||
Integer index = dimension.getInt("dimension[@index]");
|
||||
Integer value = dimension.getInt("dimension");
|
||||
Integer index = dimension.getInt("[@index]");
|
||||
Integer value = dimension.getInt("");
|
||||
builder.addCapacityDimension(index, value);
|
||||
}
|
||||
}
|
||||
|
|
@ -441,10 +436,10 @@ public class VrpXMLReader{
|
|||
}
|
||||
else {
|
||||
builder = serviceBuilderFactory.createBuilder(type, id, null);
|
||||
List<HierarchicalConfiguration> dimensionConfigs = serviceConfig.configurationsAt("capacity-dimensions");
|
||||
List<HierarchicalConfiguration> dimensionConfigs = serviceConfig.configurationsAt("capacity-dimensions.dimension");
|
||||
for(HierarchicalConfiguration dimension : dimensionConfigs){
|
||||
Integer index = dimension.getInt("dimension[@index]");
|
||||
Integer value = dimension.getInt("dimension");
|
||||
Integer index = dimension.getInt("[@index]");
|
||||
Integer value = dimension.getInt("");
|
||||
builder.addCapacityDimension(index, value);
|
||||
}
|
||||
}
|
||||
|
|
@ -501,10 +496,10 @@ public class VrpXMLReader{
|
|||
}
|
||||
else {
|
||||
typeBuilder = VehicleTypeImpl.Builder.newInstance(typeId);
|
||||
List<HierarchicalConfiguration> dimensionConfigs = typeConfig.configurationsAt("capacity-dimensions");
|
||||
List<HierarchicalConfiguration> dimensionConfigs = typeConfig.configurationsAt("capacity-dimensions.dimension");
|
||||
for(HierarchicalConfiguration dimension : dimensionConfigs){
|
||||
Integer index = dimension.getInt("dimension[@index]");
|
||||
Integer value = dimension.getInt("dimension");
|
||||
Integer index = dimension.getInt("[@index]");
|
||||
Integer value = dimension.getInt("");
|
||||
typeBuilder.addCapacityDimension(index, value);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -432,12 +432,12 @@ public class VrpReaderV2Test {
|
|||
new VrpXMLReader(builder, null).read(inFileName);
|
||||
VehicleRoutingProblem vrp = builder.build();
|
||||
Vehicle v = getVehicle("v5",vrp.getVehicles());
|
||||
// assertEquals(100, v.getType().getCapacityDimensions().get(0));
|
||||
assertEquals(100, v.getType().getCapacityDimensions().get(0));
|
||||
assertEquals(1000, v.getType().getCapacityDimensions().get(1));
|
||||
// assertEquals(10000, v.getType().getCapacityDimensions().get(2));
|
||||
// assertEquals(0, v.getType().getCapacityDimensions().get(3));
|
||||
// assertEquals(0, v.getType().getCapacityDimensions().get(5));
|
||||
// assertEquals(100000, v.getType().getCapacityDimensions().get(10));
|
||||
assertEquals(10000, v.getType().getCapacityDimensions().get(2));
|
||||
assertEquals(0, v.getType().getCapacityDimensions().get(3));
|
||||
assertEquals(0, v.getType().getCapacityDimensions().get(5));
|
||||
assertEquals(100000, v.getType().getCapacityDimensions().get(10));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue