1
0
Fork 0
mirror of https://github.com/graphhopper/jsprit.git synced 2020-01-24 07:45:05 +01:00

Merge branch 'master' into multiple-cap-constraints

This commit is contained in:
oblonski 2014-02-11 05:40:37 +01:00
commit 9f1580927c
24 changed files with 55 additions and 203 deletions

View file

@ -42,9 +42,7 @@ import jsprit.core.problem.vehicle.VehicleTypeImpl;
import jsprit.core.util.Coordinate; import jsprit.core.util.Coordinate;
import jsprit.core.util.CrowFlyCosts; import jsprit.core.util.CrowFlyCosts;
import jsprit.core.util.Solutions; import jsprit.core.util.Solutions;
import jsprit.util.Examples;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
/** /**
@ -207,8 +205,8 @@ public class BicycleMessenger {
* @throws IOException * @throws IOException
*/ */
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
createOutputFolder();//for output generated below Examples.createOutputFolder();
Logger.getRootLogger().setLevel(Level.INFO);
//build the problem //build the problem
VehicleRoutingProblem.Builder problemBuilder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder problemBuilder = VehicleRoutingProblem.Builder.newInstance();
problemBuilder.setFleetSize(FleetSize.FINITE); problemBuilder.setFleetSize(FleetSize.FINITE);
@ -288,19 +286,6 @@ public class BicycleMessenger {
} }
} }
private static void createOutputFolder() {
/*
* some preparation - create output folder
*/
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");
}
}
static Map<String,Double> getNearestMessengers(VehicleRoutingTransportCosts routingCosts, Collection<Job> envelopes, Collection<Vehicle> messengers) { static Map<String,Double> getNearestMessengers(VehicleRoutingTransportCosts routingCosts, Collection<Job> envelopes, Collection<Vehicle> messengers) {
Map<String,Double> nearestMessengers = new HashMap<String, Double>(); Map<String,Double> nearestMessengers = new HashMap<String, Double>();
for(Job envelope : envelopes){ for(Job envelope : envelopes){

View file

@ -18,7 +18,6 @@
******************************************************************************/ ******************************************************************************/
package jsprit.examples; package jsprit.examples;
import java.io.File;
import java.util.Collection; import java.util.Collection;
import jsprit.analysis.toolbox.SolutionPrinter; import jsprit.analysis.toolbox.SolutionPrinter;
@ -48,6 +47,7 @@ import jsprit.core.problem.vehicle.InfiniteFleetManagerFactory;
import jsprit.core.problem.vehicle.VehicleFleetManager; import jsprit.core.problem.vehicle.VehicleFleetManager;
import jsprit.core.util.Solutions; import jsprit.core.util.Solutions;
import jsprit.instance.reader.SolomonReader; import jsprit.instance.reader.SolomonReader;
import jsprit.util.Examples;
public class BuildAlgorithmFromScratch { public class BuildAlgorithmFromScratch {
@ -58,13 +58,7 @@ public class BuildAlgorithmFromScratch {
/* /*
* some preparation - create output folder * some preparation - create output folder
*/ */
File dir = new File("output"); Examples.createOutputFolder();
// 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");
}
/* /*
* Build the problem. * Build the problem.

View file

@ -16,8 +16,6 @@
******************************************************************************/ ******************************************************************************/
package jsprit.examples; package jsprit.examples;
import java.io.File;
import jsprit.analysis.toolbox.AlgorithmSearchProgressChartListener; import jsprit.analysis.toolbox.AlgorithmSearchProgressChartListener;
import jsprit.analysis.toolbox.StopWatch; import jsprit.analysis.toolbox.StopWatch;
import jsprit.core.algorithm.VehicleRoutingAlgorithm; import jsprit.core.algorithm.VehicleRoutingAlgorithm;
@ -27,6 +25,7 @@ import jsprit.core.algorithm.listener.VehicleRoutingAlgorithmListeners.Priority;
import jsprit.core.algorithm.termination.IterationWithoutImprovementTermination; import jsprit.core.algorithm.termination.IterationWithoutImprovementTermination;
import jsprit.core.problem.VehicleRoutingProblem; import jsprit.core.problem.VehicleRoutingProblem;
import jsprit.instance.reader.SolomonReader; import jsprit.instance.reader.SolomonReader;
import jsprit.util.Examples;
public class CompareAlgorithmExample { public class CompareAlgorithmExample {
@ -38,13 +37,7 @@ public class CompareAlgorithmExample {
/* /*
* some preparation - create output folder * some preparation - create output folder
*/ */
File dir = new File("output"); Examples.createOutputFolder();
// 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");
}
/* /*
* Build the problem. * Build the problem.
* *
@ -81,14 +74,10 @@ public class CompareAlgorithmExample {
*/ */
vra_withThreshold.searchSolutions(); vra_withThreshold.searchSolutions();
vra_greedy.searchSolutions(); vra_greedy.searchSolutions();
vra_greedy.setPrematureAlgorithmTermination(new IterationWithoutImprovementTermination(40)); vra_greedy.setPrematureAlgorithmTermination(new IterationWithoutImprovementTermination(40));
vra_greedy.searchSolutions(); vra_greedy.searchSolutions();
} }

View file

@ -16,7 +16,6 @@
******************************************************************************/ ******************************************************************************/
package jsprit.examples; package jsprit.examples;
import java.io.File;
import java.util.Collection; import java.util.Collection;
import jsprit.analysis.toolbox.SolutionPlotter; import jsprit.analysis.toolbox.SolutionPlotter;
@ -35,6 +34,7 @@ import jsprit.core.problem.vehicle.VehicleType;
import jsprit.core.problem.vehicle.VehicleTypeImpl; 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 jsprit.util.Examples;
import org.apache.commons.configuration.XMLConfiguration; import org.apache.commons.configuration.XMLConfiguration;
@ -45,13 +45,7 @@ public class ConfigureAlgorithmInCodeInsteadOfPerXml {
/* /*
* some preparation - create output folder * some preparation - create output folder
*/ */
File dir = new File("output"); Examples.createOutputFolder();
// 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");
}
/* /*
* get a vehicle type-builder and build a type with the typeId "vehicleType" and a capacity of 2 * get a vehicle type-builder and build a type with the typeId "vehicleType" and a capacity of 2

View file

@ -16,7 +16,6 @@
******************************************************************************/ ******************************************************************************/
package jsprit.examples; package jsprit.examples;
import java.io.File;
import java.util.Collection; import java.util.Collection;
import jsprit.analysis.toolbox.SolutionPlotter; import jsprit.analysis.toolbox.SolutionPlotter;
@ -34,6 +33,7 @@ import jsprit.core.problem.vehicle.VehicleType;
import jsprit.core.problem.vehicle.VehicleTypeImpl; import jsprit.core.problem.vehicle.VehicleTypeImpl;
import jsprit.core.util.Solutions; import jsprit.core.util.Solutions;
import jsprit.core.util.VehicleRoutingTransportCostsMatrix; import jsprit.core.util.VehicleRoutingTransportCostsMatrix;
import jsprit.util.Examples;
/** /**
@ -51,13 +51,8 @@ public class CostMatrixExample {
/* /*
* some preparation - create output folder * some preparation - create output folder
*/ */
File dir = new File("output"); Examples.createOutputFolder();
// 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");
}
VehicleType type = VehicleTypeImpl.Builder.newInstance("type", 2).setCostPerDistance(1).setCostPerTime(2).build(); VehicleType type = VehicleTypeImpl.Builder.newInstance("type", 2).setCostPerDistance(1).setCostPerTime(2).build();
Vehicle vehicle = VehicleImpl.Builder.newInstance("vehicle").setLocationId("0").setType(type).build(); Vehicle vehicle = VehicleImpl.Builder.newInstance("vehicle").setLocationId("0").setType(type).build();

View file

@ -34,6 +34,7 @@ public class HVRPBenchmarkExample {
public static void main(String[] args) { public static void main(String[] args) {
Examples.createOutputFolder(); Examples.createOutputFolder();
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
//read modified Golden-instance, you can find all relevant instances in jsprit-instances/instances/vrph //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 //you can build various problems, see VrphType doc for more details

View file

@ -16,7 +16,6 @@
******************************************************************************/ ******************************************************************************/
package jsprit.examples; package jsprit.examples;
import java.io.File;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -37,6 +36,7 @@ import jsprit.core.problem.vehicle.VehicleImpl;
import jsprit.core.problem.vehicle.VehicleTypeImpl; 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 jsprit.util.Examples;
public class MultipleDepotExample { public class MultipleDepotExample {
@ -48,13 +48,8 @@ public class MultipleDepotExample {
/* /*
* some preparation - create output folder * some preparation - create output folder
*/ */
File dir = new File("output"); Examples.createOutputFolder();
// 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");
}
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
/* /*
* Read cordeau-instance p01, BUT only its services without any vehicles * Read cordeau-instance p01, BUT only its services without any vehicles

View file

@ -16,7 +16,6 @@
******************************************************************************/ ******************************************************************************/
package jsprit.examples; package jsprit.examples;
import java.io.File;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -24,8 +23,8 @@ import jsprit.analysis.toolbox.AlgorithmSearchProgressChartListener;
import jsprit.analysis.toolbox.GraphStreamViewer; import jsprit.analysis.toolbox.GraphStreamViewer;
import jsprit.analysis.toolbox.SolutionPlotter; import jsprit.analysis.toolbox.SolutionPlotter;
import jsprit.analysis.toolbox.SolutionPrinter; import jsprit.analysis.toolbox.SolutionPrinter;
import jsprit.analysis.toolbox.StopWatch;
import jsprit.analysis.toolbox.SolutionPrinter.Print; import jsprit.analysis.toolbox.SolutionPrinter.Print;
import jsprit.analysis.toolbox.StopWatch;
import jsprit.core.algorithm.VehicleRoutingAlgorithm; import jsprit.core.algorithm.VehicleRoutingAlgorithm;
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms; import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
import jsprit.core.algorithm.listener.VehicleRoutingAlgorithmListeners.Priority; import jsprit.core.algorithm.listener.VehicleRoutingAlgorithmListeners.Priority;
@ -40,6 +39,7 @@ import jsprit.core.problem.vehicle.VehicleType;
import jsprit.core.problem.vehicle.VehicleTypeImpl; 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 jsprit.util.Examples;
public class MultipleDepotExampleWithPenaltyVehicles { public class MultipleDepotExampleWithPenaltyVehicles {
@ -51,13 +51,7 @@ public class MultipleDepotExampleWithPenaltyVehicles {
/* /*
* some preparation - create output folder * some preparation - create output folder
*/ */
File dir = new File("output"); Examples.createOutputFolder();
// 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");
}
VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance(); VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
/* /*

View file

@ -16,7 +16,6 @@
******************************************************************************/ ******************************************************************************/
package jsprit.examples; package jsprit.examples;
import java.io.File;
import java.util.Collection; import java.util.Collection;
import jsprit.analysis.toolbox.AlgorithmSearchProgressChartListener; import jsprit.analysis.toolbox.AlgorithmSearchProgressChartListener;
@ -30,6 +29,7 @@ import jsprit.core.algorithm.selector.SelectBest;
import jsprit.core.problem.VehicleRoutingProblem; import jsprit.core.problem.VehicleRoutingProblem;
import jsprit.core.problem.io.VrpXMLReader; import jsprit.core.problem.io.VrpXMLReader;
import jsprit.core.problem.solution.VehicleRoutingProblemSolution; import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
import jsprit.util.Examples;
public class PickupAndDeliveryExample { public class PickupAndDeliveryExample {
@ -39,13 +39,7 @@ public class PickupAndDeliveryExample {
/* /*
* some preparation - create output folder * some preparation - create output folder
*/ */
File dir = new File("output"); Examples.createOutputFolder();
// 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");
}
/* /*
* Build the problem. * Build the problem.

View file

@ -16,7 +16,6 @@
******************************************************************************/ ******************************************************************************/
package jsprit.examples; package jsprit.examples;
import java.io.File;
import java.util.Collection; import java.util.Collection;
import jsprit.analysis.toolbox.AlgorithmSearchProgressChartListener; import jsprit.analysis.toolbox.AlgorithmSearchProgressChartListener;
@ -31,6 +30,7 @@ import jsprit.core.algorithm.selector.SelectBest;
import jsprit.core.problem.VehicleRoutingProblem; import jsprit.core.problem.VehicleRoutingProblem;
import jsprit.core.problem.io.VrpXMLReader; import jsprit.core.problem.io.VrpXMLReader;
import jsprit.core.problem.solution.VehicleRoutingProblemSolution; import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
import jsprit.util.Examples;
import org.apache.log4j.Level; import org.apache.log4j.Level;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
@ -45,13 +45,7 @@ public class PickupAndDeliveryExample2 {
/* /*
* some preparation - create output folder * some preparation - create output folder
*/ */
File dir = new File("output"); Examples.createOutputFolder();
// 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");
}
/* /*
* Build the problem. * Build the problem.

View file

@ -16,7 +16,6 @@
******************************************************************************/ ******************************************************************************/
package jsprit.examples; package jsprit.examples;
import java.io.File;
import java.util.Collection; import java.util.Collection;
import jsprit.analysis.toolbox.AlgorithmSearchProgressChartListener; import jsprit.analysis.toolbox.AlgorithmSearchProgressChartListener;
@ -29,6 +28,7 @@ import jsprit.core.algorithm.selector.SelectBest;
import jsprit.core.problem.VehicleRoutingProblem; import jsprit.core.problem.VehicleRoutingProblem;
import jsprit.core.problem.io.VrpXMLReader; import jsprit.core.problem.io.VrpXMLReader;
import jsprit.core.problem.solution.VehicleRoutingProblemSolution; import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
import jsprit.util.Examples;
public class PickupAndDeliveryOpenExample { public class PickupAndDeliveryOpenExample {
@ -38,13 +38,7 @@ public class PickupAndDeliveryOpenExample {
/* /*
* some preparation - create output folder * some preparation - create output folder
*/ */
File dir = new File("output"); Examples.createOutputFolder();
// 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");
}
/* /*
* Build the problem. * Build the problem.

View file

@ -41,6 +41,7 @@ import jsprit.core.problem.vehicle.VehicleTypeImpl;
import jsprit.core.util.Solutions; import jsprit.core.util.Solutions;
import jsprit.core.util.VehicleRoutingTransportCostsMatrix; import jsprit.core.util.VehicleRoutingTransportCostsMatrix;
import jsprit.core.util.VehicleRoutingTransportCostsMatrix.Builder; import jsprit.core.util.VehicleRoutingTransportCostsMatrix.Builder;
import jsprit.util.Examples;
@ -154,13 +155,7 @@ public class RefuseCollectionExample {
/* /*
* some preparation - create output folder * some preparation - create output folder
*/ */
File dir = new File("output"); Examples.createOutputFolder();
// 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");
}
/* /*
* create vehicle-type and vehicle * create vehicle-type and vehicle

View file

@ -16,7 +16,6 @@
******************************************************************************/ ******************************************************************************/
package jsprit.examples; package jsprit.examples;
import java.io.File;
import java.util.Collection; import java.util.Collection;
import jsprit.analysis.toolbox.Plotter; import jsprit.analysis.toolbox.Plotter;
@ -36,6 +35,7 @@ import jsprit.core.problem.vehicle.VehicleType;
import jsprit.core.problem.vehicle.VehicleTypeImpl; 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 jsprit.util.Examples;
public class SimpleDepotBoundedPickupAndDeliveryExample { public class SimpleDepotBoundedPickupAndDeliveryExample {
@ -44,13 +44,7 @@ public class SimpleDepotBoundedPickupAndDeliveryExample {
/* /*
* some preparation - create output folder * some preparation - create output folder
*/ */
File dir = new File("output"); Examples.createOutputFolder();
// 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");
}
/* /*
* get a vehicle type-builder and build a type with the typeId "vehicleType" and a capacity of 2 * get a vehicle type-builder and build a type with the typeId "vehicleType" and a capacity of 2

View file

@ -16,7 +16,6 @@
******************************************************************************/ ******************************************************************************/
package jsprit.examples; package jsprit.examples;
import java.io.File;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -36,6 +35,7 @@ import jsprit.core.problem.vehicle.VehicleType;
import jsprit.core.problem.vehicle.VehicleTypeImpl; 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 jsprit.util.Examples;
public class SimpleEnRoutePickupAndDeliveryExample { public class SimpleEnRoutePickupAndDeliveryExample {
@ -44,13 +44,7 @@ public class SimpleEnRoutePickupAndDeliveryExample {
/* /*
* some preparation - create output folder * some preparation - create output folder
*/ */
File dir = new File("output"); Examples.createOutputFolder();
// 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");
}
/* /*
* get a vehicle type-builder and build a type with the typeId "vehicleType" and a capacity of 2 * get a vehicle type-builder and build a type with the typeId "vehicleType" and a capacity of 2

View file

@ -16,7 +16,6 @@
******************************************************************************/ ******************************************************************************/
package jsprit.examples; package jsprit.examples;
import java.io.File;
import java.util.Collection; import java.util.Collection;
import jsprit.analysis.toolbox.GraphStreamViewer; import jsprit.analysis.toolbox.GraphStreamViewer;
@ -36,6 +35,7 @@ import jsprit.core.problem.vehicle.VehicleType;
import jsprit.core.problem.vehicle.VehicleTypeImpl; 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 jsprit.util.Examples;
public class SimpleEnRoutePickupAndDeliveryOpenRoutesExample { public class SimpleEnRoutePickupAndDeliveryOpenRoutesExample {
@ -44,13 +44,7 @@ public class SimpleEnRoutePickupAndDeliveryOpenRoutesExample {
/* /*
* some preparation - create output folder * some preparation - create output folder
*/ */
File dir = new File("output"); Examples.createOutputFolder();
// 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");
}
/* /*
* get a vehicle type-builder and build a type with the typeId "vehicleType" and a capacity of 2 * get a vehicle type-builder and build a type with the typeId "vehicleType" and a capacity of 2

View file

@ -16,7 +16,6 @@
******************************************************************************/ ******************************************************************************/
package jsprit.examples; package jsprit.examples;
import java.io.File;
import java.util.Collection; import java.util.Collection;
import jsprit.analysis.toolbox.Plotter; import jsprit.analysis.toolbox.Plotter;
@ -36,6 +35,7 @@ import jsprit.core.problem.vehicle.VehicleType;
import jsprit.core.problem.vehicle.VehicleTypeImpl; 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 jsprit.util.Examples;
public class SimpleEnRoutePickupAndDeliveryWithDepotBoundedDeliveriesExample { public class SimpleEnRoutePickupAndDeliveryWithDepotBoundedDeliveriesExample {
@ -44,13 +44,7 @@ public class SimpleEnRoutePickupAndDeliveryWithDepotBoundedDeliveriesExample {
/* /*
* some preparation - create output folder * some preparation - create output folder
*/ */
File dir = new File("output"); Examples.createOutputFolder();
// 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");
}
/* /*
* get a vehicle type-builder and build a type with the typeId "vehicleType" and a capacity of 2 * get a vehicle type-builder and build a type with the typeId "vehicleType" and a capacity of 2

View file

@ -16,7 +16,6 @@
******************************************************************************/ ******************************************************************************/
package jsprit.examples; package jsprit.examples;
import java.io.File;
import java.util.Collection; import java.util.Collection;
import jsprit.analysis.toolbox.GraphStreamViewer; import jsprit.analysis.toolbox.GraphStreamViewer;
@ -36,6 +35,7 @@ import jsprit.core.problem.vehicle.VehicleType;
import jsprit.core.problem.vehicle.VehicleTypeImpl; 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 jsprit.util.Examples;
public class SimpleExample { public class SimpleExample {
@ -44,13 +44,7 @@ public class SimpleExample {
/* /*
* some preparation - create output folder * some preparation - create output folder
*/ */
File dir = new File("output"); Examples.createOutputFolder();
// 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");
}
/* /*
* get a vehicle type-builder and build a type with the typeId "vehicleType" and a capacity of 2 * get a vehicle type-builder and build a type with the typeId "vehicleType" and a capacity of 2

View file

@ -16,7 +16,6 @@
******************************************************************************/ ******************************************************************************/
package jsprit.examples; package jsprit.examples;
import java.io.File;
import java.util.Collection; import java.util.Collection;
import jsprit.analysis.toolbox.SolutionPlotter; import jsprit.analysis.toolbox.SolutionPlotter;
@ -34,6 +33,7 @@ import jsprit.core.problem.vehicle.VehicleType;
import jsprit.core.problem.vehicle.VehicleTypeImpl; 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 jsprit.util.Examples;
public class SimpleExampleOpenRoutes { public class SimpleExampleOpenRoutes {
@ -42,13 +42,7 @@ public class SimpleExampleOpenRoutes {
/* /*
* some preparation - create output folder * some preparation - create output folder
*/ */
File dir = new File("output"); Examples.createOutputFolder();
// 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");
}
/* /*
* get a vehicle type-builder and build a type with the typeId "vehicleType" and a capacity of 2 * get a vehicle type-builder and build a type with the typeId "vehicleType" and a capacity of 2

View file

@ -16,7 +16,6 @@
******************************************************************************/ ******************************************************************************/
package jsprit.examples; package jsprit.examples;
import java.io.File;
import java.util.Collection; import java.util.Collection;
import jsprit.analysis.toolbox.Plotter; import jsprit.analysis.toolbox.Plotter;
@ -37,6 +36,7 @@ import jsprit.core.problem.vehicle.VehicleType;
import jsprit.core.problem.vehicle.VehicleTypeImpl; 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 jsprit.util.Examples;
public class SimpleVRPWithBackhaulsExample { public class SimpleVRPWithBackhaulsExample {
@ -45,13 +45,7 @@ public class SimpleVRPWithBackhaulsExample {
/* /*
* some preparation - create output folder * some preparation - create output folder
*/ */
File dir = new File("output"); Examples.createOutputFolder();
// 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");
}
/* /*
* get a vehicle type-builder and build a type with the typeId "vehicleType" and a capacity of 2 * get a vehicle type-builder and build a type with the typeId "vehicleType" and a capacity of 2

View file

@ -16,14 +16,13 @@
******************************************************************************/ ******************************************************************************/
package jsprit.examples; package jsprit.examples;
import java.io.File;
import java.util.Collection; import java.util.Collection;
import jsprit.analysis.toolbox.GraphStreamViewer; import jsprit.analysis.toolbox.GraphStreamViewer;
import jsprit.analysis.toolbox.GraphStreamViewer.Label;
import jsprit.analysis.toolbox.Plotter; import jsprit.analysis.toolbox.Plotter;
import jsprit.analysis.toolbox.SolutionPlotter; import jsprit.analysis.toolbox.SolutionPlotter;
import jsprit.analysis.toolbox.SolutionPrinter; import jsprit.analysis.toolbox.SolutionPrinter;
import jsprit.analysis.toolbox.GraphStreamViewer.Label;
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.io.VehicleRoutingAlgorithms;
@ -31,6 +30,7 @@ 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.instance.reader.SolomonReader; import jsprit.instance.reader.SolomonReader;
import jsprit.util.Examples;
public class SolomonExample { public class SolomonExample {
@ -39,13 +39,7 @@ public class SolomonExample {
/* /*
* some preparation - create output folder * some preparation - create output folder
*/ */
File dir = new File("output"); Examples.createOutputFolder();
// 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");
}
/* /*
* Build the problem. * Build the problem.

View file

@ -16,19 +16,19 @@
******************************************************************************/ ******************************************************************************/
package jsprit.examples; package jsprit.examples;
import java.io.File;
import java.util.Collection; import java.util.Collection;
import jsprit.analysis.toolbox.GraphStreamViewer; import jsprit.analysis.toolbox.GraphStreamViewer;
import jsprit.analysis.toolbox.GraphStreamViewer.Label;
import jsprit.analysis.toolbox.SolutionPlotter; import jsprit.analysis.toolbox.SolutionPlotter;
import jsprit.analysis.toolbox.SolutionPrinter; import jsprit.analysis.toolbox.SolutionPrinter;
import jsprit.analysis.toolbox.GraphStreamViewer.Label;
import jsprit.core.algorithm.VehicleRoutingAlgorithm; import jsprit.core.algorithm.VehicleRoutingAlgorithm;
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms; import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
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.io.VrpXMLReader; import jsprit.core.problem.io.VrpXMLReader;
import jsprit.core.problem.solution.VehicleRoutingProblemSolution; import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
import jsprit.util.Examples;
public class SolomonOpenExample { public class SolomonOpenExample {
@ -37,13 +37,7 @@ public class SolomonOpenExample {
/* /*
* some preparation - create output folder * some preparation - create output folder
*/ */
File dir = new File("output"); Examples.createOutputFolder();
// 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");
}
/* /*
* Build the problem. * Build the problem.

View file

@ -16,7 +16,6 @@
******************************************************************************/ ******************************************************************************/
package jsprit.examples; package jsprit.examples;
import java.io.File;
import java.util.Collection; import java.util.Collection;
import jsprit.analysis.toolbox.SolutionPlotter; import jsprit.analysis.toolbox.SolutionPlotter;
@ -27,6 +26,7 @@ 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.instance.reader.SolomonReader; import jsprit.instance.reader.SolomonReader;
import jsprit.util.Examples;
public class SolomonR101Example { public class SolomonR101Example {
@ -35,13 +35,7 @@ public class SolomonR101Example {
/* /*
* some preparation - create output folder * some preparation - create output folder
*/ */
File dir = new File("output"); Examples.createOutputFolder();
// 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");
}
/* /*
* Build the problem. * Build the problem.

View file

@ -16,7 +16,6 @@
******************************************************************************/ ******************************************************************************/
package jsprit.examples; package jsprit.examples;
import java.io.File;
import java.util.Collection; import java.util.Collection;
import jsprit.analysis.toolbox.AlgorithmSearchProgressChartListener; import jsprit.analysis.toolbox.AlgorithmSearchProgressChartListener;
@ -30,6 +29,7 @@ import jsprit.core.problem.VehicleRoutingProblem;
import jsprit.core.problem.constraint.ServiceDeliveriesFirstConstraint; import jsprit.core.problem.constraint.ServiceDeliveriesFirstConstraint;
import jsprit.core.problem.io.VrpXMLReader; import jsprit.core.problem.io.VrpXMLReader;
import jsprit.core.problem.solution.VehicleRoutingProblemSolution; import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
import jsprit.util.Examples;
public class VRPWithBackhaulsExample { public class VRPWithBackhaulsExample {
@ -39,13 +39,7 @@ public class VRPWithBackhaulsExample {
/* /*
* some preparation - create output folder * some preparation - create output folder
*/ */
File dir = new File("output"); Examples.createOutputFolder();
// 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");
}
/* /*
* Build the problem. * Build the problem.

View file

@ -16,7 +16,6 @@
******************************************************************************/ ******************************************************************************/
package jsprit.examples; package jsprit.examples;
import java.io.File;
import java.util.Collection; import java.util.Collection;
import jsprit.analysis.toolbox.Plotter; import jsprit.analysis.toolbox.Plotter;
@ -30,6 +29,7 @@ import jsprit.core.problem.VehicleRoutingProblem;
import jsprit.core.problem.constraint.ServiceDeliveriesFirstConstraint; import jsprit.core.problem.constraint.ServiceDeliveriesFirstConstraint;
import jsprit.core.problem.io.VrpXMLReader; import jsprit.core.problem.io.VrpXMLReader;
import jsprit.core.problem.solution.VehicleRoutingProblemSolution; import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
import jsprit.util.Examples;
public class VRPWithBackhaulsExample2 { public class VRPWithBackhaulsExample2 {
@ -39,13 +39,7 @@ public class VRPWithBackhaulsExample2 {
/* /*
* some preparation - create output folder * some preparation - create output folder
*/ */
File dir = new File("output"); Examples.createOutputFolder();
// 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");
}
/* /*
* Build the problem. * Build the problem.