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

@ -0,0 +1,276 @@
<?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/>.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.w3schools.com"
xmlns="http://www.w3schools.com" elementFormDefault="qualified">
<xs:element name="algorithm">
<xs:complexType>
<xs:sequence>
<xs:choice>
<xs:element name="iterations" type="xs:integer" minOccurs="0" maxOccurs="1"/>
<xs:element name="maxIterations" type="xs:integer" minOccurs="0" maxOccurs="1"/>
</xs:choice>
<xs:choice>
<xs:element name="prematureBreak" type="prematureBreakType" minOccurs="0" maxOccurs="1"/>
<xs:element name="terminationCriteria">
<xs:complexType>
<xs:sequence>
<xs:element name="termination" type="prematureBreakType" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
<xs:element name="construction" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="insertion" type="insertionType" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="strategy">
<xs:complexType>
<xs:sequence>
<xs:element name="memory" type="xs:integer" minOccurs="0" maxOccurs="1" default="1"/>
<xs:element name="searchStrategies" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="searchStrategy" type="searchStrategyType" minOccurs="1"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="searchStrategyType">
<xs:sequence>
<xs:element name="selector" type="selectorType"/>
<xs:element name="acceptor" type="acceptorType"/>
<xs:element name="modules" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="module" type="moduleType" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="probability">
<xs:simpleType>
<xs:restriction base="xs:double">
<xs:minInclusive value="0.0"/>
<xs:maxInclusive value="1.0"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
<xs:attribute name="name" type="xs:string"/>
</xs:complexType>
<xs:complexType name="selectorType">
<xs:attribute name="name">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="selectBest"/>
<xs:enumeration value="selectRandomly"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<xs:complexType name="acceptorType">
<xs:sequence>
<xs:element name="alpha" type="xs:double" minOccurs="0" maxOccurs="1"/>
<xs:choice>
<xs:element name="warmup" type="xs:int" minOccurs="0" maxOccurs="1"/>
<xs:element name="initialThreshold" type="xs:double" minOccurs="0" maxOccurs="1"/>
</xs:choice>
</xs:sequence>
<xs:attribute name="name">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="acceptNewRemoveWorst"/>
<xs:enumeration value="schrimpfAcceptance"/>
<xs:enumeration value="experimentalSchrimpfAcceptance"/>
<xs:enumeration value="acceptNewRemoveFirst"/>
<xs:enumeration value="greedyAcceptance"/>
<xs:enumeration value="greedyAcceptance_minVehFirst"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<xs:complexType name="prematureBreakType">
<xs:choice>
<xs:group ref="pBreak_iteration_group"/>
<xs:group ref="pBreak_time_group"/>
<xs:group ref="pBreak_variationCoefficient_group"/>
</xs:choice>
<xs:attribute name="basedOn">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="time"/>
<xs:enumeration value="iterations"/>
<xs:enumeration value="variationCoefficient"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<xs:group name="pBreak_iteration_group">
<xs:sequence>
<xs:element name="iterations" type="xs:integer" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:group>
<xs:group name="pBreak_time_group">
<xs:sequence>
<xs:element name="time" type="xs:long" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:group>
<xs:group name="pBreak_variationCoefficient_group">
<xs:sequence>
<xs:element name="threshold" type="xs:double" minOccurs="1" maxOccurs="1"/>
<xs:element name="iterations" type="xs:integer" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:group>
<xs:complexType name="moduleType">
<xs:choice>
<xs:group ref="ruin_and_recreate_group"/>
<xs:group ref="gendreau_group"/>
</xs:choice>
<xs:attribute name="name">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="ruin_and_recreate"/>
<xs:enumeration value="gendreau"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<xs:group name="ruin_and_recreate_group">
<xs:sequence>
<xs:element name="ruin" type="ruinType"/>
<xs:element name="insertion" type="insertionType"/>
</xs:sequence>
</xs:group>
<xs:group name="gendreau_group">
<xs:sequence>
<xs:element name="iterations" type="xs:integer"/>
<xs:element name="share" type="xs:double"/>
<xs:element name="ruin" type="ruinType"/>
<xs:element name="insertion" type="insertionType"/>
</xs:sequence>
</xs:group>
<xs:complexType name="ruinType">
<xs:sequence>
<xs:element name="share" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:double">
<xs:minInclusive value="0.0"/>
<xs:maxInclusive value="1.0"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="distance" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="euclidean"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
<xs:attribute name="name" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="randomRuin"/>
<xs:enumeration value="radialRuin"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="id" type="xs:string"/>
</xs:complexType>
<xs:complexType name="insertionType">
<xs:all>
<xs:element name="level" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="forwardLooking" type="xs:string"/>
<xs:attribute name="memory" type="xs:string"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="considerFixedCosts" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="weight" type="xs:double"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="allowVehicleSwitch" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
<xs:element name="fastRegret" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
<xs:element name="experimental" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:any minOccurs="0"/>
</xs:sequence>
<xs:attribute name="timeSlice" type="xs:string"/>
<xs:attribute name="neighboringSlices" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="name" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="bestInsertion"/>
<xs:enumeration value="regretInsertion"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="id" type="xs:string"/>
</xs:complexType>
</xs:schema>

