From e0b86f972388396f5c33b03ed21ca85d42012f0e Mon Sep 17 00:00:00 2001
From: oblonski <4sschroeder@gmail.com>
Date: Thu, 25 Sep 2014 10:27:44 +0200
Subject: [PATCH] add tests to reproduce bug #134
---
.../BuildCVRPAlgoFromScratch_IT.java | 12 +-
.../core/algorithm/CVRPwithDeliveries_IT.java | 43 ++
.../core/algorithm/CVRPwithPickups_IT.java | 43 ++
.../core/algorithm/RefuseCollection_IT.java | 235 +++++--
.../algorithm/state/StateManagerTest.java | 63 +-
.../vrpnc1-jsprit-with-deliveries.xml | 652 ++++++++++++++++++
.../resources/vrpnc1-jsprit-with-pickups.xml | 652 ++++++++++++++++++
7 files changed, 1640 insertions(+), 60 deletions(-)
create mode 100644 jsprit-core/src/test/java/jsprit/core/algorithm/CVRPwithDeliveries_IT.java
create mode 100644 jsprit-core/src/test/java/jsprit/core/algorithm/CVRPwithPickups_IT.java
create mode 100644 jsprit-core/src/test/resources/vrpnc1-jsprit-with-deliveries.xml
create mode 100644 jsprit-core/src/test/resources/vrpnc1-jsprit-with-pickups.xml
diff --git a/jsprit-core/src/test/java/jsprit/core/algorithm/BuildCVRPAlgoFromScratch_IT.java b/jsprit-core/src/test/java/jsprit/core/algorithm/BuildCVRPAlgoFromScratch_IT.java
index 4301369e..edb34874 100644
--- a/jsprit-core/src/test/java/jsprit/core/algorithm/BuildCVRPAlgoFromScratch_IT.java
+++ b/jsprit-core/src/test/java/jsprit/core/algorithm/BuildCVRPAlgoFromScratch_IT.java
@@ -1,16 +1,16 @@
/*******************************************************************************
- * Copyright (C) 2013 Stefan Schroeder
- *
+ * Copyright (C) 2014 Stefan Schroeder
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
+ * License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see .
******************************************************************************/
@@ -107,7 +107,7 @@ public class BuildCVRPAlgoFromScratch_IT {
vra.addInitialSolution(iniSolution);
- vra.setNuOfIterations(2000);
+ vra.setMaxIterations(2000);
}
diff --git a/jsprit-core/src/test/java/jsprit/core/algorithm/CVRPwithDeliveries_IT.java b/jsprit-core/src/test/java/jsprit/core/algorithm/CVRPwithDeliveries_IT.java
new file mode 100644
index 00000000..7172b04c
--- /dev/null
+++ b/jsprit-core/src/test/java/jsprit/core/algorithm/CVRPwithDeliveries_IT.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (C) 2014 Stefan Schroeder
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3.0 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see .
+ ******************************************************************************/
+package jsprit.core.algorithm;
+
+import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
+import jsprit.core.problem.VehicleRoutingProblem;
+import jsprit.core.problem.io.VrpXMLReader;
+import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
+import jsprit.core.util.Solutions;
+import org.junit.Test;
+
+import java.util.Collection;
+
+import static org.junit.Assert.assertEquals;
+
+public class CVRPwithDeliveries_IT {
+
+ @Test
+ public void whenSolvingVRPNC1withDeliveries_solutionsMustNoBeWorseThan5PercentOfBestKnownSolution(){
+ VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
+ new VrpXMLReader(vrpBuilder).read("src/test/resources/vrpnc1-jsprit-with-deliveries.xml");
+ VehicleRoutingProblem vrp = vrpBuilder.build();
+ VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfig.xml");
+ Collection solutions = vra.searchSolutions();
+ assertEquals(530.0, Solutions.bestOf(solutions).getCost(),50.0);
+ assertEquals(5, Solutions.bestOf(solutions).getRoutes().size());
+ }
+
+}
diff --git a/jsprit-core/src/test/java/jsprit/core/algorithm/CVRPwithPickups_IT.java b/jsprit-core/src/test/java/jsprit/core/algorithm/CVRPwithPickups_IT.java
new file mode 100644
index 00000000..c5ef22f9
--- /dev/null
+++ b/jsprit-core/src/test/java/jsprit/core/algorithm/CVRPwithPickups_IT.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (C) 2014 Stefan Schroeder
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3.0 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see .
+ ******************************************************************************/
+package jsprit.core.algorithm;
+
+import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
+import jsprit.core.problem.VehicleRoutingProblem;
+import jsprit.core.problem.io.VrpXMLReader;
+import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
+import jsprit.core.util.Solutions;
+import org.junit.Test;
+
+import java.util.Collection;
+
+import static org.junit.Assert.assertEquals;
+
+public class CVRPwithPickups_IT {
+
+ @Test
+ public void whenSolvingVRPNC1WithPickups_solutionsMustNoBeWorseThan5PercentOfBestKnownSolution(){
+ VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
+ new VrpXMLReader(vrpBuilder).read("src/test/resources/vrpnc1-jsprit-with-pickups.xml");
+ VehicleRoutingProblem vrp = vrpBuilder.build();
+ VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfig.xml");
+ Collection solutions = vra.searchSolutions();
+ assertEquals(530.0, Solutions.bestOf(solutions).getCost(),50.0);
+ assertEquals(5, Solutions.bestOf(solutions).getRoutes().size());
+ }
+
+}
diff --git a/jsprit-core/src/test/java/jsprit/core/algorithm/RefuseCollection_IT.java b/jsprit-core/src/test/java/jsprit/core/algorithm/RefuseCollection_IT.java
index 603a8b04..eda30af9 100644
--- a/jsprit-core/src/test/java/jsprit/core/algorithm/RefuseCollection_IT.java
+++ b/jsprit-core/src/test/java/jsprit/core/algorithm/RefuseCollection_IT.java
@@ -1,37 +1,29 @@
/*******************************************************************************
- * Copyright (C) 2013 Stefan Schroeder
- *
+ * Copyright (C) 2014 Stefan Schroeder
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
+ * License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see .
******************************************************************************/
package jsprit.core.algorithm;
-import static org.junit.Assert.assertEquals;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Map;
-
import jsprit.core.algorithm.box.SchrimpfFactory;
import jsprit.core.algorithm.termination.IterationWithoutImprovementTermination;
import jsprit.core.problem.VehicleRoutingProblem;
import jsprit.core.problem.VehicleRoutingProblem.FleetSize;
import jsprit.core.problem.cost.VehicleRoutingTransportCosts;
import jsprit.core.problem.driver.Driver;
+import jsprit.core.problem.job.Delivery;
+import jsprit.core.problem.job.Pickup;
import jsprit.core.problem.job.Service;
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
import jsprit.core.problem.vehicle.Vehicle;
@@ -42,9 +34,14 @@ import jsprit.core.reporting.SolutionPrinter.Print;
import jsprit.core.util.Solutions;
import jsprit.core.util.VehicleRoutingTransportCostsMatrix;
import jsprit.core.util.VehicleRoutingTransportCostsMatrix.Builder;
-
import org.junit.Test;
+import java.io.*;
+import java.util.Collection;
+import java.util.Map;
+
+import static org.junit.Assert.assertEquals;
+
public class RefuseCollection_IT {
@@ -144,9 +141,8 @@ public class RefuseCollection_IT {
@Test
- public void testAlgo(){
-
-
+ public void whenReadingServices_itShouldCalculateCorrectly(){
+
/*
* create vehicle-type and vehicle
*/
@@ -157,7 +153,7 @@ public class RefuseCollection_IT {
VehicleImpl.Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
vehicleBuilder.setStartLocationId("1");
vehicleBuilder.setType(bigType);
- Vehicle bigVehicle = vehicleBuilder.build();
+ VehicleImpl bigVehicle = vehicleBuilder.build();
/*
* start building the problem
@@ -173,18 +169,10 @@ public class RefuseCollection_IT {
/*
* read demand quantities
*/
- try {
- readDemandQuantities(vrpBuilder);
- readDistances(matrixBuilder);
- } catch (FileNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- vrpBuilder.setRoutingCost(matrixBuilder.build());
+ readDemandQuantitiesAsServices(vrpBuilder);
+ readDistances(matrixBuilder);
+
+ vrpBuilder.setRoutingCost(matrixBuilder.build());
VehicleRoutingProblem vrp = vrpBuilder.build();
VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp);
vra.setPrematureAlgorithmTermination(new IterationWithoutImprovementTermination(100));
@@ -196,12 +184,100 @@ public class RefuseCollection_IT {
assertEquals(2,Solutions.bestOf(solutions).getRoutes().size());
}
+ @Test
+ public void whenReadingPickups_itShouldCalculateCorrectly(){
- private static void readDemandQuantities(VehicleRoutingProblem.Builder vrpBuilder) throws FileNotFoundException, IOException {
- BufferedReader reader = new BufferedReader(new FileReader(new File("src/test/resources/refuseCollectionExample_Quantities")));
- String line = null;
+ /*
+ * create vehicle-type and vehicle
+ */
+ VehicleTypeImpl.Builder typeBuilder = VehicleTypeImpl.Builder.newInstance("vehicle-type").addCapacityDimension(0, 23);
+ typeBuilder.setCostPerDistance(1.0);
+ VehicleTypeImpl bigType = typeBuilder.build();
+
+ VehicleImpl.Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
+ vehicleBuilder.setStartLocationId("1");
+ vehicleBuilder.setType(bigType);
+ VehicleImpl bigVehicle = vehicleBuilder.build();
+
+ /*
+ * start building the problem
+ */
+ VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
+ vrpBuilder.setFleetSize(FleetSize.INFINITE);
+ vrpBuilder.addVehicle(bigVehicle);
+
+ /*
+ * create cost-matrix
+ */
+ VehicleRoutingTransportCostsMatrix.Builder matrixBuilder = VehicleRoutingTransportCostsMatrix.Builder.newInstance(true);
+ /*
+ * read demand quantities
+ */
+ readDemandQuantitiesAsPickups(vrpBuilder);
+ readDistances(matrixBuilder);
+
+ vrpBuilder.setRoutingCost(matrixBuilder.build());
+ VehicleRoutingProblem vrp = vrpBuilder.build();
+ VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp);
+ vra.setPrematureAlgorithmTermination(new IterationWithoutImprovementTermination(100));
+ Collection solutions = vra.searchSolutions();
+
+ SolutionPrinter.print(vrp, Solutions.bestOf(solutions), Print.VERBOSE);
+
+ assertEquals(397.0,Solutions.bestOf(solutions).getCost(),40.);
+ assertEquals(2,Solutions.bestOf(solutions).getRoutes().size());
+ }
+
+ @Test
+ public void whenReadingDeliveries_itShouldCalculateCorrectly(){
+
+ /*
+ * create vehicle-type and vehicle
+ */
+ VehicleTypeImpl.Builder typeBuilder = VehicleTypeImpl.Builder.newInstance("vehicle-type").addCapacityDimension(0, 23);
+ typeBuilder.setCostPerDistance(1.0);
+ VehicleTypeImpl bigType = typeBuilder.build();
+
+ VehicleImpl.Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
+ vehicleBuilder.setStartLocationId("1");
+ vehicleBuilder.setType(bigType);
+ VehicleImpl bigVehicle = vehicleBuilder.build();
+
+ /*
+ * start building the problem
+ */
+ VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
+ vrpBuilder.setFleetSize(FleetSize.INFINITE);
+ vrpBuilder.addVehicle(bigVehicle);
+
+ /*
+ * create cost-matrix
+ */
+ VehicleRoutingTransportCostsMatrix.Builder matrixBuilder = VehicleRoutingTransportCostsMatrix.Builder.newInstance(true);
+ /*
+ * read demand quantities
+ */
+ readDemandQuantitiesAsDeliveries(vrpBuilder);
+ readDistances(matrixBuilder);
+
+ vrpBuilder.setRoutingCost(matrixBuilder.build());
+ VehicleRoutingProblem vrp = vrpBuilder.build();
+ VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp);
+ vra.setPrematureAlgorithmTermination(new IterationWithoutImprovementTermination(100));
+ Collection solutions = vra.searchSolutions();
+
+ SolutionPrinter.print(vrp, Solutions.bestOf(solutions), Print.VERBOSE);
+
+ assertEquals(397.0,Solutions.bestOf(solutions).getCost(),40.);
+ assertEquals(2,Solutions.bestOf(solutions).getRoutes().size());
+ }
+
+
+ private static void readDemandQuantitiesAsServices(VehicleRoutingProblem.Builder vrpBuilder) {
+ BufferedReader reader = getBufferedReader("src/test/resources/refuseCollectionExample_Quantities");
+ String line;
boolean firstLine = true;
- while((line = reader.readLine()) != null){
+ while((line = readLine(reader)) != null){
if(firstLine) {
firstLine = false;
continue;
@@ -216,15 +292,87 @@ public class RefuseCollection_IT {
*/
vrpBuilder.addJob(service);
}
- reader.close();
+ close(reader);
}
+
+ private static BufferedReader getBufferedReader(String s) {
+ BufferedReader reader = null;
+ try {
+ reader = new BufferedReader(new FileReader(new File(s)));
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ }
+ return reader;
+ }
+
+ private static void readDemandQuantitiesAsPickups(VehicleRoutingProblem.Builder vrpBuilder) {
+ BufferedReader reader = getBufferedReader("src/test/resources/refuseCollectionExample_Quantities");
+ String line;
+ boolean firstLine = true;
+ while((line = readLine(reader)) != null){
+ if(firstLine) {
+ firstLine = false;
+ continue;
+ }
+ String[] lineTokens = line.split(",");
+ /*
+ * build service
+ */
+ Pickup service = (Pickup) Pickup.Builder.newInstance(lineTokens[0]).addSizeDimension(0, Integer.parseInt(lineTokens[1])).setLocationId(lineTokens[0]).build();
+ /*
+ * and add it to problem
+ */
+ vrpBuilder.addJob(service);
+ }
+ close(reader);
+ }
+
+ private static void readDemandQuantitiesAsDeliveries(VehicleRoutingProblem.Builder vrpBuilder) {
+ BufferedReader reader = getBufferedReader("src/test/resources/refuseCollectionExample_Quantities");
+ String line;
+ boolean firstLine = true;
+ while((line = readLine(reader)) != null){
+ if(firstLine) {
+ firstLine = false;
+ continue;
+ }
+ String[] lineTokens = line.split(",");
+ /*
+ * build service
+ */
+ Delivery service = (Delivery) Delivery.Builder.newInstance(lineTokens[0]).addSizeDimension(0, Integer.parseInt(lineTokens[1])).setLocationId(lineTokens[0]).build();
+ /*
+ * and add it to problem
+ */
+ vrpBuilder.addJob(service);
+ }
+ close(reader);
+ }
+
+ private static String readLine(BufferedReader reader){
+ String line = null;
+ try {
+ line = reader.readLine();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return line;
+ }
+
+ private static void close(Reader reader){
+ try {
+ reader.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
- private static void readDistances(Builder matrixBuilder) throws IOException {
- BufferedReader reader = new BufferedReader(new FileReader(new File("src/test/resources/refuseCollectionExample_Distances")));
- String line = null;
+ private static void readDistances(Builder matrixBuilder) {
+ BufferedReader reader = getBufferedReader("src/test/resources/refuseCollectionExample_Distances");
+ String line;
boolean firstLine = true;
- while((line = reader.readLine()) != null){
+ while((line = readLine(reader)) != null){
if(firstLine) {
firstLine = false;
continue;
@@ -233,9 +381,8 @@ public class RefuseCollection_IT {
matrixBuilder.addTransportDistance(lineTokens[0],lineTokens[1], Integer.parseInt(lineTokens[2]));
matrixBuilder.addTransportTime(lineTokens[0],lineTokens[1], Integer.parseInt(lineTokens[2]));
}
- reader.close();
-
- }
+ close(reader);
+ }
}
diff --git a/jsprit-core/src/test/java/jsprit/core/algorithm/state/StateManagerTest.java b/jsprit-core/src/test/java/jsprit/core/algorithm/state/StateManagerTest.java
index bac4f966..0eec1874 100644
--- a/jsprit-core/src/test/java/jsprit/core/algorithm/state/StateManagerTest.java
+++ b/jsprit-core/src/test/java/jsprit/core/algorithm/state/StateManagerTest.java
@@ -1,20 +1,18 @@
/*******************************************************************************
- * Copyright (c) 2014 Stefan Schroeder.
- *
+ * Copyright (C) 2014 Stefan Schroeder
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
+ * License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see .
- *
- * Contributors:
- * Stefan Schroeder - initial API and implementation
******************************************************************************/
package jsprit.core.algorithm.state;
@@ -58,6 +56,51 @@ public class StateManagerTest {
return VehicleRoute.Builder.newInstance(vehicle).setJobActivityFactory(new ActFac()).addService(Service.Builder.newInstance("s").setLocationId("loc").build()).build();
}
+
+ @Test
+ public void whenInternalRouteStateIsSet_itMustBeSetCorrectly(){
+ VehicleRoute route = getRoute(mock(Vehicle.class));
+ StateManager stateManager = new StateManager(mock(VehicleRoutingProblem.class));
+ StateId id = InternalStates.COSTS;
+ stateManager.putTypedInternalRouteState(route, id, 10.);
+ assertEquals(10., stateManager.getRouteState(route, id, Double.class), 0.01);
+ }
+
+ @Test
+ public void whenInternalRouteStateIsNotSet_itShouldReturnNull(){
+ VehicleRoute route = getRoute(mock(Vehicle.class));
+ StateManager stateManager = new StateManager(mock(VehicleRoutingProblem.class));
+ StateId id = InternalStates.COSTS;
+ Double costs = stateManager.getRouteState(route, id, Double.class);
+ assertTrue(costs == null);
+ }
+
+ @Test
+ public void whenVehicleDependentInternalRouteStateIsSet_itMustBeSetCorrectly(){
+ VehicleImpl vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("loc").build();
+ //noinspection UnusedDeclaration
+ VehicleRoutingProblem vrp = VehicleRoutingProblem.Builder.newInstance().addVehicle(vehicle).build();
+
+ VehicleRoute route = getRoute(vehicle);
+ StateManager stateManager = new StateManager(mock(VehicleRoutingProblem.class));
+ StateId id = InternalStates.COSTS;
+ stateManager.putTypedInternalRouteState(route, vehicle, id, 10.);
+ assertEquals(10.,stateManager.getRouteState(route, vehicle, id, Double.class),0.01);
+ }
+
+ @Test
+ public void whenVehicleDependentInternalRouteStateIsNotSet_itMustBeSetCorrectly(){
+ VehicleImpl vehicle = VehicleImpl.Builder.newInstance("v").setStartLocationId("loc").build();
+ //noinspection UnusedDeclaration
+ VehicleRoutingProblem vrp = VehicleRoutingProblem.Builder.newInstance().addVehicle(vehicle).build();
+
+ VehicleRoute route = getRoute(vehicle);
+ StateManager stateManager = new StateManager(mock(VehicleRoutingProblem.class));
+ StateId id = InternalStates.COSTS;
+ Double costs = stateManager.getRouteState(route, vehicle, id, Double.class);
+ assertTrue(costs == null);
+ }
+
@Test
public void whenRouteStateIsSetWithGenericMethodAndBoolean_itMustBeSetCorrectly(){
VehicleRoute route = getRoute(mock(Vehicle.class));
diff --git a/jsprit-core/src/test/resources/vrpnc1-jsprit-with-deliveries.xml b/jsprit-core/src/test/resources/vrpnc1-jsprit-with-deliveries.xml
new file mode 100644
index 00000000..1b617120
--- /dev/null
+++ b/jsprit-core/src/test/resources/vrpnc1-jsprit-with-deliveries.xml
@@ -0,0 +1,652 @@
+
+
+
+
+
+ INFINITE
+ HOMOGENEOUS
+
+
+
+ christophidesVehicle
+ christophidesType
+
+ [x=30.0][y=40.0]
+
+
+
+ 0.0
+ 999999.0
+
+
+
+
+
+ christophidesType
+ 160
+
+ 0.0
+ 1.0
+
+
+
+
+
+
+ [x=62.0][y=63.0]
+
+ 17
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=63.0][y=69.0]
+
+ 6
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=46.0][y=10.0]
+
+ 23
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=61.0][y=33.0]
+
+ 26
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=59.0][y=15.0]
+
+ 14
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=32.0][y=22.0]
+
+ 9
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=45.0][y=35.0]
+
+ 15
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=5.0][y=64.0]
+
+ 11
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=21.0][y=10.0]
+
+ 13
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=10.0][y=17.0]
+
+ 27
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=5.0][y=6.0]
+
+ 7
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=42.0][y=57.0]
+
+ 8
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=16.0][y=57.0]
+
+ 16
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=8.0][y=52.0]
+
+ 10
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=7.0][y=38.0]
+
+ 28
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=27.0][y=68.0]
+
+ 7
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=30.0][y=48.0]
+
+ 15
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=43.0][y=67.0]
+
+ 14
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=58.0][y=48.0]
+
+ 6
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=52.0][y=64.0]
+
+ 16
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=49.0][y=49.0]
+
+ 30
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=37.0][y=52.0]
+
+ 7
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=17.0][y=63.0]
+
+ 19
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=58.0][y=27.0]
+
+ 19
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=21.0][y=47.0]
+
+ 15
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=40.0][y=30.0]
+
+ 21
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=38.0][y=46.0]
+
+ 12
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=20.0][y=26.0]
+
+ 9
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=37.0][y=69.0]
+
+ 11
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=52.0][y=33.0]
+
+ 11
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=31.0][y=62.0]
+
+ 23
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=13.0][y=13.0]
+
+ 9
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=27.0][y=23.0]
+
+ 3
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=17.0][y=33.0]
+
+ 41
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=36.0][y=16.0]
+
+ 10
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=52.0][y=41.0]
+
+ 15
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=5.0][y=25.0]
+
+ 23
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=12.0][y=42.0]
+
+ 21
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=42.0][y=41.0]
+
+ 19
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=31.0][y=32.0]
+
+ 29
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=62.0][y=42.0]
+
+ 8
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=57.0][y=58.0]
+
+ 28
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=48.0][y=28.0]
+
+ 18
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=25.0][y=55.0]
+
+ 17
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=39.0][y=10.0]
+
+ 10
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=30.0][y=15.0]
+
+ 16
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=25.0][y=32.0]
+
+ 25
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=32.0][y=39.0]
+
+ 5
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=51.0][y=21.0]
+
+ 5
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=56.0][y=37.0]
+
+ 10
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+
diff --git a/jsprit-core/src/test/resources/vrpnc1-jsprit-with-pickups.xml b/jsprit-core/src/test/resources/vrpnc1-jsprit-with-pickups.xml
new file mode 100644
index 00000000..b03b1b51
--- /dev/null
+++ b/jsprit-core/src/test/resources/vrpnc1-jsprit-with-pickups.xml
@@ -0,0 +1,652 @@
+
+
+
+
+
+ INFINITE
+ HOMOGENEOUS
+
+
+
+ christophidesVehicle
+ christophidesType
+
+ [x=30.0][y=40.0]
+
+
+
+ 0.0
+ 999999.0
+
+
+
+
+
+ christophidesType
+ 160
+
+ 0.0
+ 1.0
+
+
+
+
+
+
+ [x=62.0][y=63.0]
+
+ 17
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=63.0][y=69.0]
+
+ 6
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=46.0][y=10.0]
+
+ 23
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=61.0][y=33.0]
+
+ 26
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=59.0][y=15.0]
+
+ 14
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=32.0][y=22.0]
+
+ 9
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=45.0][y=35.0]
+
+ 15
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=5.0][y=64.0]
+
+ 11
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=21.0][y=10.0]
+
+ 13
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=10.0][y=17.0]
+
+ 27
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=5.0][y=6.0]
+
+ 7
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=42.0][y=57.0]
+
+ 8
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=16.0][y=57.0]
+
+ 16
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=8.0][y=52.0]
+
+ 10
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=7.0][y=38.0]
+
+ 28
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=27.0][y=68.0]
+
+ 7
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=30.0][y=48.0]
+
+ 15
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=43.0][y=67.0]
+
+ 14
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=58.0][y=48.0]
+
+ 6
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=52.0][y=64.0]
+
+ 16
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=49.0][y=49.0]
+
+ 30
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=37.0][y=52.0]
+
+ 7
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=17.0][y=63.0]
+
+ 19
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=58.0][y=27.0]
+
+ 19
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=21.0][y=47.0]
+
+ 15
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=40.0][y=30.0]
+
+ 21
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=38.0][y=46.0]
+
+ 12
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=20.0][y=26.0]
+
+ 9
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=37.0][y=69.0]
+
+ 11
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=52.0][y=33.0]
+
+ 11
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=31.0][y=62.0]
+
+ 23
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=13.0][y=13.0]
+
+ 9
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=27.0][y=23.0]
+
+ 3
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=17.0][y=33.0]
+
+ 41
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=36.0][y=16.0]
+
+ 10
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=52.0][y=41.0]
+
+ 15
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=5.0][y=25.0]
+
+ 23
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=12.0][y=42.0]
+
+ 21
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=42.0][y=41.0]
+
+ 19
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=31.0][y=32.0]
+
+ 29
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=62.0][y=42.0]
+
+ 8
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=57.0][y=58.0]
+
+ 28
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=48.0][y=28.0]
+
+ 18
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=25.0][y=55.0]
+
+ 17
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=39.0][y=10.0]
+
+ 10
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=30.0][y=15.0]
+
+ 16
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=25.0][y=32.0]
+
+ 25
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=32.0][y=39.0]
+
+ 5
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=51.0][y=21.0]
+
+ 5
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+ [x=56.0][y=37.0]
+
+ 10
+ 0.0
+
+
+ 0.0
+ 1.7976931348623157E308
+
+
+
+
+