mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
bugfix issue #79
This commit is contained in:
parent
8f749c9fdf
commit
d50ce05a76
3 changed files with 28 additions and 3 deletions
|
|
@ -334,6 +334,10 @@ public class VrpXMLReader{
|
||||||
builder.setPickupLocation(pickupCoord.toString());
|
builder.setPickupLocation(pickupCoord.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//pickup-serviceTime
|
||||||
|
String pickupServiceTime = shipmentConfig.getString("pickup.duration");
|
||||||
|
if(pickupServiceTime != null) builder.setPickupServiceTime(Double.parseDouble(pickupServiceTime));
|
||||||
|
|
||||||
//pickup-tw
|
//pickup-tw
|
||||||
String pickupTWStart = shipmentConfig.getString("pickup.timeWindows.timeWindow(0).start");
|
String pickupTWStart = shipmentConfig.getString("pickup.timeWindows.timeWindow(0).start");
|
||||||
String pickupTWEnd = shipmentConfig.getString("pickup.timeWindows.timeWindow(0).end");
|
String pickupTWEnd = shipmentConfig.getString("pickup.timeWindows.timeWindow(0).end");
|
||||||
|
|
@ -343,7 +347,7 @@ public class VrpXMLReader{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//delivery-locaitonId
|
//delivery-locationId
|
||||||
String deliveryLocationId = shipmentConfig.getString("delivery.locationId");
|
String deliveryLocationId = shipmentConfig.getString("delivery.locationId");
|
||||||
if(deliveryLocationId != null){
|
if(deliveryLocationId != null){
|
||||||
builder.setDeliveryLocation(deliveryLocationId);
|
builder.setDeliveryLocation(deliveryLocationId);
|
||||||
|
|
@ -361,7 +365,11 @@ public class VrpXMLReader{
|
||||||
builder.setDeliveryLocation(deliveryCoord.toString());
|
builder.setDeliveryLocation(deliveryCoord.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//delivery-serviceTime
|
||||||
|
String deliveryServiceTime = shipmentConfig.getString("delivery.duration");
|
||||||
|
if(deliveryServiceTime != null) builder.setDeliveryServiceTime(Double.parseDouble(deliveryServiceTime));
|
||||||
|
|
||||||
|
//delivery-tw
|
||||||
String delTWStart = shipmentConfig.getString("delivery.timeWindows.timeWindow(0).start");
|
String delTWStart = shipmentConfig.getString("delivery.timeWindows.timeWindow(0).start");
|
||||||
String delTWEnd = shipmentConfig.getString("delivery.timeWindows.timeWindow(0).end");
|
String delTWEnd = shipmentConfig.getString("delivery.timeWindows.timeWindow(0).end");
|
||||||
if(delTWStart != null && delTWEnd != null){
|
if(delTWStart != null && delTWEnd != null){
|
||||||
|
|
|
||||||
|
|
@ -221,7 +221,7 @@ public class VrpReaderV2Test {
|
||||||
new VrpXMLReader(builder, null).read(inFileName);
|
new VrpXMLReader(builder, null).read(inFileName);
|
||||||
VehicleRoutingProblem vrp = builder.build();
|
VehicleRoutingProblem vrp = builder.build();
|
||||||
Shipment s = (Shipment) vrp.getJobs().get("3");
|
Shipment s = (Shipment) vrp.getJobs().get("3");
|
||||||
assertEquals(100.0,s.getPickupServiceTime(),0.01);
|
assertEquals(100.0,s.getDeliveryServiceTime(),0.01);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -280,4 +280,22 @@ public class VrpReaderV2Test {
|
||||||
assertEquals("[x=10.0][y=0.0]",s.getDeliveryLocation());
|
assertEquals("[x=10.0][y=0.0]",s.getDeliveryLocation());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenReadingJobs_pickupServiceTimeOfShipment4IsReadCorrectly(){
|
||||||
|
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
|
new VrpXMLReader(builder, null).read(inFileName);
|
||||||
|
VehicleRoutingProblem vrp = builder.build();
|
||||||
|
Shipment s = (Shipment) vrp.getJobs().get("4");
|
||||||
|
assertEquals(0.0,s.getPickupServiceTime(),0.01);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenReadingJobs_deliveryServiceTimeOfShipment4IsReadCorrectly(){
|
||||||
|
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
|
||||||
|
new VrpXMLReader(builder, null).read(inFileName);
|
||||||
|
VehicleRoutingProblem vrp = builder.build();
|
||||||
|
Shipment s = (Shipment) vrp.getJobs().get("4");
|
||||||
|
assertEquals(100.0,s.getDeliveryServiceTime(),0.01);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,6 @@
|
||||||
<shipment id="4">
|
<shipment id="4">
|
||||||
<pickup>
|
<pickup>
|
||||||
<coord x="10.0" y="10.0"/>
|
<coord x="10.0" y="10.0"/>
|
||||||
<duration>10.0</duration>
|
|
||||||
<timeWindows>
|
<timeWindows>
|
||||||
<timeWindow>
|
<timeWindow>
|
||||||
<start>1000.0</start>
|
<start>1000.0</start>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue