mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
create and add docs
This commit is contained in:
parent
432ec2fdd3
commit
af1ef088cd
8 changed files with 70 additions and 70 deletions
|
|
@ -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
|
||||
|
||||
<em>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.</em>
|
||||
<em>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.</em>
|
||||
|
||||
Please visit for example <a href="http://neo.lcc.uma.es/vrp/vrp-flavors/multiple-depot-vrp/" target="_blank">this site</a> 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:
|
||||
<pre><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");
|
||||
}
|
||||
</code></pre>
|
||||
|
||||
|
|
@ -24,7 +24,7 @@ All services of P08 are stored in an xml-file called vrp_cordeau_08.xml (you can
|
|||
|
||||
<pre><code>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");
|
||||
</code></pre>
|
||||
|
|
@ -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 <a href="https://github.com/jsprit/jsprit/blob/master/jsprit-examples/in
|
|||
|
||||

|
||||
|
||||
You can find the entire code <a href="https://github.com/jsprit/jsprit/blob/v1.4/jsprit-examples/src/main/java/jsprit/examples/MultipleDepotExampleWithPenaltyVehicles.java" target="_blank">here</a>.
|
||||
You can find the entire code <a href="https://github.com/jsprit/jsprit/blob/v1.4/jsprit-examples/src/main/java/jsprit/examples/MultipleDepotExampleWithPenaltyVehicles.java" target="_blank">here</a>.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
- benchmarking the algorithm
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
<em>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.</em>
|
||||
<em>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.</em>
|
||||
|
||||
Please visit for example <a href="http://neo.lcc.uma.es/vrp/vrp-flavors/multiple-depot-vrp/" target="_blank">this site</a> 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):
|
||||
<pre><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");
|
||||
}
|
||||
</code></pre>
|
||||
|
||||
|
|
@ -24,7 +24,7 @@ All services of P01 are stored in an xml-file called vrp_cordeau_01.xml (you can
|
|||
|
||||
<pre><code>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");
|
||||
</code></pre>
|
||||
|
|
@ -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 |
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
<pre><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");
|
||||
}
|
||||
</code></pre>
|
||||
|
||||
|
|
@ -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.
|
||||
|
||||
<pre><code>/*
|
||||
* 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<VehicleRoutingProblemSolution> solutions = algorithm.searchSolutions();
|
||||
|
||||
|
||||
/*
|
||||
* use helper to get the best
|
||||
* use helper to get the best
|
||||
*/
|
||||
VehicleRoutingProblemSolution bestSolution = Solutions.bestOf(solutions);
|
||||
</code></pre>
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
</code></pre>
|
||||
|
||||
|
|
@ -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.
|
||||
<pre><code>/*
|
||||
* 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");
|
||||
}
|
||||
</code></pre>
|
||||
|
||||
|
|
@ -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 |
|
||||
+----------------------------------------------------------+
|
||||
</samp></pre>
|
||||
|
||||
or you use the Print.VERBOSE level such as
|
||||
or you use the Print.VERBOSE level such as
|
||||
|
||||
<code>SolutionPrinter.print(problem, bestSolution, Print.VERBOSE);</code>
|
||||
|
||||
|
|
@ -151,4 +151,4 @@ or use the <em>very basic version</em> of the GraphStreamViewer which dynamicall
|
|||
<code>new GraphStreamViewer(problem, bestSolution).setRenderDelay(100).display();</code>
|
||||
|
||||
|
||||
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).
|
||||
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).
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
<strong>Note</strong> 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)).
|
||||
|
||||
<img src="https://github.com/jsprit/misc-rep/raw/master/wiki-images/vrpwbh_christophides_vrpnc1_solution.png">
|
||||
<img src="https://github.com/jsprit/misc-rep/raw/master/wiki-images/vrpwbh_christophides_vrpnc1_solution.png">
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
<pre><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");
|
||||
}
|
||||
</code></pre>
|
||||
|
||||
|
|
@ -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();
|
||||
</code></pre>
|
||||
|
||||
|
|
@ -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, <a href="https://github.com/jsprit/jsprit/wiki/Benchmark-VRPTW" target="_blank">here</a> you can find a set of ready-to-use and benchmarked algorithms.
|
||||
|
||||
<pre><code>/*
|
||||
* 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<VehicleRoutingProblemSolution> solutions = algorithm.searchSolutions();
|
||||
|
||||
|
||||
/*
|
||||
* use helper to get the best
|
||||
* use helper to get the best
|
||||
*/
|
||||
VehicleRoutingProblemSolution bestSolution = Solutions.bestOf(solutions);
|
||||
</code></pre>
|
||||
|
||||
Please visit <a href="https://github.com/jsprit/jsprit/wiki/Simple-Example">Simple Example</a> to get to know how you can analyse the solution.
|
||||
Please visit <a href="https://github.com/jsprit/jsprit/wiki/Simple-Example">Simple Example</a> to get to know how you can analyse the solution.
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue