From af1ef088cd37798d8dd4dc0d72d90a7ce958e033 Mon Sep 17 00:00:00 2001 From: oblonski Date: Thu, 1 Sep 2016 12:25:57 +0200 Subject: [PATCH] create and add docs --- docs/before-1.7/Bigger Multiple Depot VRP.md | 20 ++++++------ docs/before-1.7/More-Examples.md | 14 ++++---- docs/before-1.7/Multiple-Depot-VRP.md | 30 ++++++++--------- ...ssical-VRP-instance---with-time-windows.md | 16 +++++----- docs/before-1.7/Simple-Example.md | 32 +++++++++---------- ...th-depot-bounded-pickups-and-deliveries.md | 6 ++-- .../VRP-with-time-windows-example.md | 18 +++++------ .../Vrp-with-pickups-and-deliveries.md | 4 +-- 8 files changed, 70 insertions(+), 70 deletions(-) diff --git a/docs/before-1.7/Bigger Multiple Depot VRP.md b/docs/before-1.7/Bigger Multiple Depot VRP.md index e94b7795..6b581310 100644 --- a/docs/before-1.7/Bigger Multiple Depot VRP.md +++ b/docs/before-1.7/Bigger Multiple Depot VRP.md @@ -4,19 +4,19 @@ This example covers: - reading and creating an algorithm - plotting the solution -It is based on the problem instance P08 defined by +It is based on the problem instance P08 defined by -Cordeau, J.-F., Gendreau, M. and Laporte, G. (1997), A tabu search heuristic for periodic and multi-depot vehicle routing problems. Networks, 30: 105–119. +Cordeau, J.-F., Gendreau, M. and Laporte, G. (1997), A tabu search heuristic for periodic and multi-depot vehicle routing problems. Networks, 30: 105–119. Please visit for example this site to get more information on Multiple Depot VRP. -Before you start, [add the latest release to your pom](https://github.com/jsprit/jsprit/wiki/Add-latest-release-to-your-pom). Additionally, create an output folder in your project directory. Either do it manually or add the following lines to your code: +Before you start, [add the latest release to your pom](Add-latest-release-to-your-pom.md). Additionally, create an output folder in your project directory. Either do it manually or add the following lines to your code:
File dir = new File("output");
 // if the directory does not exist, create it
 if (!dir.exists()){
 	System.out.println("creating directory ./output");
-	boolean result = dir.mkdir();  
-	if(result) System.out.println("./output created");  
+	boolean result = dir.mkdir();
+	if(result) System.out.println("./output created");
 }
 
@@ -24,7 +24,7 @@ All services of P08 are stored in an xml-file called vrp_cordeau_08.xml (you can
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
 /*
- * Read cordeau-instance p08, BUT only its services without any vehicles 
+ * Read cordeau-instance p08, BUT only its services without any vehicles
  */
 new VrpXMLReader(vrpBuilder).read("input/vrp_cordeau_08.xml");
 
@@ -35,14 +35,14 @@ Define depots and vehicles: * add vehicles with its depots * 2 depots with the following coordinates: * (-33,33), (33,-33) - * + * * each with 14 vehicles each with a capacity of 500 and a maximum duration of 310 */ int nuOfVehicles = 14; int capacity = 500; double maxDuration = 310; Coordinate firstDepotCoord = Coordinate.newInstance(-33, 33); -Coordinate second = Coordinate.newInstance(33, -33); +Coordinate second = Coordinate.newInstance(33, -33); int depotCounter = 1; for(Coordinate depotCoord : Arrays.asList(firstDepotCoord,second)){ @@ -67,7 +67,7 @@ Build the problem, and define and run an algorithm like this: * define problem with finite fleet */ vrpBuilder.setFleetSize(FleetSize.FINITE); - + /* * build the problem */ @@ -87,4 +87,4 @@ Running here. \ No newline at end of file +You can find the entire code here. diff --git a/docs/before-1.7/More-Examples.md b/docs/before-1.7/More-Examples.md index 80679848..e5173c48 100644 --- a/docs/before-1.7/More-Examples.md +++ b/docs/before-1.7/More-Examples.md @@ -1,26 +1,26 @@ -#### [Multiple Depot VRP](https://github.com/jsprit/jsprit/wiki/Multiple-Depot-VRP) +#### [Multiple Depot VRP](Multiple-Depot-VRP.md) - setting up a VRP with Multiple Depots - defining depots, vehicles and their types - dealing with finite fleet size -#### [VRP with time windows](https://github.com/jsprit/jsprit/wiki/VRP-with-time-windows-example) +#### [VRP with time windows](VRP-with-time-windows-example.md) - defining and creating vehicles and their types - defining services with time-windows and service times - defining a problem with infinite fleet-size - reading, creating and running an algorithm -#### [VRP with backhauls](https://github.com/jsprit/jsprit/wiki/VRP-with-backhauls-example) +#### [VRP with backhauls](VRP-with-backhauls-example.md) - defining and creating pickup and deliveries - defining backhaul constraint -#### [VRP with backhauls (with mixed pickup and deliveries)](https://github.com/jsprit/jsprit/wiki/VRP-with-depot-bounded-pickups-and-deliveries) +#### [VRP with backhauls (with mixed pickup and deliveries)](VRP-with-depot-bounded-pickups-and-deliveries.md) - defining and creating depot-bounded pickups and deliveries -#### [VRP with pickup and delivieries](https://github.com/jsprit/jsprit/wiki/VRP-with-pickups-and-deliveries) +#### [VRP with pickup and delivieries](VRP-with-pickups-and-deliveries.md) - defining and creating pickups and deliveries -#### [VRP with heterogeneous fleet](https://github.com/jsprit/jsprit/wiki/Heterogeneous-Fleet) +#### [VRP with heterogeneous fleet](Heterogeneous-Fleet.md) - illustrating different problem types, - specifying heterogeneous fleet with its vehicles and vehicle-types, - specifying the algorithm, -- benchmarking the algorithm \ No newline at end of file +- benchmarking the algorithm diff --git a/docs/before-1.7/Multiple-Depot-VRP.md b/docs/before-1.7/Multiple-Depot-VRP.md index 7a2df1ab..08f94e4a 100644 --- a/docs/before-1.7/Multiple-Depot-VRP.md +++ b/docs/before-1.7/Multiple-Depot-VRP.md @@ -4,19 +4,19 @@ This example covers: - reading and creating an algorithm - plotting the solution -It is based on the problem instance P01 defined by +It is based on the problem instance P01 defined by -Cordeau, J.-F., Gendreau, M. and Laporte, G. (1997), A tabu search heuristic for periodic and multi-depot vehicle routing problems. Networks, 30: 105–119. +Cordeau, J.-F., Gendreau, M. and Laporte, G. (1997), A tabu search heuristic for periodic and multi-depot vehicle routing problems. Networks, 30: 105–119. Please visit for example this site to get more information on Multiple Depot VRP. -Before you start, [add the latest release to your pom](https://github.com/jsprit/jsprit/wiki/Add-latest-release-to-your-pom). Additionally, create an output folder in your project directory. Either do it manually or add the following lines to your code (even this obfuscates the code-example a bit): +Before you start, [add the latest release to your pom](Add-latest-release-to-your-pom.md). Additionally, create an output folder in your project directory. Either do it manually or add the following lines to your code (even this obfuscates the code-example a bit):
File dir = new File("output");
 // if the directory does not exist, create it
 if (!dir.exists()){
 	System.out.println("creating directory ./output");
-	boolean result = dir.mkdir();  
-	if(result) System.out.println("./output created");  
+	boolean result = dir.mkdir();
+	if(result) System.out.println("./output created");
 }
 
@@ -24,7 +24,7 @@ All services of P01 are stored in an xml-file called vrp_cordeau_01.xml (you can
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
 /*
- * Read cordeau-instance p01, BUT only its services without any vehicles 
+ * Read cordeau-instance p01, BUT only its services without any vehicles
  */
 new VrpXMLReader(vrpBuilder).read("input/vrp_cordeau_01.xml");
 
@@ -35,7 +35,7 @@ Define and add depots, vehicles and their types as follows: * add vehicles with its depots * 4 depots with the following coordinates: * (20,20), (30,40), (50,30), (60,50) - * + * * each with 4 vehicles each with a capacity of 80 */ int nuOfVehicles = 4; @@ -44,7 +44,7 @@ Coordinate firstDepotCoord = Coordinate.newInstance(20, 20); Coordinate second = Coordinate.newInstance(30, 40); Coordinate third = Coordinate.newInstance(50, 30); Coordinate fourth = Coordinate.newInstance(60, 50); - + int depotCounter = 1; for(Coordinate depotCoord : Arrays.asList(firstDepotCoord,second,third,fourth)){     for(int i=0;i<nuOfVehicles;i++){ @@ -68,7 +68,7 @@ Set finite fleet-size and build the problem. * define problem with finite fleet */ vrpBuilder.setFleetSize(FleetSize.FINITE); - + /* * build the problem */ @@ -108,18 +108,18 @@ and print the results to your console by: +---------------+----------+ | indicator | value | +---------------+----------+ -| nJobs | 50 | -| nServices | 50 | -| nShipments | 0 | -| fleetsize | FINITE | +| nJobs | 50 | +| nServices | 50 | +| nShipments | 0 | +| fleetsize | FINITE | +--------------------------+ +----------------------------------------------------------+ | solution | +---------------+------------------------------------------+ | indicator | value | +---------------+------------------------------------------+ -| costs | 582.9805315622696 | -| nVehicles | 11 | +| costs | 582.9805315622696 | +| nVehicles | 11 | +----------------------------------------------------------+ +--------------------------------------------------------------------------------------------------------------------------------+ | detailed solution | diff --git a/docs/before-1.7/Read-classical-VRP-instance---with-time-windows.md b/docs/before-1.7/Read-classical-VRP-instance---with-time-windows.md index 93c99046..6dfc8691 100644 --- a/docs/before-1.7/Read-classical-VRP-instance---with-time-windows.md +++ b/docs/before-1.7/Read-classical-VRP-instance---with-time-windows.md @@ -1,16 +1,16 @@ This example covers -- reading a classical VRP instance (here the Solomon instance C101), +- reading a classical VRP instance (here the Solomon instance C101), - plotting the problem, - reading and running a predefined algorithm, - plotting the solution. -Make sure, your pom is prepared (see [Add the latest snapshot to your pom](https://github.com/jsprit/jsprit/wiki/Add-latest-snapshot-to-your-pom)). Additionally, create an output folder in your project directory. Either do it manually or add the following lines to your code (even this obfuscates the code-example a bit): +Make sure, your pom is prepared (see [Add the latest snapshot to your pom](Add-latest-snapshot-to-your-pom.md)). Additionally, create an output folder in your project directory. Either do it manually or add the following lines to your code (even this obfuscates the code-example a bit):
File dir = new File("output");
 // if the directory does not exist, create it
 if (!dir.exists()){
 	System.out.println("creating directory ./output");
-	boolean result = dir.mkdir();  
-	if(result) System.out.println("./output created");  
+	boolean result = dir.mkdir();
+	if(result) System.out.println("./output created");
 }
 
@@ -44,17 +44,17 @@ It looks like [this](https://github.com/jsprit/misc-rep/raw/master/wiki-images/s To solve it, define an algorithm. Here, it comes out-of-the-box. The SchrimpfFactory creates an algo which is an implemenation of [Schrimpf et al.](http://www.sciencedirect.com/science/article/pii/S0021999199964136). In this configuration, it is best suited to solve the VRP with time windows.
/*
-* get the algorithm out-of-the-box. 
+* get the algorithm out-of-the-box.
 */
-VehicleRoutingAlgorithm algorithm = new SchrimpfFactory().createAlgorithm(problem);		
+VehicleRoutingAlgorithm algorithm = new SchrimpfFactory().createAlgorithm(problem);
 
 /*
 * and search a solution which returns a collection of solution (here only one solution is in the collection)
 */
 Collection solutions = algorithm.searchSolutions();
-	
+
 /*
- * use helper to get the best 
+ * use helper to get the best
  */
 VehicleRoutingProblemSolution bestSolution = Solutions.bestOf(solutions);
 
diff --git a/docs/before-1.7/Simple-Example.md b/docs/before-1.7/Simple-Example.md index 0d25569a..e367bae4 100644 --- a/docs/before-1.7/Simple-Example.md +++ b/docs/before-1.7/Simple-Example.md @@ -1,16 +1,16 @@ This example covers - building a problem, - building vehicleTypes and vehicles with capacity restriction, -- building services (or customer locations), +- building services (or customer locations), - plotting the problem, - reading and running a predefined algorithm, - writing out problem and solution, - plotting the solution, - printing solution stats. -[Add the latest release to your pom](https://github.com/jsprit/jsprit/wiki/Add-latest-release-to-your-pom). +[Add the latest release to your pom](Add-latest-release-to-your-pom.md). -Assume the following problem. We can employ one vehicle(-type) located at (10,10) with one capacity dimension, e.g. weight, and a capacity value of 2 to deliver four customers located at [(5,7),(5,13),(15,7),(15,13)], each with a demand that has a weight of 1. All employed vehicles need to return to their start-locations. Setting up this problem and solving it is as simple as coding the following lines: +Assume the following problem. We can employ one vehicle(-type) located at (10,10) with one capacity dimension, e.g. weight, and a capacity value of 2 to deliver four customers located at [(5,7),(5,13),(15,7),(15,13)], each with a demand that has a weight of 1. All employed vehicles need to return to their start-locations. Setting up this problem and solving it is as simple as coding the following lines: First, build a vehicle with its vehicle-type: @@ -27,7 +27,7 @@ VehicleType vehicleType = vehicleTypeBuilder.build(); */ VehicleImpl.Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle"); vehicleBuilder.setStartLocation(Location.newInstance(10, 10)); -vehicleBuilder.setType(vehicleType); +vehicleBuilder.setType(vehicleType); VehicleImpl vehicle = vehicleBuilder.build(); @@ -51,7 +51,7 @@ vrpBuilder.addVehicle(vehicle); vrpBuilder.addJob(service1).addJob(service2).addJob(service3).addJob(service4); /* * build the problem - * by default, the problem is specified such that FleetSize is INFINITE, i.e. an infinite number of + * by default, the problem is specified such that FleetSize is INFINITE, i.e. an infinite number of * the defined vehicles can be used to solve the problem * by default, transport costs are computed as Euclidean distances */ @@ -61,7 +61,7 @@ VehicleRoutingProblem problem = vrpBuilder.build(); Third, solve the problem by defining and running an algorithm. Here it comes out-of-the-box.
/*
-* get the algorithm out-of-the-box. 
+* get the algorithm out-of-the-box.
 */
 VehicleRoutingAlgorithm algorithm = Jsprit.createAlgorithm(problem);
 
@@ -81,8 +81,8 @@ Analysing the solution here, requires an output folder in your project-directory
 // if the directory does not exist, create it
 if (!dir.exists()){
 	System.out.println("creating directory ./output");
-	boolean result = dir.mkdir();  
-	if(result) System.out.println("./output created");  
+	boolean result = dir.mkdir();
+	if(result) System.out.println("./output created");
 }
 
@@ -102,22 +102,22 @@ which results in +---------------+----------+ | indicator | value | +---------------+----------+ -| nJobs | 4 | -| nServices | 4 | -| nShipments | 0 | -| fleetsize | INFINITE | +| nJobs | 4 | +| nServices | 4 | +| nShipments | 0 | +| fleetsize | INFINITE | +--------------------------+ +----------------------------------------------------------+ | solution | +---------------+------------------------------------------+ | indicator | value | +---------------+------------------------------------------+ -| costs | 35.3238075793812 | -| nVehicles | 2 | +| costs | 35.3238075793812 | +| nVehicles | 2 | +----------------------------------------------------------+ -or you use the Print.VERBOSE level such as +or you use the Print.VERBOSE level such as SolutionPrinter.print(problem, bestSolution, Print.VERBOSE); @@ -151,4 +151,4 @@ or use the very basic version of the GraphStreamViewer which dynamicall new GraphStreamViewer(problem, bestSolution).setRenderDelay(100).display(); -You can find the entire code [here](https://github.com/graphhopper/jsprit/blob/master/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SimpleExample.java). \ No newline at end of file +You can find the entire code [here](https://github.com/graphhopper/jsprit/blob/master/jsprit-examples/src/main/java/com/graphhopper/jsprit/examples/SimpleExample.java). diff --git a/docs/before-1.7/VRP-with-depot-bounded-pickups-and-deliveries.md b/docs/before-1.7/VRP-with-depot-bounded-pickups-and-deliveries.md index 4a04d780..a092a670 100644 --- a/docs/before-1.7/VRP-with-depot-bounded-pickups-and-deliveries.md +++ b/docs/before-1.7/VRP-with-depot-bounded-pickups-and-deliveries.md @@ -1,4 +1,4 @@ -This example assumes that you know [SimpleExample](https://github.com/jsprit/jsprit/wiki/Simple-Example) and covers: +This example assumes that you know [SimpleExample](Simple-Example.md) and covers: - defining pickups and deliveries Note that the VRP with Backhauls with mixed pickups and deliveries described here assumes that all deliveries are loaded in the depot at the beginning of a tour and all pickups are unloaded in the depot as well (at the end of the tour). En route pickup and deliveries such that a shipment is loaded at location A and unloaded again at location B within the same route (where A and B are unequal to the depot location) is covered [here](https://github.com/jsprit/jsprit/wiki/VRP-with-pickups-and-deliveries/). @@ -9,7 +9,7 @@ The only difference compared to SimpleExample is the creation of pickups and del */ Pickup pickup1 = (Pickup) Pickup.Builder.newInstance("1").addSizeDimension(0,1).setCoord(Coordinate.newInstance(5, 7)).build(); Delivery delivery1 = (Delivery) Delivery.Builder.newInstance("2").addSizeDimension(0,1).setCoord(Coordinate.newInstance(5, 13)).build(); - + Pickup pickup2 = (Pickup) Pickup.Builder.newInstance("3").addSizeDimension(0,1).setCoord(Coordinate.newInstance(15, 7)).build(); Delivery delivery2 = (Delivery) Delivery.Builder.newInstance("4").addSizeDimension(0,1).setCoord(Coordinate.newInstance(15, 13)).build(); @@ -34,4 +34,4 @@ The code of more advanced examples dealing with the pickup and deliveries can be The first customer in a route is marked with a red circle to indicate the orientation of the route. The labels represent the size of the pickup and delivery respectively. It is interesting to compare this with the solution of the same problem but with backhauls constraint, i.e. deliveries have to be conducted first (before pickups can be loaded) (see [VRP with backhauls](https://github.com/jsprit/jsprit/wiki/VRP-with-backhauls-example)). - \ No newline at end of file + diff --git a/docs/before-1.7/VRP-with-time-windows-example.md b/docs/before-1.7/VRP-with-time-windows-example.md index 5a768916..7402c8ee 100644 --- a/docs/before-1.7/VRP-with-time-windows-example.md +++ b/docs/before-1.7/VRP-with-time-windows-example.md @@ -4,13 +4,13 @@ This example covers: - defining a problem with infinite fleet-size - reading, creating and running an algorithm -Before you start, [add the latest release to your pom](https://github.com/jsprit/jsprit/wiki/Add-latest-release-to-your-pom). Additionally, create an output folder in your project directory. Either do it manually or add the following lines to your code (even this obfuscates the code-example a bit): +Before you start, [add the latest release to your pom](Add-latest-release-to-your-pom.md). Additionally, create an output folder in your project directory. Either do it manually or add the following lines to your code (even this obfuscates the code-example a bit):
File dir = new File("output");
 // if the directory does not exist, create it
 if (!dir.exists()){
 	System.out.println("creating directory ./output");
-	boolean result = dir.mkdir();  
-	if(result) System.out.println("./output created");  
+	boolean result = dir.mkdir();
+	if(result) System.out.println("./output created");
 }
 
@@ -34,7 +34,7 @@ VehicleType vehicleType = vehicleTypeBuilder.build(); VehicleImpl.Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle"); vehicleBuilder.setStartLocation(Location.newInstance(40, 50)); vehicleBuilder.setLatestArrival(1236); -vehicleBuilder.setType(vehicleType); +vehicleBuilder.setType(vehicleType); Vehicle vehicle = vehicleBuilder.build(); @@ -80,7 +80,7 @@ vrpBuilder.addJob(service3).addJob(service4).addJob(service5).addJob(service6); */ /* * build the problem - * by default, the problem is specified such that FleetSize is INFINITE, i.e. an infinite number of + * by default, the problem is specified such that FleetSize is INFINITE, i.e. an infinite number of * the defined vehicles can be used to solve the problem * by default, transport costs are computed as Euclidean distances */ @@ -93,7 +93,7 @@ To solve it, define an algorithm. Here, it comes out-of-the-box. The SchrimpfFac You might be interested in other algorithm configurations, here you can find a set of ready-to-use and benchmarked algorithms.
/*
-* get the algorithm out-of-the-box. 
+* get the algorithm out-of-the-box.
 */
 VehicleRoutingAlgorithm algorithm = Jsprit.createAlgorithm(problem);
 
@@ -101,11 +101,11 @@ VehicleRoutingAlgorithm algorithm = Jsprit.createAlgorithm(problem);
 * and search a solution which returns a collection of solution (here only one solution is in the collection)
 */
 Collection solutions = algorithm.searchSolutions();
-	
+
 /*
- * use helper to get the best 
+ * use helper to get the best
  */
 VehicleRoutingProblemSolution bestSolution = Solutions.bestOf(solutions);
 
-Please visit Simple Example to get to know how you can analyse the solution. \ No newline at end of file +Please visit Simple Example to get to know how you can analyse the solution. diff --git a/docs/before-1.7/Vrp-with-pickups-and-deliveries.md b/docs/before-1.7/Vrp-with-pickups-and-deliveries.md index a8868fbf..d57d07a1 100644 --- a/docs/before-1.7/Vrp-with-pickups-and-deliveries.md +++ b/docs/before-1.7/Vrp-with-pickups-and-deliveries.md @@ -1,4 +1,4 @@ -This example assumes that you know [SimpleExample](https://github.com/jsprit/jsprit/wiki/Simple-Example) and covers: +This example assumes that you know [SimpleExample](Simple-Example.md) and covers: - defining shipments The only difference compared to SimpleExample is the creation of shipments instead of services. However, you define them much like you define services: @@ -19,7 +19,7 @@ Shipment shipment3 = Shipment.Builder.newInstance("3").addSizeDimension(0,1).set .setDeliveryLocation(Location.newInstance(14, 9)).build(); Shipment shipment4 = Shipment.Builder.newInstance("4").addSizeDimension(0,1).setPickupLocation(Location.newInstance(15,13)) .setDeliveryLocation(Location.newInstance(14, 11)).build(); - + VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); /*