mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
add shipment view
This commit is contained in:
parent
f0c6d15852
commit
be00d30fde
3 changed files with 70 additions and 18 deletions
|
|
@ -240,32 +240,32 @@ public class BicycleMessenger {
|
|||
//if you want, terminate it after 1000 iterations with no change
|
||||
// algorithm.setPrematureAlgorithmTermination(new IterationWithoutImprovementTermination(1000));
|
||||
algorithm.addListener(new AlgorithmSearchProgressChartListener("output/progress.png"));
|
||||
algorithm.setNuOfIterations(2000);
|
||||
algorithm.setNuOfIterations(200);
|
||||
Collection<VehicleRoutingProblemSolution> solutions = algorithm.searchSolutions();
|
||||
|
||||
//this is just to ensure that solution meet the above constraints
|
||||
validateSolution(Solutions.bestOf(solutions), bicycleMessengerProblem, nearestMessengers);
|
||||
|
||||
|
||||
//you may want to plot the problem
|
||||
Plotter plotter = new Plotter(bicycleMessengerProblem);
|
||||
// plotter.setBoundingBox(10000, 47500, 20000, 67500);
|
||||
plotter.plotShipments(true);
|
||||
plotter.plot("output/bicycleMessengerProblem.png", "bicycleMessenger");
|
||||
|
||||
//and the problem as well as the solution
|
||||
Plotter plotter1 = new Plotter(bicycleMessengerProblem, Solutions.bestOf(solutions));
|
||||
plotter1.plotShipments(true);
|
||||
plotter1.setShowFirstActivity(true);
|
||||
// plotter1.setBoundingBox(5000, 45500, 25000, 66500);
|
||||
plotter1.plot("output/bicycleMessengerSolution.png", "bicycleMessenger");
|
||||
// //you may want to plot the problem
|
||||
// Plotter plotter = new Plotter(bicycleMessengerProblem);
|
||||
//// plotter.setBoundingBox(10000, 47500, 20000, 67500);
|
||||
// plotter.plotShipments(true);
|
||||
// plotter.plot("output/bicycleMessengerProblem.png", "bicycleMessenger");
|
||||
//
|
||||
// //and the problem as well as the solution
|
||||
// Plotter plotter1 = new Plotter(bicycleMessengerProblem, Solutions.bestOf(solutions));
|
||||
// plotter1.plotShipments(true);
|
||||
// plotter1.setShowFirstActivity(true);
|
||||
//// plotter1.setBoundingBox(5000, 45500, 25000, 66500);
|
||||
// plotter1.plot("output/bicycleMessengerSolution.png", "bicycleMessenger");
|
||||
|
||||
//and write out your solution in xml
|
||||
new VrpXMLWriter(bicycleMessengerProblem, solutions).write("output/bicycleMessenger.xml");
|
||||
|
||||
SolutionPrinter.print(bicycleMessengerProblem, Solutions.bestOf(solutions), Print.VERBOSE);
|
||||
|
||||
GraphStreamViewer.display(bicycleMessengerProblem, Solutions.bestOf(solutions), 100);
|
||||
new GraphStreamViewer(bicycleMessengerProblem, Solutions.bestOf(solutions)).setRenderDelay(50).setRenderShipments(true).display();
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import java.io.File;
|
|||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
||||
import jsprit.analysis.toolbox.GraphStreamViewer;
|
||||
import jsprit.analysis.toolbox.Plotter;
|
||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||
|
|
@ -126,6 +127,8 @@ public class SimpleEnRoutePickupAndDeliveryExample {
|
|||
solutionPlotter.plotShipments(true);
|
||||
solutionPlotter.plot("output/simpleEnRoutePickupAndDeliveryExample_solution.png", "en-route pickup and delivery");
|
||||
|
||||
new GraphStreamViewer(problem).setRenderShipments(true).display();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue