mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
clean examples
This commit is contained in:
parent
ffeb4bc8a9
commit
f271ac2551
2 changed files with 8 additions and 21 deletions
|
|
@ -16,9 +16,6 @@
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package jsprit.examples;
|
package jsprit.examples;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import jsprit.analysis.toolbox.GraphStreamViewer;
|
import jsprit.analysis.toolbox.GraphStreamViewer;
|
||||||
import jsprit.analysis.toolbox.GraphStreamViewer.Label;
|
import jsprit.analysis.toolbox.GraphStreamViewer.Label;
|
||||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
import jsprit.analysis.toolbox.SolutionPrinter;
|
||||||
|
|
@ -37,6 +34,9 @@ import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
||||||
import jsprit.core.util.Coordinate;
|
import jsprit.core.util.Coordinate;
|
||||||
import jsprit.core.util.Solutions;
|
import jsprit.core.util.Solutions;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
|
||||||
public class SimpleExample {
|
public class SimpleExample {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,12 +22,10 @@ import jsprit.analysis.toolbox.Plotter;
|
||||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
import jsprit.analysis.toolbox.SolutionPrinter;
|
||||||
import jsprit.analysis.toolbox.SolutionPrinter.Print;
|
import jsprit.analysis.toolbox.SolutionPrinter.Print;
|
||||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||||
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
import jsprit.core.algorithm.box.SchrimpfFactory;
|
||||||
import jsprit.core.algorithm.selector.SelectBest;
|
import jsprit.core.algorithm.selector.SelectBest;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem;
|
import jsprit.core.problem.VehicleRoutingProblem;
|
||||||
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||||
import jsprit.core.problem.solution.route.VehicleRoute;
|
|
||||||
import jsprit.core.problem.solution.route.activity.TourActivity;
|
|
||||||
import jsprit.instance.reader.SolomonReader;
|
import jsprit.instance.reader.SolomonReader;
|
||||||
import jsprit.util.Examples;
|
import jsprit.util.Examples;
|
||||||
|
|
||||||
|
|
@ -67,10 +65,8 @@ public class SolomonExample {
|
||||||
*
|
*
|
||||||
* The algorithm can be defined and configured in an xml-file.
|
* The algorithm can be defined and configured in an xml-file.
|
||||||
*/
|
*/
|
||||||
// VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp);
|
VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp);
|
||||||
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfig_solomon.xml");
|
|
||||||
|
|
||||||
// vra.getAlgorithmListeners().addListener(new AlgorithmSearchProgressChartListener("output/sol_progress.png"));
|
|
||||||
/*
|
/*
|
||||||
* Solve the problem.
|
* Solve the problem.
|
||||||
*
|
*
|
||||||
|
|
@ -83,13 +79,7 @@ public class SolomonExample {
|
||||||
*/
|
*/
|
||||||
VehicleRoutingProblemSolution solution = new SelectBest().selectSolution(solutions);
|
VehicleRoutingProblemSolution solution = new SelectBest().selectSolution(solutions);
|
||||||
|
|
||||||
for(VehicleRoute r : solution.getRoutes()){
|
|
||||||
System.out.println(r.getStart() + ";" + r.getStart().getIndex());
|
|
||||||
for(TourActivity act : r.getActivities()){
|
|
||||||
System.out.println(act + ";" + act.getIndex());
|
|
||||||
}
|
|
||||||
System.out.println(r.getEnd() + ";" + r.getEnd().getIndex());
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* print solution
|
* print solution
|
||||||
*/
|
*/
|
||||||
|
|
@ -101,9 +91,6 @@ public class SolomonExample {
|
||||||
Plotter plotter = new Plotter(vrp,solution);
|
Plotter plotter = new Plotter(vrp,solution);
|
||||||
// plotter.setBoundingBox(30, 0, 50, 20);
|
// plotter.setBoundingBox(30, 0, 50, 20);
|
||||||
plotter.plot("output/solomon_C101_solution.png", "C101");
|
plotter.plot("output/solomon_C101_solution.png", "C101");
|
||||||
// SolutionPlotter.plotSolutionAsPNG(vrp, solution, "output/solomon_C101_solution.png","C101");
|
|
||||||
|
|
||||||
// GraphStream.display(vrp,100);
|
|
||||||
|
|
||||||
new GraphStreamViewer(vrp,solution).setCameraView(30, 30, 0.25).labelWith(Label.ID).setRenderDelay(100).display();
|
new GraphStreamViewer(vrp,solution).setCameraView(30, 30, 0.25).labelWith(Label.ID).setRenderDelay(100).display();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue