diff --git a/docs/Simple-Example.md b/docs/Simple-Example.md index 79f1f5fa..aeecaca3 100644 --- a/docs/Simple-Example.md +++ b/docs/Simple-Example.md @@ -76,23 +76,7 @@ Collection<VehicleRoutingProblemSolution> solutions = algorithm.searchSolu VehicleRoutingProblemSolution bestSolution = Solutions.bestOf(solutions); -Analysing the solution here, requires an output folder in your project-directory. If you do not have one, either create it manually or add the following line to your 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");
-}
-
- - -Write out problem and solution (for analysis or later use in another algorithm) -
new VrpXMLWriter(problem, solutions).write("output/problem-with-solution.xml");
-
-which looks like this: [problem-with-solution.xml](https://github.com/jsprit/misc-rep/raw/master/wiki-images/problem-with-solution.xml). - -Or print the results to the console concisely with +If you want to print a concise summary of the results to the console, do this: SolutionPrinter.print(problem, bestSolution, Print.CONCISE); @@ -117,7 +101,7 @@ which results in +----------------------------------------------------------+ -or you use the Print.VERBOSE level such as +If you want to have more information about individual routes, you use the verbose level such as SolutionPrinter.print(problem, bestSolution, Print.VERBOSE); @@ -139,16 +123,21 @@ and you get this addtionally: +--------------------------------------------------------------------------------------------------------------------------------+ +If you want to write out problem and solution, you require the writer that is located in jsprit-io. Thus, you need to add the +corresponding module to your pom.xml much like you added jsprit-core. Just use jsprit-io. You can then use this: -or plot the results with +
new VrpXMLWriter(problem, solutions).write("output/problem-with-solution.xml");
+
+which looks like this: [problem-with-solution.xml](https://github.com/jsprit/misc-rep/raw/master/wiki-images/problem-with-solution.xml). + +If you want to further analyse your solution, add the module jsprit-analysis to your pom. Then you can plot the routes like this new Plotter(problem,bestSolution).plot("output/solution.png", "solution"); and you get [solution.png](https://github.com/jsprit/misc-rep/blob/master/wiki-images/solution.png) -or use the very basic version of the GraphStreamViewer which dynamically renders the problem and its according solution by coding +or use the GraphStreamViewer which dynamically renders the problem and its according solution by coding new GraphStreamViewer(problem, bestSolution).setRenderDelay(100).display(); - 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).