View file

@ -0,0 +1,67 @@
<?xml version="1.0" ?>
<config>
<controler>
<iterations>2000</iterations>
</controler>
<construction>
<insertion name="bestInsertion"/>
</construction>
<strategy>
<memory>3</memory>
<searchStrategies>
<searchStrategy id="randomRuinAndRecreate">
<selector name="selectBest"/>
<acceptor name="acceptNewRemoveWorst"/>
<!-- <acceptor id="1" name="schrimpfAcceptance">
<alpha>0.1</alpha>
<iterations>10</iterations>
</acceptor> -->
<modules>
<module name="randomRuin">
<share>0.5</share>
</module>
<module name="bestInsertion"></module>
</modules>
<probability>0.5</probability>
</searchStrategy>
<searchStrategy id="radialRuinAndRecreate">
<selector id="1" name="selectBest"/>
<acceptor name="acceptNewRemoveWorst"/>
<!-- <acceptor id="1" name="schrimpfAcceptance">
<alpha>0.1</alpha>
<iterations>10</iterations>
</acceptor> -->
<modules>
<module name="radialRuin">
<share>0.3</share>
<distanceMeasure>euclid</distanceMeasure>
</module>
<module name="bestInsertion"></module>
</modules>
<probability>0.5</probability>
</searchStrategy>
<!-- <searchStrategy id="gendreauPostOpt"> -->
<!-- <modules> -->
<!-- <module name="gendreauPostOpt"> -->
<!-- <iterations>200</iterations> -->
<!-- <share>0.2</share> -->
<!-- </module> -->
<!-- </modules> -->
<!-- <probability>0.1</probability> -->
<!-- </searchStrategy> --> -->
</searchStrategies>
<before></before>
<after></after>
</strategy>
</config>

View file

