mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
add util createOutputFolder
This commit is contained in:
parent
0c02ea71a5
commit
7d8e32fc8d
3 changed files with 21 additions and 34 deletions
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
******************************************************************************/
|
||||
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");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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.
|
||||
*
|
||||
* <p>These instances are from Golden and Taillard and copied from http://mistic.heig-vd.ch/taillard/problemes.dir/vrp.dir/vrp.html.
|
||||
* <p>These instances are from Golden and Taillard and copied from
|
||||
* <a href=http://mistic.heig-vd.ch/taillard/problemes.dir/vrp.dir/vrp.html>.
|
||||
*
|
||||
* <p>You can find best results of different problems, instances and authors here:
|
||||
* <br><a href="http://www2.ic.uff.br/~satoru/conteudo/artigos/PAPER%20PUCA-JHeuristics-2011.pdf">http://www2.ic.uff.br/~satoru/conteudo/artigos/PAPER%20PUCA-JHeuristics-2011.pdf</a>
|
||||
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
17
jsprit-examples/src/main/java/jsprit/util/Examples.java
Normal file
17
jsprit-examples/src/main/java/jsprit/util/Examples.java
Normal file
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue