diff --git a/jsprit-examples/src/main/java/jsprit/examples/CVRPExample.java b/jsprit-examples/src/main/java/jsprit/examples/CVRPExample.java deleted file mode 100644 index d6bd6444..00000000 --- a/jsprit-examples/src/main/java/jsprit/examples/CVRPExample.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * 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 . - ******************************************************************************/ -package jsprit.examples; - -import jsprit.core.problem.VehicleRoutingProblem; -import jsprit.core.problem.io.VrpXMLWriter; -import jsprit.instance.reader.ChristofidesReader; - -public class CVRPExample { - - public static void main(String[] args) { - VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance(); - new ChristofidesReader(builder).read("input/vrpnc1.txt"); - VehicleRoutingProblem vrp = builder.build(); - new VrpXMLWriter(vrp).write("input/vrpnc1-jsprit.xml"); - } - -} diff --git a/jsprit-examples/src/main/java/jsprit/examples/HVRPBenchmarkExample.java b/jsprit-examples/src/main/java/jsprit/examples/HVRPBenchmarkExample.java index 637100c8..d0c9e2b8 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/HVRPBenchmarkExample.java +++ b/jsprit-examples/src/main/java/jsprit/examples/HVRPBenchmarkExample.java @@ -14,11 +14,13 @@ import jsprit.core.problem.solution.VehicleRoutingProblemSolution; import jsprit.core.util.Solutions; import jsprit.instance.reader.VrphGoldenReader; import jsprit.instance.reader.VrphGoldenReader.VrphType; +import jsprit.util.Examples; /** * Shows how to benchmark the algorithm on different classical HVRP and FSM instances. * - *

These instances are from Golden and Taillard and copied from http://mistic.heig-vd.ch/taillard/problemes.dir/vrp.dir/vrp.html. + *

These instances are from Golden and Taillard and copied from + * . * *

You can find best results of different problems, instances and authors here: *
http://www2.ic.uff.br/~satoru/conteudo/artigos/PAPER%20PUCA-JHeuristics-2011.pdf @@ -30,6 +32,7 @@ import jsprit.instance.reader.VrphGoldenReader.VrphType; public class HVRPBenchmarkExample { public static void main(String[] args) { + Examples.createOutputFolder(); VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); //read modified Golden-instance, you can find all relevant instances in jsprit-instances/instances/vrph //you can build various problems, see VrphType doc for more details @@ -57,5 +60,4 @@ public class HVRPBenchmarkExample { new GraphStreamViewer(vrp, best).setRenderDelay(100).display(); } - } diff --git a/jsprit-examples/src/main/java/jsprit/util/Examples.java b/jsprit-examples/src/main/java/jsprit/util/Examples.java new file mode 100644 index 00000000..37a4463a --- /dev/null +++ b/jsprit-examples/src/main/java/jsprit/util/Examples.java @@ -0,0 +1,17 @@ +package jsprit.util; + +import java.io.File; + +public class Examples { + + public static void createOutputFolder(){ + 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"); + } + } + +}