@ -0,0 +1,49 @@
<?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,47 @@
<?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="acceptNewRemoveFirst"/>
<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="acceptNewRemoveFirst"/>
<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,52 @@
<?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="schrimpfAcceptance">
<alpha>0.4</alpha>
<warmup>100</warmup>
</acceptor>
<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="schrimpfAcceptance"/>
<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,405 @@
<?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/>.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.w3schools.com"
xmlns="http://www.w3schools.com" elementFormDefault="qualified">
<xs:element name="problem">
<xs:complexType>
<xs:sequence>
<xs:element name="problemType" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="fleetSize">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="INFINITE"/>
<xs:enumeration value="FINITE"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="fleetComposition" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="HOMOGENEOUS"/>
<xs:enumeration value="HETEROGENEOUS"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="vehicles" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="vehicle" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:all>
<xs:element name="id" type="xs:string" minOccurs="1" maxOccurs="1"/>
<xs:element name="location" type="locationType" minOccurs="0" maxOccurs="1"/>
<xs:element name="startLocation" type="locationType" minOccurs="0"
maxOccurs="1"/>
<xs:element name="endLocation" type="locationType" minOccurs="0" maxOccurs="1"/>
<xs:element name="typeId" type="xs:string" minOccurs="1" maxOccurs="1"/>
<xs:element name="timeSchedule" type="timeWindowType"/>
<xs:element name="returnToDepot" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
<xs:element name="skills" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="breaks" type="breaksType" minOccurs="0" maxOccurs="1"/>
</xs:all>
<xs:attribute name="type" type="xs:string" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="vehicleTypes" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="type" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:all>
<xs:element name="id" type="xs:string" minOccurs="1" maxOccurs="1"/>
<xs:element name="capacity" type="xs:integer" minOccurs="0" maxOccurs="1"
default="0"/>
<xs:element name="capacity-dimensions" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="dimension" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:integer">
<xs:attribute name="index" type="xs:integer"
use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="costs">
<xs:complexType>
<xs:all>
<xs:element name="fixed" type="xs:decimal" minOccurs="0"
maxOccurs="1" default="0.0"/>
<xs:element name="distance" type="xs:decimal" minOccurs="0"
maxOccurs="1" default="0.0"/>
<xs:element name="time" type="xs:decimal" minOccurs="0"
maxOccurs="1" default="0.0"/>
<xs:element name="service" type="xs:decimal" minOccurs="0"
maxOccurs="1" default="0.0"/>
<xs:element name="wait" type="xs:decimal" minOccurs="0"
maxOccurs="1" default="0.0"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="type" type="xs:string" use="optional"/>
<xs:attribute name="penaltyFactor" type="xs:string" use="optional"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="services" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="service" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:all>
<xs:element name="location" type="locationType" minOccurs="0" maxOccurs="1"/>
<xs:element name="locationId" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="coord" type="coordType" minOccurs="0" maxOccurs="1"/>
<xs:element name="name" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="capacity-demand" type="xs:integer" minOccurs="0" maxOccurs="1"
default="0"/>
<xs:element name="capacity-dimensions" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="dimension" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:integer">
<xs:attribute name="index" type="xs:integer"
use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="duration" type="xs:decimal" minOccurs="0" maxOccurs="1"
default="0.0"/>
<xs:element name="timeWindows" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="timeWindow" type="timeWindowType" minOccurs="1"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="requiredSkills" type="xs:string" minOccurs="0" maxOccurs="1"/>
</xs:all>
<xs:attribute name="id" type="xs:string" use="required"/>
<xs:attribute name="type" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="shipments" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="shipment" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:all>
<xs:element name="pickup" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:all>
<xs:element name="location" type="locationType" minOccurs="0"
maxOccurs="1"/>
<xs:element name="locationId" type="xs:string" minOccurs="0"
maxOccurs="1"/>
<xs:element name="coord" type="coordType" minOccurs="0"
maxOccurs="1"/>
<xs:element name="duration" type="xs:decimal" minOccurs="0"
maxOccurs="1" default="0.0"/>
<xs:element name="timeWindows" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="timeWindow" type="timeWindowType"
minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name="delivery" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:all>
<xs:element name="location" type="locationType" minOccurs="0"
maxOccurs="1"/>
<xs:element name="locationId" type="xs:string" minOccurs="0"
maxOccurs="1"/>
<xs:element name="coord" type="coordType" minOccurs="0"
maxOccurs="1"/>
<xs:element name="duration" type="xs:decimal" minOccurs="0"
maxOccurs="1" default="0.0"/>
<xs:element name="timeWindows" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="timeWindow" type="timeWindowType"
minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name="capacity-demand" type="xs:integer" minOccurs="0"
maxOccurs="1"/>
<xs:element name="capacity-dimensions" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="dimension" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:integer">
<xs:attribute name="index" type="xs:integer"
use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="requiredSkills" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="name" type="xs:string" minOccurs="0" maxOccurs="1"/>
</xs:all>
<xs:attribute name="id" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="initialRoutes" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="route" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="driverId" type="xs:string" minOccurs="1" maxOccurs="1"/>
<xs:element name="vehicleId" type="xs:string" minOccurs="1" maxOccurs="1"/>
<xs:element name="start" type="xs:double" minOccurs="1" maxOccurs="1"/>
<xs:element name="act" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:choice>
<xs:group ref="serviceActGroup"/>
<xs:group ref="shipmentActGroup"/>
<xs:group ref="breakActGroup"/>
</xs:choice>
<xs:attribute name="type" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="end" type="xs:anySimpleType" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="solutions" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="solution" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="cost" type="xs:decimal"/>
<xs:element name="routes" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="route" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="cost" type="xs:double" minOccurs="0"
maxOccurs="1"/>
<xs:element name="driverId" type="xs:string"
minOccurs="1" maxOccurs="1"/>
<xs:element name="vehicleId" type="xs:string"
minOccurs="1" maxOccurs="1"/>
<xs:element name="start" type="xs:double" minOccurs="1"
maxOccurs="1"/>
<xs:element name="act" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:choice>
<xs:group ref="serviceActGroup"/>
<xs:group ref="shipmentActGroup"/>
<xs:group ref="breakActGroup"/>
</xs:choice>
<xs:attribute name="type" type="xs:string"
use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="end" type="xs:double" minOccurs="1"
maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="unassignedJobs" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="job" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="id" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:group name="serviceActGroup">
<xs:sequence>
<xs:element name="serviceId" type="xs:string" minOccurs="1" maxOccurs="1"/>
<xs:element name="arrTime" type="xs:double" minOccurs="0" maxOccurs="1"/>
<xs:element name="endTime" type="xs:double" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:group>
<xs:group name="shipmentActGroup">
<xs:sequence>
<xs:element name="shipmentId" type="xs:string" minOccurs="1" maxOccurs="1"/>
<xs:element name="arrTime" type="xs:double" minOccurs="0" maxOccurs="1"/>
<xs:element name="endTime" type="xs:double" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:group>
<xs:group name="breakActGroup">
<xs:sequence>
<xs:element name="breakId" type="xs:string" minOccurs="1" maxOccurs="1"/>
<xs:element name="arrTime" type="xs:double" minOccurs="0" maxOccurs="1"/>
<xs:element name="endTime" type="xs:double" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:group>
<xs:complexType name="timeWindowType">
<xs:sequence>
<xs:element name="start" type="xs:double"/>
<xs:element name="end" type="xs:double"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="locationType">
<xs:all>
<xs:element name="id" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="coord" type="coordType" minOccurs="0" maxOccurs="1"/>
<xs:element name="index" type="xs:int" minOccurs="0" maxOccurs="1"/>
</xs:all>
</xs:complexType>
<xs:complexType name="breaksType">
<xs:sequence>
<xs:element name="timeWindows" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="timeWindow" type="timeWindowType" minOccurs="1"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="duration" type="xs:double" minOccurs="1" maxOccurs="1" default="0.0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="coordType">
<xs:attribute name="x" type="xs:double" use="required"/>
<xs:attribute name="y" type="xs:double" use="required"/>
</xs:complexType>
</xs:schema>

View file

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