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

clean up test resources

This commit is contained in:
oblonski 2016-07-27 12:51:39 +02:00
parent 21aac20c77
commit 2d801b5ec4
25 changed files with 3447 additions and 145 deletions

40
jsprit-io/pom.xml Normal file
View file

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>jsprit</artifactId>
<groupId>jsprit</groupId>
<version>1.6.3-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jsprit-io</artifactId>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>jsprit-core</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>1.9</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.11.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View file

@ -60,16 +60,16 @@ public class TestAlgorithmReader {
@Before @Before
public void doBefore() throws ConfigurationException { public void doBefore() throws ConfigurationException {
config = new AlgorithmConfig(); config = new AlgorithmConfig();
new AlgorithmConfigXmlReader(config).setSchemaValidation(false).read("src/test/resources/testConfig.xml"); new AlgorithmConfigXmlReader(config).setSchemaValidation(false).read(getClass().getResource("testConfig.xml"));
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
solutions = new ArrayList<VehicleRoutingProblemSolution>(); solutions = new ArrayList<VehicleRoutingProblemSolution>();
new VrpXMLReader(vrpBuilder, solutions).read("src/test/resources/finiteVrp.xml"); new VrpXMLReader(vrpBuilder, solutions).read(getClass().getResourceAsStream("finiteVrp.xml"));
vrp = vrpBuilder.build(); vrp = vrpBuilder.build();
} }
@Test @Test
public void itShouldReadMaxIterations() { public void itShouldReadMaxIterations() {
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfigForReaderTest.xml"); VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, getClass().getResource("algorithmConfigForReaderTest.xml"));
Assert.assertEquals(2000, vra.getMaxIterations()); Assert.assertEquals(2000, vra.getMaxIterations());
} }
@ -86,7 +86,7 @@ public class TestAlgorithmReader {
@Test @Test
public void whenSettingPrematureBreak_itShouldReadTermination() { public void whenSettingPrematureBreak_itShouldReadTermination() {
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfigForReaderTest2.xml"); VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, getClass().getResource("algorithmConfigForReaderTest2.xml"));
IterationCounter iCounter = new IterationCounter(); IterationCounter iCounter = new IterationCounter();
vra.addListener(iCounter); vra.addListener(iCounter);
vra.searchSolutions(); vra.searchSolutions();
@ -95,7 +95,7 @@ public class TestAlgorithmReader {
@Test @Test
public void itShouldReadTermination() { public void itShouldReadTermination() {
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "src/test/resources/algorithmConfigForReaderTest.xml"); VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, getClass().getResource("algorithmConfigForReaderTest.xml"));
IterationCounter iCounter = new IterationCounter(); IterationCounter iCounter = new IterationCounter();
vra.addListener(iCounter); vra.addListener(iCounter);
vra.searchSolutions(); vra.searchSolutions();
@ -271,14 +271,14 @@ public class TestAlgorithmReader {
@Test @Test
public void readerTest_whenReadingAlgoWithSchemaValidation_itReadsCorrectly() { public void readerTest_whenReadingAlgoWithSchemaValidation_itReadsCorrectly() {
AlgorithmConfig algoConfig = new AlgorithmConfig(); AlgorithmConfig algoConfig = new AlgorithmConfig();
new AlgorithmConfigXmlReader(algoConfig).read("src/test/resources/algorithmConfig.xml"); new AlgorithmConfigXmlReader(algoConfig).read(getClass().getResource("algorithmConfig.xml"));
} }
@Test @Test
public void readerTest_whenReadingAlgoWithSchemaValidationWithoutIterations_itReadsCorrectly() { public void readerTest_whenReadingAlgoWithSchemaValidationWithoutIterations_itReadsCorrectly() {
AlgorithmConfig algoConfig = new AlgorithmConfig(); AlgorithmConfig algoConfig = new AlgorithmConfig();
new AlgorithmConfigXmlReader(algoConfig).read("src/test/resources/algorithmConfig_withoutIterations.xml"); new AlgorithmConfigXmlReader(algoConfig).read(getClass().getResource("algorithmConfig_withoutIterations.xml"));
} }

View file

@ -37,7 +37,7 @@ public class InitialRoutesTest {
public void whenReading_jobMapShouldOnlyContainJob2() { public void whenReading_jobMapShouldOnlyContainJob2() {
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem_iniRoutes.xml"); new VrpXMLReader(vrpBuilder).read(getClass().getResourceAsStream("simpleProblem_iniRoutes.xml"));
VehicleRoutingProblem vrp = vrpBuilder.build(); VehicleRoutingProblem vrp = vrpBuilder.build();
assertEquals(1, getNuServices(vrp)); assertEquals(1, getNuServices(vrp));
@ -48,7 +48,7 @@ public class InitialRoutesTest {
public void whenReadingProblem2_jobMapShouldContain_service2() { public void whenReadingProblem2_jobMapShouldContain_service2() {
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem_inclShipments_iniRoutes.xml"); new VrpXMLReader(vrpBuilder).read(getClass().getResourceAsStream("simpleProblem_inclShipments_iniRoutes.xml"));
VehicleRoutingProblem vrp = vrpBuilder.build(); VehicleRoutingProblem vrp = vrpBuilder.build();
assertEquals(1, getNuServices(vrp)); assertEquals(1, getNuServices(vrp));
@ -59,7 +59,7 @@ public class InitialRoutesTest {
public void whenReading_jobMapShouldContain_shipment4() { public void whenReading_jobMapShouldContain_shipment4() {
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem_inclShipments_iniRoutes.xml"); new VrpXMLReader(vrpBuilder).read(getClass().getResourceAsStream("simpleProblem_inclShipments_iniRoutes.xml"));
VehicleRoutingProblem vrp = vrpBuilder.build(); VehicleRoutingProblem vrp = vrpBuilder.build();
assertEquals(1, getNuShipments(vrp)); assertEquals(1, getNuShipments(vrp));
@ -86,7 +86,7 @@ public class InitialRoutesTest {
public void whenReading_thereShouldBeOnlyOneActAssociatedToJob2() { public void whenReading_thereShouldBeOnlyOneActAssociatedToJob2() {
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem_iniRoutes.xml"); new VrpXMLReader(vrpBuilder).read(getClass().getResourceAsStream("simpleProblem_iniRoutes.xml"));
VehicleRoutingProblem vrp = vrpBuilder.build(); VehicleRoutingProblem vrp = vrpBuilder.build();
assertEquals(1, vrp.getActivities(vrp.getJobs().get("2")).size()); assertEquals(1, vrp.getActivities(vrp.getJobs().get("2")).size());
@ -96,7 +96,7 @@ public class InitialRoutesTest {
public void whenReading_thereShouldBeOnlyOneActAssociatedToJob2_v2() { public void whenReading_thereShouldBeOnlyOneActAssociatedToJob2_v2() {
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem_inclShipments_iniRoutes.xml"); new VrpXMLReader(vrpBuilder).read(getClass().getResourceAsStream("simpleProblem_inclShipments_iniRoutes.xml"));
VehicleRoutingProblem vrp = vrpBuilder.build(); VehicleRoutingProblem vrp = vrpBuilder.build();
assertEquals(1, vrp.getActivities(vrp.getJobs().get("2")).size()); assertEquals(1, vrp.getActivities(vrp.getJobs().get("2")).size());
@ -106,7 +106,7 @@ public class InitialRoutesTest {
public void whenReading_thereShouldBeTwoActsAssociatedToShipment4() { public void whenReading_thereShouldBeTwoActsAssociatedToShipment4() {
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem_inclShipments_iniRoutes.xml"); new VrpXMLReader(vrpBuilder).read(getClass().getResourceAsStream("simpleProblem_inclShipments_iniRoutes.xml"));
VehicleRoutingProblem vrp = vrpBuilder.build(); VehicleRoutingProblem vrp = vrpBuilder.build();
Job job = vrp.getJobs().get("4"); Job job = vrp.getJobs().get("4");

View file

@ -31,6 +31,7 @@ import com.graphhopper.jsprit.core.util.Solutions;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -41,17 +42,17 @@ import static org.junit.Assert.*;
public class VrpXMLReaderTest { public class VrpXMLReaderTest {
private String inFileName; private InputStream inputStream;
@Before @Before
public void doBefore() { public void doBefore() {
inFileName = "src/test/resources/finiteVrpForReaderTest.xml"; inputStream = getClass().getResourceAsStream("finiteVrpForReaderTest.xml");
} }
@Test @Test
public void shouldReadNameOfService() { public void shouldReadNameOfService() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Service s = (Service) vrp.getJobs().get("1"); Service s = (Service) vrp.getJobs().get("1");
assertTrue(s.getName().equals("cleaning")); assertTrue(s.getName().equals("cleaning"));
@ -60,7 +61,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void shouldReadNameOfShipment() { public void shouldReadNameOfShipment() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Shipment s = (Shipment) vrp.getJobs().get("3"); Shipment s = (Shipment) vrp.getJobs().get("3");
assertTrue(s.getName().equals("deliver-smth")); assertTrue(s.getName().equals("deliver-smth"));
@ -69,7 +70,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingVrp_problemTypeIsReadCorrectly() { public void whenReadingVrp_problemTypeIsReadCorrectly() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
assertEquals(FleetSize.FINITE, vrp.getFleetSize()); assertEquals(FleetSize.FINITE, vrp.getFleetSize());
} }
@ -77,7 +78,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingVrp_vehiclesAreReadCorrectly() { public void whenReadingVrp_vehiclesAreReadCorrectly() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
assertEquals(5, vrp.getVehicles().size()); assertEquals(5, vrp.getVehicles().size());
assertTrue(idsInCollection(Arrays.asList("v1", "v2"), vrp.getVehicles())); assertTrue(idsInCollection(Arrays.asList("v1", "v2"), vrp.getVehicles()));
@ -86,7 +87,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingVrp_vehiclesAreReadCorrectly2() { public void whenReadingVrp_vehiclesAreReadCorrectly2() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Vehicle v1 = getVehicle("v1", vrp.getVehicles()); Vehicle v1 = getVehicle("v1", vrp.getVehicles());
assertEquals(20, v1.getType().getCapacityDimensions().get(0)); assertEquals(20, v1.getType().getCapacityDimensions().get(0));
@ -103,7 +104,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingVehicles_skill1ShouldBeAssigned() { public void whenReadingVehicles_skill1ShouldBeAssigned() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Vehicle v1 = getVehicle("v1", vrp.getVehicles()); Vehicle v1 = getVehicle("v1", vrp.getVehicles());
assertTrue(v1.getSkills().containsSkill("skill1")); assertTrue(v1.getSkills().containsSkill("skill1"));
@ -112,7 +113,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingVehicles_skill2ShouldBeAssigned() { public void whenReadingVehicles_skill2ShouldBeAssigned() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Vehicle v1 = getVehicle("v1", vrp.getVehicles()); Vehicle v1 = getVehicle("v1", vrp.getVehicles());
assertTrue(v1.getSkills().containsSkill("skill2")); assertTrue(v1.getSkills().containsSkill("skill2"));
@ -121,7 +122,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingVehicles_nuSkillsShouldBeCorrect() { public void whenReadingVehicles_nuSkillsShouldBeCorrect() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Vehicle v1 = getVehicle("v1", vrp.getVehicles()); Vehicle v1 = getVehicle("v1", vrp.getVehicles());
assertEquals(2, v1.getSkills().values().size()); assertEquals(2, v1.getSkills().values().size());
@ -130,7 +131,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingVehicles_nuSkillsOfV2ShouldBeCorrect() { public void whenReadingVehicles_nuSkillsOfV2ShouldBeCorrect() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Vehicle v = getVehicle("v2", vrp.getVehicles()); Vehicle v = getVehicle("v2", vrp.getVehicles());
assertEquals(0, v.getSkills().values().size()); assertEquals(0, v.getSkills().values().size());
@ -152,7 +153,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingVrp_vehicleTypesAreReadCorrectly() { public void whenReadingVrp_vehicleTypesAreReadCorrectly() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
assertEquals(3, vrp.getTypes().size()); assertEquals(3, vrp.getTypes().size());
} }
@ -160,7 +161,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingVrpWithInfiniteSize_itReadsCorrectly() { public void whenReadingVrpWithInfiniteSize_itReadsCorrectly() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
assertEquals(FleetSize.FINITE, vrp.getFleetSize()); assertEquals(FleetSize.FINITE, vrp.getFleetSize());
} }
@ -168,7 +169,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingJobs_nuOfJobsIsReadThemCorrectly() { public void whenReadingJobs_nuOfJobsIsReadThemCorrectly() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
assertEquals(4, vrp.getJobs().size()); assertEquals(4, vrp.getJobs().size());
} }
@ -176,7 +177,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingServices_itReadsThemCorrectly() { public void whenReadingServices_itReadsThemCorrectly() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
int servCounter = 0; int servCounter = 0;
for (Job j : vrp.getJobs().values()) { for (Job j : vrp.getJobs().values()) {
@ -188,7 +189,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingService1_skill1ShouldBeAssigned() { public void whenReadingService1_skill1ShouldBeAssigned() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Service s = (Service) vrp.getJobs().get("1"); Service s = (Service) vrp.getJobs().get("1");
assertTrue(s.getRequiredSkills().containsSkill("skill1")); assertTrue(s.getRequiredSkills().containsSkill("skill1"));
@ -197,7 +198,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingService1_skill2ShouldBeAssigned() { public void whenReadingService1_skill2ShouldBeAssigned() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Service s = (Service) vrp.getJobs().get("1"); Service s = (Service) vrp.getJobs().get("1");
assertTrue(s.getRequiredSkills().containsSkill("skill2")); assertTrue(s.getRequiredSkills().containsSkill("skill2"));
@ -206,7 +207,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingService1_nuSkillsShouldBeCorrect() { public void whenReadingService1_nuSkillsShouldBeCorrect() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Service s = (Service) vrp.getJobs().get("1"); Service s = (Service) vrp.getJobs().get("1");
assertEquals(2, s.getRequiredSkills().values().size()); assertEquals(2, s.getRequiredSkills().values().size());
@ -215,7 +216,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingService2_nuSkillsOfV2ShouldBeCorrect() { public void whenReadingService2_nuSkillsOfV2ShouldBeCorrect() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Service s = (Service) vrp.getJobs().get("2"); Service s = (Service) vrp.getJobs().get("2");
assertEquals(0, s.getRequiredSkills().values().size()); assertEquals(0, s.getRequiredSkills().values().size());
@ -224,7 +225,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingShipments_itReadsThemCorrectly() { public void whenReadingShipments_itReadsThemCorrectly() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
int shipCounter = 0; int shipCounter = 0;
for (Job j : vrp.getJobs().values()) { for (Job j : vrp.getJobs().values()) {
@ -236,7 +237,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingShipment3_skill1ShouldBeAssigned() { public void whenReadingShipment3_skill1ShouldBeAssigned() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Shipment s = (Shipment) vrp.getJobs().get("3"); Shipment s = (Shipment) vrp.getJobs().get("3");
assertTrue(s.getRequiredSkills().containsSkill("skill1")); assertTrue(s.getRequiredSkills().containsSkill("skill1"));
@ -245,7 +246,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingShipment3_skill2ShouldBeAssigned() { public void whenReadingShipment3_skill2ShouldBeAssigned() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Shipment s = (Shipment) vrp.getJobs().get("3"); Shipment s = (Shipment) vrp.getJobs().get("3");
assertTrue(s.getRequiredSkills().containsSkill("skill2")); assertTrue(s.getRequiredSkills().containsSkill("skill2"));
@ -254,7 +255,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingShipment3_nuSkillsShouldBeCorrect() { public void whenReadingShipment3_nuSkillsShouldBeCorrect() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Shipment s = (Shipment) vrp.getJobs().get("3"); Shipment s = (Shipment) vrp.getJobs().get("3");
assertEquals(2, s.getRequiredSkills().values().size()); assertEquals(2, s.getRequiredSkills().values().size());
@ -263,7 +264,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingShipment4_nuSkillsOfV2ShouldBeCorrect() { public void whenReadingShipment4_nuSkillsOfV2ShouldBeCorrect() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Shipment s = (Shipment) vrp.getJobs().get("4"); Shipment s = (Shipment) vrp.getJobs().get("4");
assertEquals(0, s.getRequiredSkills().values().size()); assertEquals(0, s.getRequiredSkills().values().size());
@ -272,7 +273,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingServices_capOfService1IsReadCorrectly() { public void whenReadingServices_capOfService1IsReadCorrectly() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Service s1 = (Service) vrp.getJobs().get("1"); Service s1 = (Service) vrp.getJobs().get("1");
assertEquals(1, s1.getSize().get(0)); assertEquals(1, s1.getSize().get(0));
@ -281,7 +282,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingServices_durationOfService1IsReadCorrectly() { public void whenReadingServices_durationOfService1IsReadCorrectly() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Service s1 = (Service) vrp.getJobs().get("1"); Service s1 = (Service) vrp.getJobs().get("1");
assertEquals(10.0, s1.getServiceDuration(), 0.01); assertEquals(10.0, s1.getServiceDuration(), 0.01);
@ -290,7 +291,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingServices_twOfService1IsReadCorrectly() { public void whenReadingServices_twOfService1IsReadCorrectly() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Service s1 = (Service) vrp.getJobs().get("1"); Service s1 = (Service) vrp.getJobs().get("1");
assertEquals(0.0, s1.getTimeWindow().getStart(), 0.01); assertEquals(0.0, s1.getTimeWindow().getStart(), 0.01);
@ -300,7 +301,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingServices_typeOfService1IsReadCorrectly() { public void whenReadingServices_typeOfService1IsReadCorrectly() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Service s1 = (Service) vrp.getJobs().get("1"); Service s1 = (Service) vrp.getJobs().get("1");
assertEquals("service", s1.getType()); assertEquals("service", s1.getType());
@ -309,7 +310,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingFile_v2MustNotReturnToDepot() { public void whenReadingFile_v2MustNotReturnToDepot() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Vehicle v = getVehicle("v2", vrp.getVehicles()); Vehicle v = getVehicle("v2", vrp.getVehicles());
assertFalse(v.isReturnToDepot()); assertFalse(v.isReturnToDepot());
@ -318,7 +319,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingFile_v3HasTheCorrectStartLocation() { public void whenReadingFile_v3HasTheCorrectStartLocation() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Vehicle v3 = getVehicle("v3", vrp.getVehicles()); Vehicle v3 = getVehicle("v3", vrp.getVehicles());
assertEquals("startLoc", v3.getStartLocation().getId()); assertEquals("startLoc", v3.getStartLocation().getId());
@ -329,7 +330,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingFile_v3HasTheCorrectEndLocation() { public void whenReadingFile_v3HasTheCorrectEndLocation() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Vehicle v3 = getVehicle("v3", vrp.getVehicles()); Vehicle v3 = getVehicle("v3", vrp.getVehicles());
assertEquals("endLoc", v3.getEndLocation().getId()); assertEquals("endLoc", v3.getEndLocation().getId());
@ -338,7 +339,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingFile_v3HasTheCorrectEndLocationCoordinate() { public void whenReadingFile_v3HasTheCorrectEndLocationCoordinate() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Vehicle v3 = getVehicle("v3", vrp.getVehicles()); Vehicle v3 = getVehicle("v3", vrp.getVehicles());
assertEquals(1000.0, v3.getEndLocation().getCoordinate().getX(), 0.01); assertEquals(1000.0, v3.getEndLocation().getCoordinate().getX(), 0.01);
@ -348,7 +349,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingFile_v3HasTheCorrectStartLocationCoordinate() { public void whenReadingFile_v3HasTheCorrectStartLocationCoordinate() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Vehicle v3 = getVehicle("v3", vrp.getVehicles()); Vehicle v3 = getVehicle("v3", vrp.getVehicles());
assertEquals(10.0, v3.getStartLocation().getCoordinate().getX(), 0.01); assertEquals(10.0, v3.getStartLocation().getCoordinate().getX(), 0.01);
@ -358,7 +359,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingFile_v3HasTheCorrectLocationCoordinate() { public void whenReadingFile_v3HasTheCorrectLocationCoordinate() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Vehicle v3 = getVehicle("v3", vrp.getVehicles()); Vehicle v3 = getVehicle("v3", vrp.getVehicles());
assertEquals(10.0, v3.getStartLocation().getCoordinate().getX(), 0.01); assertEquals(10.0, v3.getStartLocation().getCoordinate().getX(), 0.01);
@ -368,7 +369,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingFile_v3HasTheCorrectLocationId() { public void whenReadingFile_v3HasTheCorrectLocationId() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Vehicle v3 = getVehicle("v3", vrp.getVehicles()); Vehicle v3 = getVehicle("v3", vrp.getVehicles());
assertEquals("startLoc", v3.getStartLocation().getId()); assertEquals("startLoc", v3.getStartLocation().getId());
@ -377,7 +378,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingFile_v4HasTheCorrectStartLocation() { public void whenReadingFile_v4HasTheCorrectStartLocation() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Vehicle v = getVehicle("v4", vrp.getVehicles()); Vehicle v = getVehicle("v4", vrp.getVehicles());
assertEquals("startLoc", v.getStartLocation().getId()); assertEquals("startLoc", v.getStartLocation().getId());
@ -386,7 +387,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingFile_v4HasTheCorrectEndLocation() { public void whenReadingFile_v4HasTheCorrectEndLocation() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Vehicle v = getVehicle("v4", vrp.getVehicles()); Vehicle v = getVehicle("v4", vrp.getVehicles());
assertEquals("endLoc", v.getEndLocation().getId()); assertEquals("endLoc", v.getEndLocation().getId());
@ -395,7 +396,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingFile_v4HasTheCorrectEndLocationCoordinate() { public void whenReadingFile_v4HasTheCorrectEndLocationCoordinate() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Vehicle v = getVehicle("v4", vrp.getVehicles()); Vehicle v = getVehicle("v4", vrp.getVehicles());
assertEquals(1000.0, v.getEndLocation().getCoordinate().getX(), 0.01); assertEquals(1000.0, v.getEndLocation().getCoordinate().getX(), 0.01);
@ -405,7 +406,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingFile_v4HasTheCorrectStartLocationCoordinate() { public void whenReadingFile_v4HasTheCorrectStartLocationCoordinate() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Vehicle v = getVehicle("v4", vrp.getVehicles()); Vehicle v = getVehicle("v4", vrp.getVehicles());
assertEquals(10.0, v.getStartLocation().getCoordinate().getX(), 0.01); assertEquals(10.0, v.getStartLocation().getCoordinate().getX(), 0.01);
@ -415,7 +416,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingFile_v4HasTheCorrectLocationCoordinate() { public void whenReadingFile_v4HasTheCorrectLocationCoordinate() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Vehicle v = getVehicle("v4", vrp.getVehicles()); Vehicle v = getVehicle("v4", vrp.getVehicles());
assertEquals(10.0, v.getStartLocation().getCoordinate().getX(), 0.01); assertEquals(10.0, v.getStartLocation().getCoordinate().getX(), 0.01);
@ -425,7 +426,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingFile_v4HasTheCorrectLocationId() { public void whenReadingFile_v4HasTheCorrectLocationId() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Vehicle v = getVehicle("v4", vrp.getVehicles()); Vehicle v = getVehicle("v4", vrp.getVehicles());
assertEquals("startLoc", v.getStartLocation().getId()); assertEquals("startLoc", v.getStartLocation().getId());
@ -434,7 +435,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingJobs_capOfShipment3IsReadCorrectly() { public void whenReadingJobs_capOfShipment3IsReadCorrectly() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Shipment s = (Shipment) vrp.getJobs().get("3"); Shipment s = (Shipment) vrp.getJobs().get("3");
assertEquals(10, s.getSize().get(0)); assertEquals(10, s.getSize().get(0));
@ -443,7 +444,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingJobs_pickupServiceTimeOfShipment3IsReadCorrectly() { public void whenReadingJobs_pickupServiceTimeOfShipment3IsReadCorrectly() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Shipment s = (Shipment) vrp.getJobs().get("3"); Shipment s = (Shipment) vrp.getJobs().get("3");
assertEquals(10.0, s.getPickupServiceTime(), 0.01); assertEquals(10.0, s.getPickupServiceTime(), 0.01);
@ -452,7 +453,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingJobs_pickupTimeWindowOfShipment3IsReadCorrectly() { public void whenReadingJobs_pickupTimeWindowOfShipment3IsReadCorrectly() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Shipment s = (Shipment) vrp.getJobs().get("3"); Shipment s = (Shipment) vrp.getJobs().get("3");
assertEquals(1000.0, s.getPickupTimeWindow().getStart(), 0.01); assertEquals(1000.0, s.getPickupTimeWindow().getStart(), 0.01);
@ -462,7 +463,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingJobs_deliveryTimeWindowOfShipment3IsReadCorrectly() { public void whenReadingJobs_deliveryTimeWindowOfShipment3IsReadCorrectly() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Shipment s = (Shipment) vrp.getJobs().get("3"); Shipment s = (Shipment) vrp.getJobs().get("3");
assertEquals(6000.0, s.getDeliveryTimeWindow().getStart(), 0.01); assertEquals(6000.0, s.getDeliveryTimeWindow().getStart(), 0.01);
@ -472,7 +473,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingJobs_deliveryServiceTimeOfShipment3IsReadCorrectly() { public void whenReadingJobs_deliveryServiceTimeOfShipment3IsReadCorrectly() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
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.getDeliveryServiceTime(), 0.01); assertEquals(100.0, s.getDeliveryServiceTime(), 0.01);
@ -481,7 +482,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingJobs_deliveryCoordShipment3IsReadCorrectly() { public void whenReadingJobs_deliveryCoordShipment3IsReadCorrectly() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Shipment s = (Shipment) vrp.getJobs().get("3"); Shipment s = (Shipment) vrp.getJobs().get("3");
assertEquals(10.0, s.getDeliveryLocation().getCoordinate().getX(), 0.01); assertEquals(10.0, s.getDeliveryLocation().getCoordinate().getX(), 0.01);
@ -491,7 +492,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingJobs_pickupCoordShipment3IsReadCorrectly() { public void whenReadingJobs_pickupCoordShipment3IsReadCorrectly() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Shipment s = (Shipment) vrp.getJobs().get("3"); Shipment s = (Shipment) vrp.getJobs().get("3");
assertEquals(10.0, s.getPickupLocation().getCoordinate().getX(), 0.01); assertEquals(10.0, s.getPickupLocation().getCoordinate().getX(), 0.01);
@ -501,7 +502,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingJobs_deliveryIdShipment3IsReadCorrectly() { public void whenReadingJobs_deliveryIdShipment3IsReadCorrectly() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Shipment s = (Shipment) vrp.getJobs().get("3"); Shipment s = (Shipment) vrp.getJobs().get("3");
assertEquals("i(9,9)", s.getDeliveryLocation().getId()); assertEquals("i(9,9)", s.getDeliveryLocation().getId());
@ -510,7 +511,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingJobs_pickupIdShipment3IsReadCorrectly() { public void whenReadingJobs_pickupIdShipment3IsReadCorrectly() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Shipment s = (Shipment) vrp.getJobs().get("3"); Shipment s = (Shipment) vrp.getJobs().get("3");
assertEquals("i(3,9)", s.getPickupLocation().getId()); assertEquals("i(3,9)", s.getPickupLocation().getId());
@ -519,7 +520,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingJobs_pickupLocationIdShipment4IsReadCorrectly() { public void whenReadingJobs_pickupLocationIdShipment4IsReadCorrectly() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Shipment s = (Shipment) vrp.getJobs().get("4"); Shipment s = (Shipment) vrp.getJobs().get("4");
assertEquals("[x=10.0][y=10.0]", s.getPickupLocation().getId()); assertEquals("[x=10.0][y=10.0]", s.getPickupLocation().getId());
@ -528,7 +529,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingJobs_deliveryLocationIdShipment4IsReadCorrectly() { public void whenReadingJobs_deliveryLocationIdShipment4IsReadCorrectly() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Shipment s = (Shipment) vrp.getJobs().get("4"); Shipment s = (Shipment) vrp.getJobs().get("4");
assertEquals("[x=10.0][y=0.0]", s.getDeliveryLocation().getId()); assertEquals("[x=10.0][y=0.0]", s.getDeliveryLocation().getId());
@ -537,7 +538,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingJobs_pickupServiceTimeOfShipment4IsReadCorrectly() { public void whenReadingJobs_pickupServiceTimeOfShipment4IsReadCorrectly() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Shipment s = (Shipment) vrp.getJobs().get("4"); Shipment s = (Shipment) vrp.getJobs().get("4");
assertEquals(0.0, s.getPickupServiceTime(), 0.01); assertEquals(0.0, s.getPickupServiceTime(), 0.01);
@ -546,7 +547,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingJobs_deliveryServiceTimeOfShipment4IsReadCorrectly() { public void whenReadingJobs_deliveryServiceTimeOfShipment4IsReadCorrectly() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Shipment s = (Shipment) vrp.getJobs().get("4"); Shipment s = (Shipment) vrp.getJobs().get("4");
assertEquals(100.0, s.getDeliveryServiceTime(), 0.01); assertEquals(100.0, s.getDeliveryServiceTime(), 0.01);
@ -555,7 +556,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingFile_v5AndItsTypeHasTheCorrectCapacityDimensionValues() { public void whenReadingFile_v5AndItsTypeHasTheCorrectCapacityDimensionValues() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read(inFileName); new VrpXMLReader(builder, null).read(inputStream);
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
Vehicle v = getVehicle("v5", vrp.getVehicles()); Vehicle v = getVehicle("v5", vrp.getVehicles());
assertEquals(100, v.getType().getCapacityDimensions().get(0)); assertEquals(100, v.getType().getCapacityDimensions().get(0));
@ -569,7 +570,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingInitialRouteWithShipment4_thisShipmentShouldNotAppearInJobMap() { //since it is not part of the problem anymore public void whenReadingInitialRouteWithShipment4_thisShipmentShouldNotAppearInJobMap() { //since it is not part of the problem anymore
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder).read("src/test/resources/finiteVrpWithInitialSolutionForReaderTest.xml"); new VrpXMLReader(builder).read(getClass().getResourceAsStream("finiteVrpWithInitialSolutionForReaderTest.xml"));
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
assertFalse(vrp.getJobs().containsKey("4")); assertFalse(vrp.getJobs().containsKey("4"));
} }
@ -577,7 +578,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingInitialRouteWithDepTime10_departureTimeOfRouteShouldBeReadCorrectly() { public void whenReadingInitialRouteWithDepTime10_departureTimeOfRouteShouldBeReadCorrectly() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder).read("src/test/resources/finiteVrpWithInitialSolutionForReaderTest.xml"); new VrpXMLReader(builder).read(getClass().getResourceAsStream("finiteVrpWithInitialSolutionForReaderTest.xml"));
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
assertEquals(10., vrp.getInitialVehicleRoutes().iterator().next().getDepartureTime(), 0.01); assertEquals(10., vrp.getInitialVehicleRoutes().iterator().next().getDepartureTime(), 0.01);
} }
@ -585,7 +586,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingInitialRoute_nuInitialRoutesShouldBeCorrect() { public void whenReadingInitialRoute_nuInitialRoutesShouldBeCorrect() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read("src/test/resources/finiteVrpWithInitialSolutionForReaderTest.xml"); new VrpXMLReader(builder, null).read(getClass().getResourceAsStream("finiteVrpWithInitialSolutionForReaderTest.xml"));
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
assertEquals(1, vrp.getInitialVehicleRoutes().size()); assertEquals(1, vrp.getInitialVehicleRoutes().size());
} }
@ -593,7 +594,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void whenReadingInitialRoute_nuActivitiesShouldBeCorrect() { public void whenReadingInitialRoute_nuActivitiesShouldBeCorrect() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read("src/test/resources/finiteVrpWithInitialSolutionForReaderTest.xml"); new VrpXMLReader(builder, null).read(getClass().getResourceAsStream("finiteVrpWithInitialSolutionForReaderTest.xml"));
VehicleRoutingProblem vrp = builder.build(); VehicleRoutingProblem vrp = builder.build();
assertEquals(2, vrp.getInitialVehicleRoutes().iterator().next().getActivities().size()); assertEquals(2, vrp.getInitialVehicleRoutes().iterator().next().getActivities().size());
} }
@ -602,7 +603,7 @@ public class VrpXMLReaderTest {
public void testRead_ifReaderIsCalled_itReadsSuccessfullyV2() { public void testRead_ifReaderIsCalled_itReadsSuccessfullyV2() {
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
ArrayList<VehicleRoutingProblemSolution> solutions = new ArrayList<VehicleRoutingProblemSolution>(); ArrayList<VehicleRoutingProblemSolution> solutions = new ArrayList<VehicleRoutingProblemSolution>();
new VrpXMLReader(vrpBuilder, solutions).read("src/test/resources/finiteVrpWithShipmentsAndSolution.xml"); new VrpXMLReader(vrpBuilder, solutions).read(getClass().getResourceAsStream("finiteVrpWithShipmentsAndSolution.xml"));
VehicleRoutingProblem vrp = vrpBuilder.build(); VehicleRoutingProblem vrp = vrpBuilder.build();
assertEquals(4, vrp.getJobs().size()); assertEquals(4, vrp.getJobs().size());
assertEquals(1, solutions.size()); assertEquals(1, solutions.size());
@ -618,7 +619,7 @@ public class VrpXMLReaderTest {
@Test @Test
public void testRead_ifReaderIsCalled_itReadsSuccessfully() { public void testRead_ifReaderIsCalled_itReadsSuccessfully() {
new VrpXMLReader(VehicleRoutingProblem.Builder.newInstance(), new ArrayList<VehicleRoutingProblemSolution>()).read("src/test/resources/lui-shen-solution.xml"); new VrpXMLReader(VehicleRoutingProblem.Builder.newInstance(), new ArrayList<VehicleRoutingProblemSolution>()).read(getClass().getResourceAsStream("lui-shen-solution.xml"));
assertTrue(true); assertTrue(true);
} }
@ -627,18 +628,12 @@ public class VrpXMLReaderTest {
public void unassignedJobShouldBeRead() { public void unassignedJobShouldBeRead() {
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
ArrayList<VehicleRoutingProblemSolution> solutions = new ArrayList<VehicleRoutingProblemSolution>(); ArrayList<VehicleRoutingProblemSolution> solutions = new ArrayList<VehicleRoutingProblemSolution>();
new VrpXMLReader(vrpBuilder, solutions).read("src/test/resources/finiteVrpWithShipmentsAndSolution.xml"); new VrpXMLReader(vrpBuilder, solutions).read(getClass().getResourceAsStream("finiteVrpWithShipmentsAndSolution.xml"));
VehicleRoutingProblemSolution solution = Solutions.bestOf(solutions); VehicleRoutingProblemSolution solution = Solutions.bestOf(solutions);
assertEquals(1, solution.getUnassignedJobs().size()); assertEquals(1, solution.getUnassignedJobs().size());
assertEquals("4", solution.getUnassignedJobs().iterator().next().getId()); assertEquals("4", solution.getUnassignedJobs().iterator().next().getId());
} }
// @Test
// public void solutionListShouldBeEmpty(){
// VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
// ArrayList<VehicleRoutingProblemSolution> solutions = new ArrayList<VehicleRoutingProblemSolution>();
// new VrpXMLReader(vrpBuilder, solutions).read("src/test/resources/finiteVrpforReaderTest.xml");
// assertTrue(solutions.isEmpty());
// }
} }
//

View file

@ -895,68 +895,6 @@ public class VrpXMLWriterTest {
return null; return null;
} }
@Test
public void whenWritingAndReadingInitialRouteWithShipment4_thisShipmentShouldNotAppearInJobMap() { //since it is not part of the problem anymore
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder).read("src/test/resources/finiteVrpWithInitialSolutionForReaderTest.xml");
VehicleRoutingProblem vrp = builder.build();
new VrpXMLWriter(vrp).write("src/test/resources/finiteVrpWithInitialSolutionForWriterTest.xml");
VehicleRoutingProblem.Builder newBuilder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(newBuilder).read("src/test/resources/finiteVrpWithInitialSolutionForWriterTest.xml");
VehicleRoutingProblem newVrp = newBuilder.build();
assertFalse(newVrp.getJobs().containsKey("4"));
}
@Test
public void whenReadingInitialRouteWithDepTime10_departureTimeOfRouteShouldBeReadCorrectly() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder).read("src/test/resources/finiteVrpWithInitialSolutionForReaderTest.xml");
VehicleRoutingProblem vrp = builder.build();
new VrpXMLWriter(vrp).write("src/test/resources/finiteVrpWithInitialSolutionForWriterTest.xml");
VehicleRoutingProblem.Builder newBuilder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(newBuilder).read("src/test/resources/finiteVrpWithInitialSolutionForWriterTest.xml");
VehicleRoutingProblem newVrp = newBuilder.build();
Assert.assertEquals(10., newVrp.getInitialVehicleRoutes().iterator().next().getDepartureTime(), 0.01);
}
@Test
public void whenReadingInitialRoute_nuInitialRoutesShouldBeCorrect() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read("src/test/resources/finiteVrpWithInitialSolutionForReaderTest.xml");
VehicleRoutingProblem vrp = builder.build();
new VrpXMLWriter(vrp).write("src/test/resources/finiteVrpWithInitialSolutionForWriterTest.xml");
VehicleRoutingProblem.Builder newBuilder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(newBuilder).read("src/test/resources/finiteVrpWithInitialSolutionForWriterTest.xml");
VehicleRoutingProblem newVrp = newBuilder.build();
assertEquals(1, newVrp.getInitialVehicleRoutes().size());
}
@Test
public void whenReadingInitialRoute_nuActivitiesShouldBeCorrect() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(builder, null).read("src/test/resources/finiteVrpWithInitialSolutionForReaderTest.xml");
VehicleRoutingProblem vrp = builder.build();
new VrpXMLWriter(vrp).write("src/test/resources/finiteVrpWithInitialSolutionForWriterTest.xml");
VehicleRoutingProblem.Builder newBuilder = VehicleRoutingProblem.Builder.newInstance();
new VrpXMLReader(newBuilder).read("src/test/resources/finiteVrpWithInitialSolutionForWriterTest.xml");
VehicleRoutingProblem newVrp = newBuilder.build();
Assert.assertEquals(2, newVrp.getInitialVehicleRoutes().iterator().next().getActivities().size());
}
@Test @Test
public void solutionWithoutUnassignedJobsShouldBeWrittenCorrectly() { public void solutionWithoutUnassignedJobsShouldBeWrittenCorrectly() {
VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();

View file

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<algorithm xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3schools.com algorithm_schema.xsd">
<iterations>2000</iterations>
<construction>
<insertion name="bestInsertion"/>
</construction>
<strategy>
<memory>1</memory>
<searchStrategies>
<searchStrategy name="randomRuinAndRecreate">
<selector name="selectBest"/>
<acceptor name="acceptNewRemoveWorst"/>
<modules>
<module name="ruin_and_recreate">
<ruin name="randomRuin">
<share>0.5</share>
</ruin>
<insertion name="bestInsertion"/>
</module>
</modules>
<probability>0.5</probability>
</searchStrategy>
<searchStrategy name="radialRuinAndRecreate">
<selector name="selectBest"/>
<acceptor name="acceptNewRemoveWorst"/>
<modules>
<module name="ruin_and_recreate">
<ruin name="radialRuin">
<share>0.3</share>
</ruin>
<insertion name="bestInsertion"/>
</module>
</modules>
<probability>0.5</probability>
</searchStrategy>
</searchStrategies>
</strategy>
</algorithm>

View file

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ 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 <http://www.gnu.org/licenses/>.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<algorithm xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3schools.com algorithm_schema.xsd">
<maxIterations>2000</maxIterations>
<terminationCriteria>
<termination basedOn="iterations">
<iterations>100</iterations>
</termination>
<termination basedOn="iterations">
<iterations>25</iterations>
</termination>
</terminationCriteria>
<construction>
<insertion name="bestInsertion"/>
</construction>
<strategy>
<memory>1</memory>
<searchStrategies>
<searchStrategy name="randomRuinAndRecreate">
<selector name="selectBest"/>
<acceptor name="acceptNewRemoveWorst"/>
<modules>
<module name="ruin_and_recreate">
<ruin name="randomRuin">
<share>0.5</share>
</ruin>
<insertion name="bestInsertion"/>
</module>
</modules>
<probability>0.5</probability>
</searchStrategy>
<searchStrategy name="radialRuinAndRecreate">
<selector name="selectBest"/>
<acceptor name="acceptNewRemoveWorst"/>
<modules>
<module name="ruin_and_recreate">
<ruin name="radialRuin">
<share>0.3</share>
</ruin>
<insertion name="bestInsertion"/>
</module>
</modules>
<probability>0.5</probability>
</searchStrategy>
</searchStrategies>
</strategy>
</algorithm>

View file

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ 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 <http://www.gnu.org/licenses/>.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<algorithm xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3schools.com algorithm_schema.xsd">
<maxIterations>2000</maxIterations>
<prematureBreak basedOn="iterations">
<iterations>100</iterations>
</prematureBreak>
<construction>
<insertion name="bestInsertion"/>
</construction>
<strategy>
<memory>1</memory>
<searchStrategies>
<searchStrategy name="randomRuinAndRecreate">
<selector name="selectBest"/>
<acceptor name="acceptNewRemoveWorst"/>
<modules>
<module name="ruin_and_recreate">
<ruin name="randomRuin">
<share>0.5</share>
</ruin>
<insertion name="bestInsertion"/>
</module>
</modules>
<probability>0.5</probability>
</searchStrategy>
<searchStrategy name="radialRuinAndRecreate">
<selector name="selectBest"/>
<acceptor name="acceptNewRemoveWorst"/>
<modules>
<module name="ruin_and_recreate">
<ruin name="radialRuin">
<share>0.3</share>
</ruin>
<insertion name="bestInsertion"/>
</module>
</modules>
<probability>0.5</probability>
</searchStrategy>
</searchStrategies>
</strategy>
</algorithm>

View file

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<algorithm xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3schools.com algorithm_schema.xsd">
<construction>
<insertion name="bestInsertion"/>
</construction>
<strategy>
<memory>1</memory>
<searchStrategies>
<searchStrategy name="randomRuinAndRecreate">
<selector name="selectBest"/>
<acceptor name="acceptNewRemoveWorst"/>
<modules>
<module name="ruin_and_recreate">
<ruin name="randomRuin">
<share>0.5</share>
</ruin>
<insertion name="bestInsertion"/>
</module>
</modules>
<probability>0.5</probability>
</searchStrategy>
<searchStrategy name="radialRuinAndRecreate">
<selector name="selectBest"/>
<acceptor name="acceptNewRemoveWorst"/>
<modules>
<module name="ruin_and_recreate">
<ruin name="radialRuin">
<share>0.3</share>
</ruin>
<insertion name="bestInsertion"/>
</module>
</modules>
<probability>0.5</probability>
</searchStrategy>
</searchStrategies>
</strategy>
</algorithm>

View file

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?>
<problem xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
<problemType>
<fleetSize>FINITE</fleetSize>
<fleetComposition>HETEROGENEOUS</fleetComposition>
</problemType>
<vehicles>
<vehicle>
<id>v1</id>
<location>
<id>depotLoc2</id>
<coord x="100.0" y="100.0"/>
</location>
<typeId>vehType</typeId>
<timeSchedule>
<start>0.0</start>
<end>1000.0</end>
</timeSchedule>
</vehicle>
<vehicle>
<id>v2</id>
<location>
<id>depotLoc</id>
<coord x="10.0" y="100.0"/>
</location>
<typeId>vehType2</typeId>
<timeSchedule>
<start>0.0</start>
<end>1000.0</end>
</timeSchedule>
</vehicle>
</vehicles>
<vehicleTypes>
<type>
<id>vehType</id>
<capacity>20</capacity>
<costs>
<fixed>0.0</fixed>
<distance>0.0</distance>
<time>0.0</time>
</costs>
</type>
<type>
<id>vehType2</id>
<capacity>200</capacity>
<costs>
<fixed>0.0</fixed>
<distance>0.0</distance>
<time>0.0</time>
</costs>
</type>
</vehicleTypes>
<services>
<service id="1" type="service">
<locationId>j(1,5)</locationId>
<coord x="10.0" y="10.0"/>
<capacity-demand>1</capacity-demand>
<duration>0.0</duration>
<timeWindows>
<timeWindow>
<start>0.0</start>
<end>4000.0</end>
</timeWindow>
</timeWindows>
</service>
<service id="2" type="service">
<locationId>i(3,9)</locationId>
<coord x="10.0" y="10.0"/>
<capacity-demand>1</capacity-demand>
<duration>0.0</duration>
<timeWindows>
<timeWindow>
<start>0.0</start>
<end>4000.0</end>
</timeWindow>
</timeWindows>
</service>
</services>
</problem>

View file

@ -0,0 +1,70 @@
<?xml version="1.0" ?>
<config>
<iterations>10</iterations>
<construction>
<insertion name="bestInsertion"/>
</construction>
<strategy>
<memory>1</memory>
<searchStrategies>
<searchStrategy name="randomRuinAndRecreate">
<selector name="selectBest"/>
<acceptor name="acceptNewRemoveWorst"/>
<modules>
<module name="ruin_and_recreate">
<ruin name="randomRuin">
<share>0.5</share>
</ruin>
<insertion name="bestInsertion"/>
</module>
</modules>
<probability>0.4</probability>
</searchStrategy>
<searchStrategy name="randomRuinSmall">
<selector name="selectBest"/>
<acceptor name="acceptNewRemoveWorst"/>
<modules>
<module name="ruin_and_recreate">
<ruin name="randomRuin">
<share>0.1</share>
</ruin>
<insertion name="bestInsertion"/>
</module>
</modules>
<probability>0.4</probability>
</searchStrategy>
<searchStrategy name="radialRuinAndRecreate">
<selector name="selectBest"/>
<acceptor name="acceptNewRemoveWorst"/>
<modules>
<module name="ruin_and_recreate">
<ruin name="radialRuin">
<share>0.3</share>
</ruin>
<insertion name="bestInsertion" id="1"/>
</module>
</modules>
<probability>0.2</probability>
</searchStrategy>
<!-- <searchStrategy id="gendreauPostOpt"> -->
<!-- <modules number="1"> -->
<!-- <module name="gendreau"> -->
<!-- <iterations>200</iterations> -->
<!-- <share>0.2</share> -->
<!-- </module> -->
<!-- </modules> -->
<!-- <probability>0.1</probability> -->
<!-- </searchStrategy> -->
</searchStrategies>
</strategy>
</config>

View file

@ -0,0 +1,237 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ 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 <http://www.gnu.org/licenses/>.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<problem xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
<problemType>
<fleetSize>FINITE</fleetSize>
<fleetComposition>HETEROGENEOUS</fleetComposition>
</problemType>
<vehicles>
<vehicle>
<id>v1</id>
<location>
<id>depotLoc2</id>
<coord x="100.0" y="100.0"/>
<index>1</index>
</location>
<typeId>vehType</typeId>
<timeSchedule>
<start>0.0</start>
<end>1000.0</end>
</timeSchedule>
<skills>skill1; SKill2</skills>
</vehicle>
<vehicle>
<id>v2</id>
<location>
<id>depotLoc</id>
<coord x="10.0" y="100.0"/>
<index>2</index>
</location>
<returnToDepot>false</returnToDepot>
<typeId>vehType2</typeId>
<timeSchedule>
<start>0.0</start>
<end>1000.0</end>
</timeSchedule>
</vehicle>
<vehicle>
<id>v3</id>
<startLocation>
<id>startLoc</id>
<coord x="10.0" y="100.0"/>
<index>3</index>
</startLocation>
<endLocation>
<id>endLoc</id>
<coord x="1000.0" y="2000.0"/>
<index>4</index>
</endLocation>
<typeId>vehType2</typeId>
<timeSchedule>
<start>0.0</start>
<end>1000.0</end>
</timeSchedule>
</vehicle>
<vehicle>
<id>v4</id>
<location>
<id>startLoc</id>
<coord x="10.0" y="100.0"/>
</location>
<endLocation>
<id>endLoc</id>
<coord x="1000.0" y="2000.0"/>
</endLocation>
<typeId>vehType2</typeId>
<timeSchedule>
<start>0.0</start>
<end>1000.0</end>
</timeSchedule>
</vehicle>
<vehicle>
<id>v5</id>
<location>
<id>startLoc</id>
<coord x="10.0" y="100.0"/>
</location>
<endLocation>
<id>endLoc</id>
<coord x="1000.0" y="2000.0"/>
</endLocation>
<typeId>vehType3</typeId>
<timeSchedule>
<start>0.0</start>
<end>1000.0</end>
</timeSchedule>
</vehicle>
</vehicles>
<vehicleTypes>
<type>
<id>vehType</id>
<capacity-dimensions>
<dimension index="0">20</dimension>
</capacity-dimensions>
<costs>
<fixed>0.0</fixed>
<distance>0.0</distance>
<time>0.0</time>
</costs>
</type>
<type>
<id>vehType2</id>
<capacity>200</capacity>
<costs>
<fixed>0.0</fixed>
<distance>0.0</distance>
<time>0.0</time>
</costs>
</type>
<type>
<id>vehType3</id>
<capacity-dimensions>
<dimension index="0">100</dimension>
<dimension index="1">1000</dimension>
<dimension index="2">10000</dimension>
<dimension index="10">100000</dimension>
</capacity-dimensions>
<costs>
<fixed>0.0</fixed>
<distance>0.0</distance>
<time>0.0</time>
</costs>
</type>
</vehicleTypes>
<services>
<service id="1" type="service">
<locationId>j(1,5)</locationId>
<name>cleaning</name>
<coord x="10.0" y="10.0"/>
<capacity-dimensions>
<dimension index="0">1</dimension>
</capacity-dimensions>
<duration>10.0</duration>
<timeWindows>
<timeWindow>
<start>0.0</start>
<end>4000.0</end>
</timeWindow>
</timeWindows>
<requiredSkills>skill1, Skill2</requiredSkills>
</service>
<service id="2" type="service">
<locationId>i(3,9)</locationId>
<name>cleaning</name>
<coord x="10.0" y="10.0"/>
<capacity-demand>1</capacity-demand>
<duration>0.0</duration>
<timeWindows>
<timeWindow>
<start>0.0</start>
<end>4000.0</end>
</timeWindow>
</timeWindows>
</service>
</services>
<shipments>
<shipment id="3">
<name>deliver-smth</name>
<pickup>
<locationId>i(3,9)</locationId>
<coord x="10.0" y="10.0"/>
<duration>10.0</duration>
<timeWindows>
<timeWindow>
<start>1000.0</start>
<end>4000.0</end>
</timeWindow>
</timeWindows>
</pickup>
<delivery>
<locationId>i(9,9)</locationId>
<coord x="10.0" y="0.0"/>
<duration>100.0</duration>
<timeWindows>
<timeWindow>
<start>6000.0</start>
<end>10000.0</end>
</timeWindow>
</timeWindows>
</delivery>
<capacity-dimensions>
<dimension index="0">10</dimension>
</capacity-dimensions>
<requiredSkills>skill1, Skill2</requiredSkills>
</shipment>
<shipment id="4">
<pickup>
<coord x="10.0" y="10.0"/>
<timeWindows>
<timeWindow>
<start>1000.0</start>
<end>4000.0</end>
</timeWindow>
</timeWindows>
</pickup>
<delivery>
<coord x="10.0" y="0.0"/>
<duration>100.0</duration>
<timeWindows>
<timeWindow>
<start>6000.0</start>
<end>10000.0</end>
</timeWindow>
</timeWindows>
</delivery>
<capacity-dimensions>
<dimension index="0">10</dimension>
</capacity-dimensions>
<name>deliver-smth</name>
</shipment>
</shipments>
</problem>

View file

@ -0,0 +1,223 @@
<?xml version="1.0" encoding="UTF-8"?>
<problem xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
<problemType>
<fleetSize>FINITE</fleetSize>
<fleetComposition>HETEROGENEOUS</fleetComposition>
</problemType>
<vehicles>
<vehicle>
<id>v1</id>
<location>
<id>depotLoc2</id>
<coord x="100.0" y="100.0"/>
</location>
<typeId>vehType</typeId>
<timeSchedule>
<start>0.0</start>
<end>1000.0</end>
</timeSchedule>
</vehicle>
<vehicle>
<id>v2</id>
<location>
<id>depotLoc</id>
<coord x="10.0" y="100.0"/>
</location>
<returnToDepot>false</returnToDepot>
<typeId>vehType2</typeId>
<timeSchedule>
<start>0.0</start>
<end>1000.0</end>
</timeSchedule>
</vehicle>
<vehicle>
<id>v3</id>
<startLocation>
<id>startLoc</id>
<coord x="10.0" y="100.0"/>
</startLocation>
<endLocation>
<id>endLoc</id>
<coord x="1000.0" y="2000.0"/>
</endLocation>
<typeId>vehType2</typeId>
<timeSchedule>
<start>0.0</start>
<end>1000.0</end>
</timeSchedule>
</vehicle>
<vehicle>
<id>v4</id>
<location>
<id>startLoc</id>
<coord x="10.0" y="100.0"/>
</location>
<endLocation>
<id>endLoc</id>
<coord x="1000.0" y="2000.0"/>
</endLocation>
<typeId>vehType2</typeId>
<timeSchedule>
<start>0.0</start>
<end>1000.0</end>
</timeSchedule>
</vehicle>
<vehicle>
<id>v5</id>
<location>
<id>startLoc</id>
<coord x="10.0" y="100.0"/>
</location>
<endLocation>
<id>endLoc</id>
<coord x="1000.0" y="2000.0"/>
</endLocation>
<typeId>vehType3</typeId>
<timeSchedule>
<start>0.0</start>
<end>1000.0</end>
</timeSchedule>
</vehicle>
</vehicles>
<vehicleTypes>
<type>
<id>vehType</id>
<capacity-dimensions>
<dimension index="0">20</dimension>
</capacity-dimensions>
<costs>
<fixed>0.0</fixed>
<distance>0.0</distance>
<time>0.0</time>
</costs>
</type>
<type>
<id>vehType2</id>
<capacity>200</capacity>
<costs>
<fixed>0.0</fixed>
<distance>0.0</distance>
<time>0.0</time>
</costs>
</type>
<type>
<id>vehType3</id>
<capacity-dimensions>
<dimension index="0">100</dimension>
<dimension index="1">1000</dimension>
<dimension index="2">10000</dimension>
<dimension index="10">100000</dimension>
</capacity-dimensions>
<costs>
<fixed>0.0</fixed>
<distance>0.0</distance>
<time>0.0</time>
</costs>
</type>
</vehicleTypes>
<services>
<service id="1" type="service">
<locationId>j(1,5)</locationId>
<coord x="10.0" y="10.0"/>
<capacity-dimensions>
<dimension index="0">1</dimension>
</capacity-dimensions>
<duration>10.0</duration>
<timeWindows>
<timeWindow>
<start>0.0</start>
<end>4000.0</end>
</timeWindow>
</timeWindows>
</service>
<service id="2" type="service">
<locationId>i(3,9)</locationId>
<coord x="10.0" y="10.0"/>
<capacity-demand>1</capacity-demand>
<duration>0.0</duration>
<timeWindows>
<timeWindow>
<start>0.0</start>
<end>4000.0</end>
</timeWindow>
</timeWindows>
</service>
</services>
<shipments>
<shipment id="3">
<pickup>
<locationId>i(3,9)</locationId>
<coord x="10.0" y="10.0"/>
<duration>10.0</duration>
<timeWindows>
<timeWindow>
<start>1000.0</start>
<end>4000.0</end>
</timeWindow>
</timeWindows>
</pickup>
<delivery>
<locationId>i(9,9)</locationId>
<coord x="10.0" y="0.0"/>
<duration>100.0</duration>
<timeWindows>
<timeWindow>
<start>6000.0</start>
<end>10000.0</end>
</timeWindow>
</timeWindows>
</delivery>
<capacity-demand>10</capacity-demand>
</shipment>
<shipment id="4">
<pickup>
<coord x="10.0" y="10.0"/>
<timeWindows>
<timeWindow>
<start>1000.0</start>
<end>4000.0</end>
</timeWindow>
</timeWindows>
</pickup>
<delivery>
<coord x="10.0" y="0.0"/>
<duration>100.0</duration>
<timeWindows>
<timeWindow>
<start>6000.0</start>
<end>10000.0</end>
</timeWindow>
</timeWindows>
</delivery>
<capacity-dimensions>
<dimension index="0">10</dimension>
</capacity-dimensions>
</shipment>
</shipments>
<initialRoutes>
<route>
<driverId>noDriver</driverId>
<vehicleId>v1</vehicleId>
<start>10.</start>
<act type="pickupShipment">
<shipmentId>4</shipmentId>
</act>
<act type="deliverShipment">
<shipmentId>4</shipmentId>
</act>
<end/>
</route>
</initialRoutes>
</problem>

View file

@ -0,0 +1,165 @@
<?xml version="1.0" encoding="UTF-8"?>
<problem xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
<problemType>
<fleetSize>FINITE</fleetSize>
<fleetComposition>HETEROGENEOUS</fleetComposition>
</problemType>
<vehicles>
<vehicle>
<id>v1</id>
<location>
<id>depotLoc2</id>
<coord x="100.0" y="100.0"/>
</location>
<typeId>vehType</typeId>
<timeSchedule>
<start>0.0</start>
<end>1000.0</end>
</timeSchedule>
</vehicle>
<vehicle>
<id>v2</id>
<location>
<id>depotLoc</id>
<coord x="10.0" y="100.0"/>
</location>
<typeId>vehType2</typeId>
<timeSchedule>
<start>0.0</start>
<end>1000.0</end>
</timeSchedule>
</vehicle>
</vehicles>
<vehicleTypes>
<type>
<id>vehType</id>
<capacity>20</capacity>
<costs>
<fixed>0.0</fixed>
<distance>0.0</distance>
<time>0.0</time>
</costs>
</type>
<type>
<id>vehType2</id>
<capacity>200</capacity>
<costs>
<fixed>0.0</fixed>
<distance>0.0</distance>
<time>0.0</time>
</costs>
</type>
</vehicleTypes>
<services>
<service id="1" type="service">
<locationId>j(1,5)</locationId>
<coord x="10.0" y="10.0"/>
<capacity-demand>1</capacity-demand>
<duration>0.0</duration>
<timeWindows>
<timeWindow>
<start>0.0</start>
<end>4000.0</end>
</timeWindow>
</timeWindows>
</service>
<service id="2" type="service">
<locationId>i(3,9)</locationId>
<coord x="10.0" y="10.0"/>
<capacity-demand>1</capacity-demand>
<duration>0.0</duration>
<timeWindows>
<timeWindow>
<start>0.0</start>
<end>4000.0</end>
</timeWindow>
</timeWindows>
</service>
<service id="4" type="service">
<locationId>i(3,9)</locationId>
<coord x="10.0" y="10.0"/>
<capacity-demand>1</capacity-demand>
<duration>0.0</duration>
<timeWindows>
<timeWindow>
<start>0.0</start>
<end>4000.0</end>
</timeWindow>
</timeWindows>
</service>
</services>
<shipments>
<shipment id="3">
<pickup>
<locationId>i(3,9)</locationId>
<coord x="10.0" y="10.0"/>
<duration>0.0</duration>
<timeWindows>
<timeWindow>
<start>0.0</start>
<end>4000.0</end>
</timeWindow>
</timeWindows>
</pickup>
<delivery>
<locationId>i(9,9)</locationId>
<coord x="10.0" y="0.0"/>
<duration>0.0</duration>
<timeWindows>
<timeWindow>
<start>0.0</start>
<end>4000.0</end>
</timeWindow>
</timeWindows>
</delivery>
<capacity-demand>1</capacity-demand>
</shipment>
</shipments>
<solutions>
<solution>
<cost>100.0</cost>
<routes>
<route>
<cost>0.0</cost>
<driverId>noDriver</driverId>
<vehicleId>v1</vehicleId>
<start>10.0</start>
<act type="service">
<serviceId>1</serviceId>
<arrTime>20.0</arrTime>
<endTime>30.0</endTime>
</act>
<act type="service">
<serviceId>2</serviceId>
<arrTime>40.0</arrTime>
<endTime>80.0</endTime>
</act>
<act type="pickupShipment">
<shipmentId>3</shipmentId>
<arrTime>40.0</arrTime>
<endTime>80.0</endTime>
</act>
<act type="deliverShipment">
<shipmentId>3</shipmentId>
<arrTime>40.0</arrTime>
<endTime>80.0</endTime>
</act>
<end>100.0</end>
</route>
</routes>
<unassignedJobs>
<job id="4"/>
</unassignedJobs>
</solution>
</solutions>
</problem>

View file

@ -0,0 +1,132 @@
<?xml version="1.0" encoding="UTF-8"?>
<problem xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
<problemType>
<fleetSize>FINITE</fleetSize>
<fleetComposition>HOMOGENEOUS</fleetComposition>
</problemType>
<vehicles>
<vehicle>
<id>veh1</id>
<typeId>type1</typeId>
<startLocation>
<id>[x=0.0][y=0.0]</id>
<coord x="0.0" y="0.0"/>
</startLocation>
<endLocation>
<id>[x=0.0][y=0.0]</id>
<coord x="0.0" y="0.0"/>
</endLocation>
<timeSchedule>
<start>0.0</start>
<end>46800.0</end>
</timeSchedule>
<returnToDepot>true</returnToDepot>
</vehicle>
<vehicle>
<id>veh2</id>
<typeId>type1</typeId>
<startLocation>
<id>[x=0.0][y=0.0]</id>
<coord x="0.0" y="0.0"/>
</startLocation>
<endLocation>
<id>[x=0.0][y=0.0]</id>
<coord x="0.0" y="0.0"/>
</endLocation>
<timeSchedule>
<start>0.0</start>
<end>64800.0</end>
</timeSchedule>
<returnToDepot>true</returnToDepot>
</vehicle>
</vehicles>
<vehicleTypes>
<type>
<id>type1</id>
<capacity-dimensions>
<dimension index="0">0</dimension>
</capacity-dimensions>
<costs>
<fixed>0.0</fixed>
<distance>1.0</distance>
<time>0.0</time>
</costs>
</type>
</vehicleTypes>
<services>
<service id="2" type="service">
<locationId>loc_s2</locationId>
<coord x="10.0" y="0.0"/>
<capacity-dimensions>
<dimension index="0">0</dimension>
</capacity-dimensions>
<duration>0.0</duration>
</service>
<service id="1" type="service">
<locationId>loc_s1</locationId>
<coord x="20.0" y="0.0"/>
<capacity-dimensions>
<dimension index="0">0</dimension>
</capacity-dimensions>
<duration>0.0</duration>
</service>
</services>
<shipments>
<shipment id="3">
<pickup>
<locationId>loc_pickup_shipment_3</locationId>
<coord x="0." y="10.0"/>
</pickup>
<delivery>
<locationId>loc_deliver_shipment_3</locationId>
<coord x="0." y="20.0"/>
</delivery>
<capacity-dimensions>
<dimension index="0">0</dimension>
</capacity-dimensions>
</shipment>
<shipment id="4">
<pickup>
<locationId>loc_pickup_shipment_4</locationId>
<coord x="0." y="12.0"/>
</pickup>
<delivery>
<locationId>loc_deliver_shipment_4</locationId>
<coord x="0." y="18.0"/>
</delivery>
<capacity-dimensions>
<dimension index="0">0</dimension>
</capacity-dimensions>
</shipment>
</shipments>
<initialRoutes>
<route>
<driverId>noDriver</driverId>
<vehicleId>veh1</vehicleId>
<start>0.</start>
<act type="deliverService">
<serviceId>1</serviceId>
</act>
<end/>
</route>
<route>
<driverId>noDriver</driverId>
<vehicleId>veh2</vehicleId>
<start>0.</start>
<act type="pickupShipment">
<shipmentId>3</shipmentId>
</act>
<act type="deliverShipment">
<shipmentId>3</shipmentId>
</act>
<end/>
</route>
</initialRoutes>
</problem>

View file

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?>
<problem xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
<problemType>
<fleetSize>FINITE</fleetSize>
<fleetComposition>HOMOGENEOUS</fleetComposition>
</problemType>
<vehicles>
<vehicle>
<id>veh1</id>
<typeId>type1</typeId>
<startLocation>
<id>[x=0.0][y=0.0]</id>
<coord x="0.0" y="0.0"/>
</startLocation>
<endLocation>
<id>[x=0.0][y=0.0]</id>
<coord x="0.0" y="0.0"/>
</endLocation>
<timeSchedule>
<start>0.0</start>
<end>46800.0</end>
</timeSchedule>
<returnToDepot>true</returnToDepot>
</vehicle>
<vehicle>
<id>2</id>
<typeId>type1</typeId>
<startLocation>
<id>[x=0.0][y=0.0]</id>
<coord x="0.0" y="0.0"/>
</startLocation>
<endLocation>
<id>[x=0.0][y=0.0]</id>
<coord x="0.0" y="0.0"/>
</endLocation>
<timeSchedule>
<start>0.0</start>
<end>64800.0</end>
</timeSchedule>
<returnToDepot>true</returnToDepot>
</vehicle>
</vehicles>
<vehicleTypes>
<type>
<id>type1</id>
<capacity-dimensions>
<dimension index="0">0</dimension>
</capacity-dimensions>
<costs>
<fixed>0.0</fixed>
<distance>1.0</distance>
<time>0.0</time>
</costs>
</type>
</vehicleTypes>
<services>
<service id="2" type="service">
<locationId>loc_s2</locationId>
<coord x="1000.0" y="0.0"/>
<capacity-dimensions>
<dimension index="0">0</dimension>
</capacity-dimensions>
<duration>0.0</duration>
</service>
<service id="1" type="service">
<locationId>loc_s3</locationId>
<coord x="1000.0" y="1000.0"/>
<capacity-dimensions>
<dimension index="0">0</dimension>
</capacity-dimensions>
<duration>0.0</duration>
</service>
</services>
<initialRoutes>
<route>
<driverId>noDriver</driverId>
<vehicleId>veh1</vehicleId>
<start>0.</start>
<act type="deliverService">
<serviceId>1</serviceId>
</act>
<end/>
</route>
</initialRoutes>
</problem>

View file

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>
<problem xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
<problemType>
<fleetSize>FINITE</fleetSize>
<fleetComposition>HOMOGENEOUS</fleetComposition>
</problemType>
<vehicles>
<vehicle>
<id>veh1</id>
<typeId>type1</typeId>
<startLocation>
<id>[x=0.0][y=0.0]</id>
<coord x="0.0" y="0.0"/>
</startLocation>
<endLocation>
<id>[x=0.0][y=0.0]</id>
<coord x="0.0" y="0.0"/>
</endLocation>
<timeSchedule>
<start>0.0</start>
<end>46800.0</end>
</timeSchedule>
<returnToDepot>true</returnToDepot>
</vehicle>
</vehicles>
<vehicleTypes>
<type>
<id>type1</id>
<capacity-dimensions>
<dimension index="0">100</dimension>
</capacity-dimensions>
<costs>
<fixed>0.0</fixed>
<distance>1.0</distance>
<time>0.0</time>
</costs>
</type>
</vehicleTypes>
<shipments>
<shipment id="3">
<pickup>
<locationId>loc_pickup_shipment_3</locationId>
<coord x="0." y="10.0"/>
</pickup>
<delivery>
<locationId>loc_deliver_shipment_3</locationId>
<coord x="0." y="20.0"/>
</delivery>
<capacity-dimensions>
<dimension index="0">100</dimension>
</capacity-dimensions>
</shipment>
<shipment id="4">
<pickup>
<locationId>loc_pickup_shipment_4</locationId>
<coord x="0." y="12.0"/>
</pickup>
<delivery>
<locationId>loc_deliver_shipment_4</locationId>
<coord x="0." y="18.0"/>
</delivery>
<capacity-dimensions>
<dimension index="0">50</dimension>
</capacity-dimensions>
</shipment>
</shipments>
<initialRoutes>
<route>
<driverId>noDriver</driverId>
<vehicleId>veh1</vehicleId>
<start>0.</start>
<act type="pickupShipment">
<shipmentId>3</shipmentId>
</act>
<act type="deliverShipment">
<shipmentId>3</shipmentId>
</act>
<end/>
</route>
</initialRoutes>
</problem>

View file

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<problem xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3schools.com vrp_xml_schema.xsd">
<problemType>
<fleetSize>FINITE</fleetSize>
<fleetComposition>HOMOGENEOUS</fleetComposition>
</problemType>
<vehicles>
<vehicle>
<id>veh1</id>
<typeId>type1</typeId>
<startLocation>
<id>[x=5000.0][y=5000.0]</id>
<coord x="5000.0" y="5000.0"/>
</startLocation>
<timeSchedule>
<start>0.0</start>
<end>46800.0</end>
</timeSchedule>
<returnToDepot>true</returnToDepot>
</vehicle>
<vehicle>
<id>veh2</id>
<typeId>type1</typeId>
<startLocation>
<id>[x=0.0][y=0.0]</id>
<coord x="0.0" y="0.0"/>
</startLocation>
<timeSchedule>
<start>0.0</start>
<end>64800.0</end>
</timeSchedule>
<returnToDepot>true</returnToDepot>
</vehicle>
</vehicles>
<vehicleTypes>
<type>
<id>type1</id>
<capacity-dimensions>
<dimension index="0">0</dimension>
</capacity-dimensions>
<costs>
<fixed>0.0</fixed>
<distance>1.0</distance>
<time>0.0</time>
</costs>
</type>
</vehicleTypes>
<services>
<service id="2" type="service">
<locationId>loc_s2</locationId>
<coord x="1000.0" y="0.0"/>
<capacity-dimensions>
<dimension index="0">0</dimension>
</capacity-dimensions>
<duration>0.0</duration>
</service>
<service id="1" type="service">
<locationId>loc_s3</locationId>
<coord x="1000.0" y="1000.0"/>
<capacity-dimensions>
<dimension index="0">0</dimension>
</capacity-dimensions>
<duration>0.0</duration>
</service>
</services>
<initialRoutes>
<route>
<driverId>noDriver</driverId>
<vehicleId>veh1</vehicleId>
<start>0.</start>
<act type="deliverService">
<serviceId>1</serviceId>
</act>
<end/>
</route>
</initialRoutes>
</problem>