This project is an experimental environment for testing different optimisation libraries on the vehicle routing problem. The following libraries are used in this project
The project was initially set up to experiment with Optaplanner and later expanded to compare against other libraries.
The first alternate library that is supported is Or-tools. In the modelling the Optaplanner models are re-used extensively, which means
that Or-tools is accessed via these models. The adapters OptaplannerToOrToolsAdapter
and OrtoolsToOptaplannerAdapter
translate the model in and out.
Although the implementations only supports problems that are capacitated and time-windowed, the project is easily extendable to other vrp flavours.
This is done under the guise of different problem-types
. A problem-type is an arbitrary name for a certain vehicle routing problem,
e.g. a CVRPTW from Solomon, or a
CVRPTW from Gehring & Homberger. Currently, only problems of type
CVRPTW are supported and this is called SINTEF
in this project (from where the data is sourced).
This name is rather arbitrary and may change in the future. Other flavours of the VRP are not supported yet.
To implement your own flavour refer to the SintefVehicleRoutingSolution
and the Optaplanner vrp implementation
Optaplanner is loaded as a dependency using maven.
Or-tools is not available in the maven repository. Therefore to run or-tools one needs to download the library from
here. Place the google-ortools jar in the following folder:
/src/main/resources/lib/com.google.ortools.jar
(or adjust the pom.xml
accordingly.)
Note that on Windows the Visual Studio C++ redistributable needs to be installed for it to work.
The program supports the following program arguments:
-run-mode
or-m
. The mode to run the solver in. Acceptsoptaplanner
,or-tools
orbenchmark
.-problem-type
or-p
. The problem type to solve. Currently only supports theSINTEF
problem. See here-file-path
or-f
. The path for the problem to solve.-runtimeInMinutes
or-rt
. The runtime in minutes for the problem.
mvn clean install exec:java -Dexec.args="-m optaplanner -p SINTEF -runtimeInMinutes 1 -f input/sintef/homberger_1000_customer_instances/C1_10_2.TXT"
mvn clean install exec:java -Dexec.args="-m or-tools -p SINTEF -runtimeInMinutes 1 -f input/sintef/homberger_1000_customer_instances/C1_10_2.TXT"
The functionality to run the same problem set against different libraries can be accessed via the following command.
mvn clean install exec:java -Dexec.args="-m benchmark -p SINTEF -runtimeInMinutes 1 -f input/sintef/homberger_1000_customer_instances/ -o output.csv"