From f271ac2551ea69173764654b8857cb94b6814aa9 Mon Sep 17 00:00:00 2001 From: oblonski <4sschroeder@gmail.com> Date: Thu, 7 Aug 2014 20:59:59 +0200 Subject: [PATCH] clean examples --- .../java/jsprit/examples/SimpleExample.java | 6 ++--- .../java/jsprit/examples/SolomonExample.java | 23 ++++--------------- 2 files changed, 8 insertions(+), 21 deletions(-) diff --git a/jsprit-examples/src/main/java/jsprit/examples/SimpleExample.java b/jsprit-examples/src/main/java/jsprit/examples/SimpleExample.java index c632972d..7a56b4f9 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/SimpleExample.java +++ b/jsprit-examples/src/main/java/jsprit/examples/SimpleExample.java @@ -16,9 +16,6 @@ ******************************************************************************/ 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.SolutionPrinter; @@ -37,6 +34,9 @@ import jsprit.core.problem.vehicle.VehicleTypeImpl; import jsprit.core.util.Coordinate; import jsprit.core.util.Solutions; +import java.io.File; +import java.util.Collection; + public class SimpleExample { diff --git a/jsprit-examples/src/main/java/jsprit/examples/SolomonExample.java b/jsprit-examples/src/main/java/jsprit/examples/SolomonExample.java index f699e375..d77ec7d4 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/SolomonExample.java +++ b/jsprit-examples/src/main/java/jsprit/examples/SolomonExample.java @@ -22,12 +22,10 @@ import jsprit.analysis.toolbox.Plotter; import jsprit.analysis.toolbox.SolutionPrinter; import jsprit.analysis.toolbox.SolutionPrinter.Print; 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.problem.VehicleRoutingProblem; 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.util.Examples; @@ -67,10 +65,8 @@ public class SolomonExample { * * The algorithm can be defined and configured in an xml-file. */ -// VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp); - VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfig_solomon.xml"); - -// vra.getAlgorithmListeners().addListener(new AlgorithmSearchProgressChartListener("output/sol_progress.png")); + VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp); + /* * Solve the problem. * @@ -83,13 +79,7 @@ public class SolomonExample { */ 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 */ @@ -101,10 +91,7 @@ public class SolomonExample { Plotter plotter = new Plotter(vrp,solution); // plotter.setBoundingBox(30, 0, 50, 20); 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(); }