mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
Merge branch 'routes-with-specified-start-and-end' into
access-egress-costs-merged-with-routes-with-spec-start-end Conflicts: jsprit-core/src/test/java/jsprit/core/algorithm/recreate/TestCalculatesServiceInsertion.java jsprit-examples/src/main/java/jsprit/examples/MultipleDepotExampleWithPenaltyVehicles.java jsprit-examples/src/main/java/jsprit/examples/SolomonExample.java jsprit-examples/src/main/java/jsprit/examples/SolomonOpenExample.java
This commit is contained in:
commit
6dbcd7431a
75 changed files with 4281 additions and 525 deletions
|
|
@ -304,7 +304,7 @@ public class BicycleMessenger {
|
|||
|
||||
static double getTimeOfDirectRoute(Job job, Vehicle v, VehicleRoutingTransportCosts routingCosts) {
|
||||
Shipment envelope = (Shipment) job;
|
||||
double direct = routingCosts.getTransportTime(v.getLocationId(), envelope.getPickupLocation(), 0.0, DriverImpl.noDriver(), v) +
|
||||
double direct = routingCosts.getTransportTime(v.getStartLocationId(), envelope.getPickupLocation(), 0.0, DriverImpl.noDriver(), v) +
|
||||
routingCosts.getTransportTime(envelope.getPickupLocation(), envelope.getDeliveryLocation(), 0.0, DriverImpl.noDriver(), v);
|
||||
return direct;
|
||||
}
|
||||
|
|
@ -342,7 +342,7 @@ public class BicycleMessenger {
|
|||
if(firstLine) { firstLine = false; continue; }
|
||||
String[] tokens = line.split("\\s+");
|
||||
//build your vehicle
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance(tokens[1]).setLocationCoord(Coordinate.newInstance(Double.parseDouble(tokens[2]), Double.parseDouble(tokens[3])))
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance(tokens[1]).setStartLocationCoordinate(Coordinate.newInstance(Double.parseDouble(tokens[2]), Double.parseDouble(tokens[3])))
|
||||
.setReturnToDepot(false).setType(messengerType).build();
|
||||
problemBuilder.addVehicle(vehicle);
|
||||
//build the penalty vehicle
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ package jsprit.examples;
|
|||
|
||||
import java.util.Collection;
|
||||
|
||||
import jsprit.analysis.toolbox.SolutionPlotter;
|
||||
import jsprit.analysis.toolbox.Plotter;
|
||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||
import jsprit.core.algorithm.io.AlgorithmConfig;
|
||||
|
|
@ -57,7 +57,7 @@ public class ConfigureAlgorithmInCodeInsteadOfPerXml {
|
|||
* get a vehicle-builder and build a vehicle located at (10,10) with type "vehicleType"
|
||||
*/
|
||||
Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
|
||||
vehicleBuilder.setLocationCoord(Coordinate.newInstance(10, 10));
|
||||
vehicleBuilder.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
|
||||
vehicleBuilder.setType(vehicleType);
|
||||
Vehicle vehicle = vehicleBuilder.build();
|
||||
|
||||
|
|
@ -100,7 +100,7 @@ public class ConfigureAlgorithmInCodeInsteadOfPerXml {
|
|||
/*
|
||||
* plot
|
||||
*/
|
||||
SolutionPlotter.plotSolutionAsPNG(problem, bestSolution, "output/solution.png", "solution");
|
||||
new Plotter(problem,bestSolution).plot("output/solution.png", "solution");
|
||||
}
|
||||
|
||||
private static AlgorithmConfig getAlgorithmConfig() {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ package jsprit.examples;
|
|||
|
||||
import java.util.Collection;
|
||||
|
||||
import jsprit.analysis.toolbox.SolutionPlotter;
|
||||
import jsprit.analysis.toolbox.Plotter;
|
||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
||||
|
|
@ -54,7 +54,7 @@ public class CostMatrixExample {
|
|||
Examples.createOutputFolder();
|
||||
|
||||
VehicleType type = VehicleTypeImpl.Builder.newInstance("type", 2).setCostPerDistance(1).setCostPerTime(2).build();
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("vehicle").setLocationId("0").setType(type).build();
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance("vehicle").setStartLocationId("0").setType(type).build();
|
||||
|
||||
Service s1 = Service.Builder.newInstance("1", 1).setLocationId("1").build();
|
||||
Service s2 = Service.Builder.newInstance("2", 1).setLocationId("2").build();
|
||||
|
|
@ -105,9 +105,9 @@ public class CostMatrixExample {
|
|||
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
||||
|
||||
SolutionPrinter.print(Solutions.bestOf(solutions));
|
||||
|
||||
SolutionPlotter.plotSolutionAsPNG(vrp, Solutions.bestOf(solutions), "output/yo.png", "po");
|
||||
|
||||
|
||||
new Plotter(vrp, Solutions.bestOf(solutions)).plot("output/yo.png", "po");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ import jsprit.core.util.Solutions;
|
|||
import jsprit.util.Examples;
|
||||
|
||||
|
||||
public class EnRoutePickupAndDeliveryWithMultipleDepotsExample {
|
||||
public class EnRoutePickupAndDeliveryWithMultipleDepotsAndOpenRoutesExample {
|
||||
|
||||
public static void main(String[] args) {
|
||||
/*
|
||||
|
|
@ -56,35 +56,33 @@ public class EnRoutePickupAndDeliveryWithMultipleDepotsExample {
|
|||
VehicleType vehicleType = vehicleTypeBuilder.build();
|
||||
|
||||
/*
|
||||
* define two depots, i.e. two vehicle locations ([10,10],[50,50]) and equip them with an infinite number of vehicles of type 'vehicleType'
|
||||
* define two vehicles and their start-locations
|
||||
*
|
||||
* the first two do need to return to depot
|
||||
*/
|
||||
Builder vehicleBuilder1 = VehicleImpl.Builder.newInstance("vehicles@[10,10]");
|
||||
vehicleBuilder1.setLocationCoord(Coordinate.newInstance(10, 10));
|
||||
vehicleBuilder1.setStartLocationCoordinate(Coordinate.newInstance(10, 10)).setReturnToDepot(false);
|
||||
vehicleBuilder1.setType(vehicleType);
|
||||
Vehicle vehicle1 = vehicleBuilder1.build();
|
||||
|
||||
Builder vehicleBuilder2 = VehicleImpl.Builder.newInstance("vehicles@[30,30]");
|
||||
vehicleBuilder2.setLocationCoord(Coordinate.newInstance(30, 30));
|
||||
vehicleBuilder2.setStartLocationCoordinate(Coordinate.newInstance(30, 30)).setReturnToDepot(false);
|
||||
vehicleBuilder2.setType(vehicleType);
|
||||
Vehicle vehicle2 = vehicleBuilder2.build();
|
||||
|
||||
Builder vehicleBuilder3 = VehicleImpl.Builder.newInstance("vehicles@[10,30]");
|
||||
vehicleBuilder3.setLocationCoord(Coordinate.newInstance(10, 30));
|
||||
vehicleBuilder3.setStartLocationCoordinate(Coordinate.newInstance(10, 30));
|
||||
vehicleBuilder3.setType(vehicleType);
|
||||
Vehicle vehicle3 = vehicleBuilder3.build();
|
||||
|
||||
Builder vehicleBuilder4 = VehicleImpl.Builder.newInstance("vehicles@[30,10]");
|
||||
vehicleBuilder4.setLocationCoord(Coordinate.newInstance(30, 10));
|
||||
vehicleBuilder4.setStartLocationCoordinate(Coordinate.newInstance(30, 10));
|
||||
vehicleBuilder4.setType(vehicleType);
|
||||
Vehicle vehicle4 = vehicleBuilder4.build();
|
||||
|
||||
/*
|
||||
* build shipments at the required locations, each with a capacity-demand of 1.
|
||||
* 4 shipments
|
||||
* 1: (5,7)->(6,9)
|
||||
* 2: (5,13)->(6,11)
|
||||
* 3: (15,7)->(14,9)
|
||||
* 4: (15,13)->(14,11)
|
||||
|
||||
*/
|
||||
|
||||
Shipment shipment1 = Shipment.Builder.newInstance("1", 1).setPickupCoord(Coordinate.newInstance(5, 7)).setDeliveryCoord(Coordinate.newInstance(6, 9)).build();
|
||||
|
|
@ -23,17 +23,13 @@ import jsprit.analysis.toolbox.GraphStreamViewer.Label;
|
|||
import jsprit.analysis.toolbox.SolutionPrinter;
|
||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
||||
import jsprit.core.algorithm.recreate.listener.JobInsertedListener;
|
||||
import jsprit.core.algorithm.state.StateManager;
|
||||
import jsprit.core.algorithm.state.StateUpdater;
|
||||
import jsprit.core.algorithm.termination.IterationWithoutImprovementTermination;
|
||||
import jsprit.core.problem.VehicleRoutingProblem;
|
||||
import jsprit.core.problem.VehicleRoutingProblem.FleetSize;
|
||||
import jsprit.core.problem.constraint.HardRouteStateLevelConstraint;
|
||||
import jsprit.core.problem.job.Job;
|
||||
import jsprit.core.problem.job.Shipment;
|
||||
import jsprit.core.problem.misc.JobInsertionContext;
|
||||
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||
import jsprit.core.problem.solution.route.VehicleRoute;
|
||||
import jsprit.core.problem.vehicle.Vehicle;
|
||||
import jsprit.core.problem.vehicle.VehicleImpl;
|
||||
import jsprit.core.problem.vehicle.VehicleImpl.Builder;
|
||||
|
|
@ -44,24 +40,7 @@ import jsprit.core.util.Solutions;
|
|||
import jsprit.util.Examples;
|
||||
|
||||
|
||||
public class EnRoutePickupAndDeliveryWithMultipleDepotsAndVehicleAccessConstraintExample {
|
||||
|
||||
static class ClusterMem implements StateUpdater, JobInsertedListener {
|
||||
|
||||
private StateManager stateManager;
|
||||
|
||||
public ClusterMem(StateManager stateManager) {
|
||||
super();
|
||||
this.stateManager = stateManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void informJobInserted(Job job2insert, VehicleRoute inRoute, double additionalCosts, double additionalTime) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public class EnRoutePickupAndDeliveryWithMultipleDepotsAndVehicleAccessConstraintAndSpecifiedVehicleEndLocationsExample {
|
||||
|
||||
public static void main(String[] args) {
|
||||
/*
|
||||
|
|
@ -77,37 +56,28 @@ public class EnRoutePickupAndDeliveryWithMultipleDepotsAndVehicleAccessConstrain
|
|||
VehicleType vehicleType = vehicleTypeBuilder.build();
|
||||
|
||||
/*
|
||||
* define two depots, i.e. two vehicle locations ([10,10],[50,50]) and equip them with an infinite number of vehicles of type 'vehicleType'
|
||||
* define two vehicles and their locations.
|
||||
*
|
||||
* this example employs two vehicles. one that has to return to its start-location (vehicle1) and one that has a different
|
||||
* end-location.
|
||||
*
|
||||
* play with these location to see which impact they have on customer-sequences.
|
||||
*/
|
||||
Builder vehicleBuilder1 = VehicleImpl.Builder.newInstance("v1");
|
||||
vehicleBuilder1.setLocationCoord(Coordinate.newInstance(10, 10));
|
||||
vehicleBuilder1.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
|
||||
vehicleBuilder1.setType(vehicleType);
|
||||
Vehicle vehicle1 = vehicleBuilder1.build();
|
||||
|
||||
Builder vehicleBuilder2 = VehicleImpl.Builder.newInstance("v2");
|
||||
vehicleBuilder2.setLocationCoord(Coordinate.newInstance(30, 30));
|
||||
vehicleBuilder2.setStartLocationCoordinate(Coordinate.newInstance(30, 30)).setEndLocationCoordinate(Coordinate.newInstance(30, 19));
|
||||
vehicleBuilder2.setType(vehicleType);
|
||||
Vehicle vehicle2 = vehicleBuilder2.build();
|
||||
|
||||
Builder vehicleBuilder3 = VehicleImpl.Builder.newInstance("v3");
|
||||
vehicleBuilder3.setLocationCoord(Coordinate.newInstance(10, 30));
|
||||
vehicleBuilder3.setType(vehicleType);
|
||||
Vehicle vehicle3 = vehicleBuilder3.build();
|
||||
|
||||
Builder vehicleBuilder4 = VehicleImpl.Builder.newInstance("v4");
|
||||
vehicleBuilder4.setLocationCoord(Coordinate.newInstance(30, 10));
|
||||
vehicleBuilder4.setType(vehicleType);
|
||||
Vehicle vehicle4 = vehicleBuilder4.build();
|
||||
|
||||
|
||||
/*
|
||||
* build shipments at the required locations, each with a capacity-demand of 1.
|
||||
* 4 shipments
|
||||
* 1: (5,7)->(6,9)
|
||||
* 2: (5,13)->(6,11)
|
||||
* 3: (15,7)->(14,9)
|
||||
* 4: (15,13)->(14,11)
|
||||
*
|
||||
*/
|
||||
|
||||
Shipment shipment1 = Shipment.Builder.newInstance("1", 1).setPickupCoord(Coordinate.newInstance(5, 7)).setDeliveryCoord(Coordinate.newInstance(6, 9)).build();
|
||||
Shipment shipment2 = Shipment.Builder.newInstance("2", 1).setPickupCoord(Coordinate.newInstance(5, 13)).setDeliveryCoord(Coordinate.newInstance(6, 11)).build();
|
||||
|
||||
|
|
@ -140,30 +110,31 @@ public class EnRoutePickupAndDeliveryWithMultipleDepotsAndVehicleAccessConstrain
|
|||
|
||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||
vrpBuilder.addVehicle(vehicle1).addVehicle(vehicle2);
|
||||
// vrpBuilder.addVehicle(vehicle1).addVehicle(vehicle2).addVehicle(vehicle3).addVehicle(vehicle4);
|
||||
vrpBuilder.addJob(shipment1).addJob(shipment2).addJob(shipment3).addJob(shipment4);
|
||||
vrpBuilder.addJob(shipment5).addJob(shipment6).addJob(shipment7).addJob(shipment8);
|
||||
vrpBuilder.addJob(shipment9).addJob(shipment10).addJob(shipment11).addJob(shipment12);
|
||||
vrpBuilder.addJob(shipment13).addJob(shipment14).addJob(shipment15).addJob(shipment16);
|
||||
vrpBuilder.addJob(shipment17).addJob(shipment18).addJob(shipment19).addJob(shipment20);
|
||||
|
||||
//you only have two vehicles
|
||||
vrpBuilder.setFleetSize(FleetSize.FINITE);
|
||||
|
||||
//vehicle1 cannot go to x>15 and vehicle2 cannot go to x<15
|
||||
/*
|
||||
* switch off the geoConstraints to show the effects without
|
||||
* add a geographic constraint determining that vehicle1 cannot go to x>15 and vehicle2 cannot go to x<15
|
||||
*
|
||||
* switch off the geoConstraints to see the impact of this constraint on routes, or just exchange v1 and v2 to reverse the geo-constraint.
|
||||
*/
|
||||
HardRouteStateLevelConstraint geoClusterConstraint = new HardRouteStateLevelConstraint() {
|
||||
|
||||
@Override
|
||||
public boolean fulfilled(JobInsertionContext insertionContext) {
|
||||
Shipment shipment2insert = ((Shipment)insertionContext.getJob());
|
||||
if(insertionContext.getNewVehicle().getId().equals("v2")){
|
||||
if(insertionContext.getNewVehicle().getId().equals("v1")){
|
||||
if(shipment2insert.getPickupCoord().getX() > 15. || shipment2insert.getDeliveryCoord().getX() > 15.){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(insertionContext.getNewVehicle().getId().equals("v1")){
|
||||
if(insertionContext.getNewVehicle().getId().equals("v2")){
|
||||
if(shipment2insert.getPickupCoord().getX() < 15. || shipment2insert.getDeliveryCoord().getX() < 15.){
|
||||
return false;
|
||||
}
|
||||
|
|
@ -171,17 +142,23 @@ public class EnRoutePickupAndDeliveryWithMultipleDepotsAndVehicleAccessConstrain
|
|||
return true;
|
||||
}
|
||||
};
|
||||
//add the constraint to the problem
|
||||
vrpBuilder.addConstraint(geoClusterConstraint);
|
||||
|
||||
//build the problem
|
||||
VehicleRoutingProblem problem = vrpBuilder.build();
|
||||
|
||||
// StateManager stateManager = new StateManager(problem);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* get the algorithm out-of-the-box.
|
||||
* get a sample algorithm.
|
||||
*
|
||||
* Note that you need to make sure to prohibit vehicle-switching by adding the insertion-tag <vehicleSwitchAllowed>false</vehicleSwitchAllowed>.
|
||||
* This way you make sure that no vehicle can take over a route that is employed by another. Allowing this might make sense when dealing with
|
||||
* a heterogeneous fleet and you want to employ a bigger vehicle on a still existing route. However, allowing it makes constraint-checking
|
||||
* bit more complicated and you cannot just add the above hard-constraint. Latter will be covered in another example.
|
||||
*
|
||||
*/
|
||||
VehicleRoutingAlgorithm algorithm = VehicleRoutingAlgorithms.readAndCreateAlgorithm(problem, "input/algorithmConfig_noVehicleSwitch.xml");
|
||||
algorithm.setPrematureAlgorithmTermination(new IterationWithoutImprovementTermination(100));
|
||||
// algorithm.setNuOfIterations(30000);
|
||||
/*
|
||||
* and search a solution
|
||||
|
|
@ -217,6 +194,8 @@ public class EnRoutePickupAndDeliveryWithMultipleDepotsAndVehicleAccessConstrain
|
|||
// solutionPlotter.plotShipments(true);
|
||||
// solutionPlotter.plot("output/enRoutePickupAndDeliveryWithMultipleLocationsExample_solution.png", "en-route pickup and delivery");
|
||||
|
||||
new GraphStreamViewer(problem).labelWith(Label.ID).setRenderDelay(100).setRenderShipments(true).display();
|
||||
|
||||
new GraphStreamViewer(problem,Solutions.bestOf(solutions)).labelWith(Label.ACTIVITY).setRenderDelay(100).setRenderShipments(true).display();
|
||||
|
||||
}
|
||||
|
|
@ -81,17 +81,17 @@ public class HVRPExample {
|
|||
//add vehicle - finite fleet
|
||||
//2xtype1
|
||||
VehicleType type1 = VehicleTypeImpl.Builder.newInstance("type_1", 120).setCostPerDistance(1.0).build();
|
||||
VehicleImpl vehicle1_1 = VehicleImpl.Builder.newInstance("1_1").setLocationCoord(Coordinate.newInstance(40, 40)).setType(type1).build();
|
||||
VehicleImpl vehicle1_1 = VehicleImpl.Builder.newInstance("1_1").setStartLocationCoordinate(Coordinate.newInstance(40, 40)).setType(type1).build();
|
||||
vrpBuilder.addVehicle(vehicle1_1);
|
||||
VehicleImpl vehicle1_2 = VehicleImpl.Builder.newInstance("1_2").setLocationCoord(Coordinate.newInstance(40, 40)).setType(type1).build();
|
||||
VehicleImpl vehicle1_2 = VehicleImpl.Builder.newInstance("1_2").setStartLocationCoordinate(Coordinate.newInstance(40, 40)).setType(type1).build();
|
||||
vrpBuilder.addVehicle(vehicle1_2);
|
||||
//1xtype2
|
||||
VehicleType type2 = VehicleTypeImpl.Builder.newInstance("type_2", 160).setCostPerDistance(1.1).build();
|
||||
VehicleImpl vehicle2_1 = VehicleImpl.Builder.newInstance("2_1").setLocationCoord(Coordinate.newInstance(40, 40)).setType(type2).build();
|
||||
VehicleImpl vehicle2_1 = VehicleImpl.Builder.newInstance("2_1").setStartLocationCoordinate(Coordinate.newInstance(40, 40)).setType(type2).build();
|
||||
vrpBuilder.addVehicle(vehicle2_1);
|
||||
//1xtype3
|
||||
VehicleType type3 = VehicleTypeImpl.Builder.newInstance("type_3", 300).setCostPerDistance(1.3).build();
|
||||
VehicleImpl vehicle3_1 = VehicleImpl.Builder.newInstance("3_1").setLocationCoord(Coordinate.newInstance(40, 40)).setType(type3).build();
|
||||
VehicleImpl vehicle3_1 = VehicleImpl.Builder.newInstance("3_1").setStartLocationCoordinate(Coordinate.newInstance(40, 40)).setType(type3).build();
|
||||
vrpBuilder.addVehicle(vehicle3_1);
|
||||
|
||||
//add penaltyVehicles to allow invalid solutions temporarily
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import java.util.Collection;
|
|||
|
||||
import jsprit.analysis.toolbox.AlgorithmSearchProgressChartListener;
|
||||
import jsprit.analysis.toolbox.GraphStreamViewer;
|
||||
import jsprit.analysis.toolbox.SolutionPlotter;
|
||||
import jsprit.analysis.toolbox.Plotter;
|
||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
||||
import jsprit.analysis.toolbox.StopWatch;
|
||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||
|
|
@ -77,7 +77,7 @@ public class MultipleDepotExample {
|
|||
for(Coordinate depotCoord : Arrays.asList(firstDepotCoord,second,third,fourth)){
|
||||
for(int i=0;i<nuOfVehicles;i++){
|
||||
VehicleTypeImpl vehicleType = VehicleTypeImpl.Builder.newInstance(depotCounter + "_type", capacity).setCostPerDistance(1.0).build();
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance(depotCounter + "_" + (i+1) + "_vehicle").setLocationCoord(depotCoord).setType(vehicleType).build();
|
||||
Vehicle vehicle = VehicleImpl.Builder.newInstance(depotCounter + "_" + (i+1) + "_vehicle").setStartLocationCoordinate(depotCoord).setType(vehicleType).build();
|
||||
vrpBuilder.addVehicle(vehicle);
|
||||
}
|
||||
depotCounter++;
|
||||
|
|
@ -107,8 +107,9 @@ public class MultipleDepotExample {
|
|||
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
||||
|
||||
SolutionPrinter.print(Solutions.bestOf(solutions));
|
||||
SolutionPlotter.plotSolutionAsPNG(vrp, Solutions.bestOf(solutions), "output/p01_solution.png", "p01");
|
||||
|
||||
|
||||
new Plotter(vrp, Solutions.bestOf(solutions)).plot("output/p01_solution.png", "p01");
|
||||
|
||||
new GraphStreamViewer(vrp, Solutions.bestOf(solutions)).setRenderDelay(100).display();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import java.util.Collection;
|
|||
|
||||
import jsprit.analysis.toolbox.AlgorithmSearchProgressChartListener;
|
||||
import jsprit.analysis.toolbox.GraphStreamViewer;
|
||||
import jsprit.analysis.toolbox.SolutionPlotter;
|
||||
import jsprit.analysis.toolbox.Plotter;
|
||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
||||
import jsprit.analysis.toolbox.SolutionPrinter.Print;
|
||||
import jsprit.analysis.toolbox.StopWatch;
|
||||
|
|
@ -78,7 +78,7 @@ public class MultipleDepotExampleWithPenaltyVehicles {
|
|||
VehicleType vehicleType = VehicleTypeImpl.Builder.newInstance(depotCounter + "_type", capacity).setCostPerDistance(1.0).build();
|
||||
String vehicleId = depotCounter + "_" + (i+1) + "_vehicle";
|
||||
VehicleImpl.Builder vehicleBuilder = VehicleImpl.Builder.newInstance(vehicleId);
|
||||
vehicleBuilder.setLocationCoord(depotCoord);
|
||||
vehicleBuilder.setStartLocationCoordinate(depotCoord);
|
||||
vehicleBuilder.setType(vehicleType);
|
||||
vehicleBuilder.setLatestArrival(maxDuration);
|
||||
Vehicle vehicle = vehicleBuilder.build();
|
||||
|
|
@ -116,8 +116,9 @@ public class MultipleDepotExampleWithPenaltyVehicles {
|
|||
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
||||
|
||||
SolutionPrinter.print(vrp,Solutions.bestOf(solutions),Print.VERBOSE);
|
||||
SolutionPlotter.plotSolutionAsPNG(vrp, Solutions.bestOf(solutions), "output/p08_solution.png", "p08");
|
||||
|
||||
new Plotter(vrp, Solutions.bestOf(solutions)).plot("output/p08_solution.png", "p08");
|
||||
|
||||
new GraphStreamViewer(vrp,Solutions.bestOf(solutions)).setRenderDelay(50).display();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import java.util.Collection;
|
|||
import jsprit.analysis.toolbox.AlgorithmSearchProgressChartListener;
|
||||
import jsprit.analysis.toolbox.Plotter;
|
||||
import jsprit.analysis.toolbox.Plotter.Label;
|
||||
import jsprit.analysis.toolbox.SolutionPlotter;
|
||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
||||
|
|
@ -59,7 +58,8 @@ public class PickupAndDeliveryExample {
|
|||
|
||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
|
||||
SolutionPlotter.plotVrpAsPNG(vrp, "output/pd_solomon_r101.png", "pd_r101");
|
||||
new Plotter(vrp).plot("output/pd_solomon_r101.png", "pd_r101");
|
||||
|
||||
|
||||
/*
|
||||
* Define the required vehicle-routing algorithms to solve the above problem.
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import jsprit.analysis.toolbox.AlgorithmSearchProgressChartListener;
|
|||
import jsprit.analysis.toolbox.GraphStreamViewer;
|
||||
import jsprit.analysis.toolbox.Plotter;
|
||||
import jsprit.analysis.toolbox.Plotter.Label;
|
||||
import jsprit.analysis.toolbox.SolutionPlotter;
|
||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
||||
|
|
@ -65,7 +64,8 @@ public class PickupAndDeliveryExample2 {
|
|||
|
||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
|
||||
SolutionPlotter.plotVrpAsPNG(vrp, "output/pd_christophides_vrpnc1.png", "pd_vrpnc1");
|
||||
new Plotter(vrp).plot("output/pd_christophides_vrpnc1.png", "pd_vrpnc1");
|
||||
|
||||
|
||||
/*
|
||||
* Define the required vehicle-routing algorithms to solve the above problem.
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ public class RefuseCollectionExample {
|
|||
VehicleTypeImpl bigType = typeBuilder.build();
|
||||
|
||||
VehicleImpl.Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
|
||||
vehicleBuilder.setLocationId("1");
|
||||
vehicleBuilder.setStartLocationId("1");
|
||||
vehicleBuilder.setType(bigType);
|
||||
Vehicle bigVehicle = vehicleBuilder.build();
|
||||
|
||||
|
|
|
|||
|
|
@ -58,12 +58,12 @@ public class ServicePickupsWithMultipleDepotsExample {
|
|||
* define two depots, i.e. two vehicle locations ([10,10],[50,50]) and equip them with an infinite number of vehicles of type 'vehicleType'
|
||||
*/
|
||||
Builder vehicleBuilder1 = VehicleImpl.Builder.newInstance("vehicles@[10,10]");
|
||||
vehicleBuilder1.setLocationCoord(Coordinate.newInstance(10, 10));
|
||||
vehicleBuilder1.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
|
||||
vehicleBuilder1.setType(vehicleType);
|
||||
Vehicle vehicle1 = vehicleBuilder1.build();
|
||||
|
||||
Builder vehicleBuilder2 = VehicleImpl.Builder.newInstance("vehicles@[50,50]");
|
||||
vehicleBuilder2.setLocationCoord(Coordinate.newInstance(50, 50));
|
||||
vehicleBuilder2.setStartLocationCoordinate(Coordinate.newInstance(50, 50));
|
||||
vehicleBuilder2.setType(vehicleType);
|
||||
Vehicle vehicle2 = vehicleBuilder2.build();
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ public class SimpleDepotBoundedPickupAndDeliveryExample {
|
|||
* get a vehicle-builder and build a vehicle located at (10,10) with type "vehicleType"
|
||||
*/
|
||||
Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
|
||||
vehicleBuilder.setLocationCoord(Coordinate.newInstance(10, 10));
|
||||
vehicleBuilder.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
|
||||
vehicleBuilder.setType(vehicleType);
|
||||
Vehicle vehicle = vehicleBuilder.build();
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ public class SimpleEnRoutePickupAndDeliveryExample {
|
|||
* get a vehicle-builder and build a vehicle located at (10,10) with type "vehicleType"
|
||||
*/
|
||||
Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
|
||||
vehicleBuilder.setLocationCoord(Coordinate.newInstance(10, 10));
|
||||
vehicleBuilder.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
|
||||
vehicleBuilder.setType(vehicleType);
|
||||
Vehicle vehicle = vehicleBuilder.build();
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ public class SimpleEnRoutePickupAndDeliveryOpenRoutesExample {
|
|||
* get a vehicle-builder and build a vehicle located at (10,10) with type "vehicleType"
|
||||
*/
|
||||
Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
|
||||
vehicleBuilder.setLocationCoord(Coordinate.newInstance(10, 10));
|
||||
vehicleBuilder.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
|
||||
vehicleBuilder.setType(vehicleType);
|
||||
vehicleBuilder.setReturnToDepot(false);
|
||||
Vehicle vehicle = vehicleBuilder.build();
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ public class SimpleEnRoutePickupAndDeliveryWithDepotBoundedDeliveriesExample {
|
|||
* get a vehicle-builder and build a vehicle located at (10,10) with type "vehicleType"
|
||||
*/
|
||||
Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
|
||||
vehicleBuilder.setLocationCoord(Coordinate.newInstance(10, 10));
|
||||
vehicleBuilder.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
|
||||
vehicleBuilder.setType(vehicleType);
|
||||
Vehicle vehicle = vehicleBuilder.build();
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ public class SimpleExample {
|
|||
* get a vehicle-builder and build a vehicle located at (10,10) with type "vehicleType"
|
||||
*/
|
||||
Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
|
||||
vehicleBuilder.setLocationCoord(Coordinate.newInstance(10, 10));
|
||||
vehicleBuilder.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
|
||||
vehicleBuilder.setType(vehicleType);
|
||||
Vehicle vehicle = vehicleBuilder.build();
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ package jsprit.examples;
|
|||
|
||||
import java.util.Collection;
|
||||
|
||||
import jsprit.analysis.toolbox.SolutionPlotter;
|
||||
import jsprit.analysis.toolbox.Plotter;
|
||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
||||
|
|
@ -55,7 +55,7 @@ public class SimpleExampleOpenRoutes {
|
|||
* get a vehicle-builder and build a vehicle located at (10,10) with type "vehicleType"
|
||||
*/
|
||||
Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
|
||||
vehicleBuilder.setLocationCoord(Coordinate.newInstance(10, 10));
|
||||
vehicleBuilder.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
|
||||
vehicleBuilder.setType(vehicleType);
|
||||
vehicleBuilder.setReturnToDepot(false);
|
||||
|
||||
|
|
@ -99,7 +99,9 @@ public class SimpleExampleOpenRoutes {
|
|||
/*
|
||||
* plot
|
||||
*/
|
||||
SolutionPlotter.plotSolutionAsPNG(problem, bestSolution, "output/solution.png", "solution");
|
||||
|
||||
new Plotter(problem, bestSolution).plot("output/solution.png", "solution");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ public class SimpleVRPWithBackhaulsExample {
|
|||
* get a vehicle-builder and build a vehicle located at (10,10) with type "vehicleType"
|
||||
*/
|
||||
Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
|
||||
vehicleBuilder.setLocationCoord(Coordinate.newInstance(10, 10));
|
||||
vehicleBuilder.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
|
||||
vehicleBuilder.setType(vehicleType);
|
||||
Vehicle vehicle = vehicleBuilder.build();
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import java.util.Collection;
|
|||
import jsprit.analysis.toolbox.GraphStreamViewer;
|
||||
import jsprit.analysis.toolbox.GraphStreamViewer.Label;
|
||||
import jsprit.analysis.toolbox.Plotter;
|
||||
import jsprit.analysis.toolbox.SolutionPlotter;
|
||||
|
||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
||||
import jsprit.analysis.toolbox.SolutionPrinter.Print;
|
||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||
|
|
@ -58,7 +58,7 @@ public class SolomonExample {
|
|||
*/
|
||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
|
||||
SolutionPlotter.plotVrpAsPNG(vrp, "output/solomon_C101.png", "C101");
|
||||
new Plotter(vrp).plot("output/solomon_C101.png", "C101");
|
||||
|
||||
/*
|
||||
* Define the required vehicle-routing algorithms to solve the above problem.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,109 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (C) 2013 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/>.
|
||||
******************************************************************************/
|
||||
package jsprit.examples;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collection;
|
||||
|
||||
import jsprit.analysis.toolbox.AlgorithmSearchProgressChartListener;
|
||||
import jsprit.analysis.toolbox.GraphStreamViewer;
|
||||
import jsprit.analysis.toolbox.GraphStreamViewer.Label;
|
||||
import jsprit.analysis.toolbox.Plotter;
|
||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
||||
import jsprit.core.algorithm.selector.SelectBest;
|
||||
import jsprit.core.problem.VehicleRoutingProblem;
|
||||
import jsprit.core.problem.io.VrpXMLReader;
|
||||
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||
|
||||
|
||||
public class SolomonExampleWithSpecifiedVehicleEndLocations {
|
||||
|
||||
public static void main(String[] args) {
|
||||
/*
|
||||
* some preparation - create output folder
|
||||
*/
|
||||
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");
|
||||
}
|
||||
|
||||
/*
|
||||
* Build the problem.
|
||||
*
|
||||
* But define a problem-builder first.
|
||||
*/
|
||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||
|
||||
/*
|
||||
* A solomonReader reads solomon-instance files, and stores the required information in the builder.
|
||||
*/
|
||||
new VrpXMLReader(vrpBuilder).read("input/deliveries_solomon_specifiedVehicleEndLocations_c101.xml");
|
||||
|
||||
/*
|
||||
* Finally, the problem can be built. By default, transportCosts are crowFlyDistances (as usually used for vrp-instances).
|
||||
*/
|
||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
|
||||
Plotter pblmPlotter = new Plotter(vrp);
|
||||
pblmPlotter.plot("output/solomon_C101_specifiedVehicleEndLocations.png","C101");
|
||||
|
||||
/*
|
||||
* Define the required vehicle-routing algorithms to solve the above problem.
|
||||
*
|
||||
* The algorithm can be defined and configured in an xml-file.
|
||||
*/
|
||||
// VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp);
|
||||
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfig_fix.xml");
|
||||
vra.setNuOfIterations(20000);
|
||||
// vra.setPrematureBreak(100);
|
||||
vra.getAlgorithmListeners().addListener(new AlgorithmSearchProgressChartListener("output/sol_progress.png"));
|
||||
/*
|
||||
* Solve the problem.
|
||||
*
|
||||
*
|
||||
*/
|
||||
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
||||
|
||||
/*
|
||||
* Retrieve best solution.
|
||||
*/
|
||||
VehicleRoutingProblemSolution solution = new SelectBest().selectSolution(solutions);
|
||||
|
||||
/*
|
||||
* print solution
|
||||
*/
|
||||
SolutionPrinter.print(solution);
|
||||
|
||||
/*
|
||||
* Plot solution.
|
||||
*/
|
||||
// SolutionPlotter.plotSolutionAsPNG(vrp, solution, "output/solomon_C101_specifiedVehicleEndLocations_solution.png","C101");
|
||||
Plotter solPlotter = new Plotter(vrp, solution);
|
||||
solPlotter.plot("output/solomon_C101_specifiedVehicleEndLocations_solution.png","C101");
|
||||
|
||||
|
||||
new GraphStreamViewer(vrp, solution).setRenderDelay(50).labelWith(Label.ID).setEnableAutoLayout(true).display();
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (C) 2013 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/>.
|
||||
******************************************************************************/
|
||||
package jsprit.examples;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collection;
|
||||
|
||||
import jsprit.analysis.toolbox.GraphStreamViewer;
|
||||
import jsprit.analysis.toolbox.GraphStreamViewer.Label;
|
||||
import jsprit.analysis.toolbox.Plotter;
|
||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
||||
import jsprit.core.algorithm.selector.SelectBest;
|
||||
import jsprit.core.problem.VehicleRoutingProblem;
|
||||
import jsprit.core.problem.io.VrpXMLReader;
|
||||
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||
|
||||
|
||||
public class SolomonExampleWithSpecifiedVehicleEndLocationsWithoutTWs {
|
||||
|
||||
public static void main(String[] args) {
|
||||
/*
|
||||
* some preparation - create output folder
|
||||
*/
|
||||
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");
|
||||
}
|
||||
|
||||
/*
|
||||
* Build the problem.
|
||||
*
|
||||
* But define a problem-builder first.
|
||||
*/
|
||||
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
|
||||
|
||||
/*
|
||||
* A solomonReader reads solomon-instance files, and stores the required information in the builder.
|
||||
*/
|
||||
new VrpXMLReader(vrpBuilder).read("input/pickups_and_deliveries_solomon_c101_withoutTWs_and_specifiedVehicleEndLocations.xml");
|
||||
|
||||
/*
|
||||
* Finally, the problem can be built. By default, transportCosts are crowFlyDistances (as usually used for vrp-instances).
|
||||
*/
|
||||
// vrpBuilder.addProblemConstraint(Constraint.DELIVERIES_FIRST);
|
||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
|
||||
Plotter pblmPlotter = new Plotter(vrp);
|
||||
pblmPlotter.plot("output/solomon_C101_specifiedVehicleEndLocations_withoutTWs.png","C101");
|
||||
|
||||
/*
|
||||
* Define the required vehicle-routing algorithms to solve the above problem.
|
||||
*
|
||||
* The algorithm can be defined and configured in an xml-file.
|
||||
*/
|
||||
// VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp);
|
||||
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfigWithSchrimpfAcceptance.xml");
|
||||
vra.setNuOfIterations(20000);
|
||||
// vra.setPrematureBreak(100);
|
||||
// vra.getAlgorithmListeners().addListener(new AlgorithmSearchProgressChartListener("output/sol_progress.png"));
|
||||
/*
|
||||
* Solve the problem.
|
||||
*
|
||||
*
|
||||
*/
|
||||
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
||||
|
||||
/*
|
||||
* Retrieve best solution.
|
||||
*/
|
||||
VehicleRoutingProblemSolution solution = new SelectBest().selectSolution(solutions);
|
||||
|
||||
/*
|
||||
* print solution
|
||||
*/
|
||||
SolutionPrinter.print(solution);
|
||||
|
||||
/*
|
||||
* Plot solution.
|
||||
*/
|
||||
// SolutionPlotter.plotSolutionAsPNG(vrp, solution, "output/solomon_C101_specifiedVehicleEndLocations_solution.png","C101");
|
||||
Plotter solPlotter = new Plotter(vrp, solution);
|
||||
solPlotter.plot("output/solomon_C101_specifiedVehicleEndLocations_withoutTWs_solution.png","C101");
|
||||
|
||||
|
||||
new GraphStreamViewer(vrp, solution).setRenderDelay(50).labelWith(Label.ID).setEnableAutoLayout(true).display();
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -20,7 +20,9 @@ import java.util.Collection;
|
|||
|
||||
import jsprit.analysis.toolbox.GraphStreamViewer;
|
||||
import jsprit.analysis.toolbox.GraphStreamViewer.Label;
|
||||
import jsprit.analysis.toolbox.SolutionPlotter;
|
||||
|
||||
import jsprit.analysis.toolbox.Plotter;
|
||||
|
||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
||||
|
|
@ -56,7 +58,7 @@ public class SolomonOpenExample {
|
|||
*/
|
||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
|
||||
SolutionPlotter.plotVrpAsPNG(vrp, "output/solomon_C101_open.png", "C101");
|
||||
new Plotter(vrp).plot("output/solomon_C101_open.png", "C101");
|
||||
|
||||
/*
|
||||
* Define the required vehicle-routing algorithms to solve the above problem.
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ package jsprit.examples;
|
|||
|
||||
import java.util.Collection;
|
||||
|
||||
import jsprit.analysis.toolbox.SolutionPlotter;
|
||||
import jsprit.analysis.toolbox.Plotter;
|
||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
||||
|
|
@ -54,7 +54,7 @@ public class SolomonR101Example {
|
|||
*/
|
||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
|
||||
SolutionPlotter.plotVrpAsPNG(vrp, "output/solomon_R101.png", "R101");
|
||||
new Plotter(vrp).plot("output/solomon_R101.png", "R101");
|
||||
|
||||
/*
|
||||
* Define the required vehicle-routing algorithms to solve the above problem.
|
||||
|
|
@ -85,9 +85,7 @@ public class SolomonR101Example {
|
|||
/*
|
||||
* Plot solution.
|
||||
*/
|
||||
SolutionPlotter.plotSolutionAsPNG(vrp, solution, "output/solomon_R101_solution.png","R101");
|
||||
|
||||
|
||||
new Plotter(vrp,solution).plot( "output/solomon_R101_solution.png","R101");
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ import java.util.Collection;
|
|||
|
||||
import jsprit.analysis.toolbox.Plotter;
|
||||
import jsprit.analysis.toolbox.Plotter.Label;
|
||||
import jsprit.analysis.toolbox.SolutionPlotter;
|
||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
||||
|
|
@ -63,7 +62,8 @@ public class VRPWithBackhaulsExample2 {
|
|||
*/
|
||||
VehicleRoutingProblem vrp = vrpBuilder.build();
|
||||
|
||||
SolutionPlotter.plotVrpAsPNG(vrp, "output/vrpwbh_christophides_vrpnc1.png", "pd_vrpnc1");
|
||||
new Plotter(vrp).plot("output/vrpwbh_christophides_vrpnc1.png", "pd_vrpnc1");
|
||||
|
||||
|
||||
/*
|
||||
* Define the required vehicle-routing algorithms to solve the above problem.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue