diff --git a/jsprit-core/src/main/java/jsprit/core/reporting/SolutionPrinter.java b/jsprit-core/src/main/java/jsprit/core/reporting/SolutionPrinter.java index 6efd27a2..fa1d7983 100644 --- a/jsprit-core/src/main/java/jsprit/core/reporting/SolutionPrinter.java +++ b/jsprit-core/src/main/java/jsprit/core/reporting/SolutionPrinter.java @@ -1,16 +1,16 @@ /******************************************************************************* - * Copyright (C) 2013 Stefan Schroeder - * + * Copyright (C) 2014 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 + * 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 . ******************************************************************************/ @@ -129,16 +129,17 @@ public class SolutionPrinter { System.out.format(leftAlgin, routeNu, getVehicleString(route), route.getEnd().getName(), "-", Math.round(route.getEnd().getArrTime()), "undef", Math.round(costs)); routeNu++; } - System.out.format("+*:=PenaltyVehicle+%n"); System.out.format("+--------------------------------------------------------------------------------------------------------------------------------+%n"); - System.out.format("+----------------+%n"); - System.out.format("| unassignedJobs |%n"); - System.out.format("+----------------+%n"); - String unassignedJobAlgin = "| %-14s |%n"; - for(Job j : solution.getUnassignedJobs()){ - System.out.format(unassignedJobAlgin,j.getId()); + if(!solution.getUnassignedJobs().isEmpty()) { + System.out.format("+----------------+%n"); + System.out.format("| unassignedJobs |%n"); + System.out.format("+----------------+%n"); + String unassignedJobAlgin = "| %-14s |%n"; + for (Job j : solution.getUnassignedJobs()) { + System.out.format(unassignedJobAlgin, j.getId()); + } + System.out.format("+----------------+%n"); } - System.out.format("+----------------+%n"); } private static String getVehicleString(VehicleRoute route) { diff --git a/jsprit-examples/src/main/java/jsprit/examples/BicycleMessenger.java b/jsprit-examples/src/main/java/jsprit/examples/BicycleMessenger.java index 431277fd..ca70fc32 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/BicycleMessenger.java +++ b/jsprit-examples/src/main/java/jsprit/examples/BicycleMessenger.java @@ -1,34 +1,29 @@ /******************************************************************************* - * Copyright (c) 2014 Stefan Schroeder. - * + * Copyright (C) 2014 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 + * 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 + * 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 . - * - * Contributors: - * Stefan Schroeder - initial API and implementation ******************************************************************************/ package jsprit.examples; import jsprit.analysis.toolbox.GraphStreamViewer; import jsprit.analysis.toolbox.GraphStreamViewer.Label; 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.VehicleRoutingAlgorithmBuilder; import jsprit.core.algorithm.state.StateId; import jsprit.core.algorithm.state.StateManager; import jsprit.core.algorithm.state.StateUpdater; -import jsprit.core.algorithm.termination.VariationCoefficientTermination; import jsprit.core.problem.VehicleRoutingProblem; import jsprit.core.problem.VehicleRoutingProblem.Builder; import jsprit.core.problem.VehicleRoutingProblem.FleetSize; @@ -47,6 +42,7 @@ import jsprit.core.problem.solution.route.activity.TourActivity; import jsprit.core.problem.solution.route.activity.TourActivity.JobActivity; import jsprit.core.problem.solution.route.state.RouteAndActivityStateGetter; import jsprit.core.problem.vehicle.*; +import jsprit.core.reporting.SolutionPrinter; import jsprit.core.util.Coordinate; import jsprit.core.util.CrowFlyCosts; import jsprit.core.util.Solutions; @@ -274,7 +270,7 @@ public class BicycleMessenger { vraBuilder.setStateAndConstraintManager(stateManager, constraintManager); VehicleRoutingAlgorithm algorithm = vraBuilder.build(); algorithm.setMaxIterations(5000); - VariationCoefficientTermination prematureAlgorithmTermination = new VariationCoefficientTermination(200, 0.001); +// VariationCoefficientTermination prematureAlgorithmTermination = new VariationCoefficientTermination(200, 0.001); // algorithm.setPrematureAlgorithmTermination(prematureAlgorithmTermination); // algorithm.addListener(prematureAlgorithmTermination); // algorithm.addListener(new AlgorithmSearchProgressChartListener("output/progress.png")); @@ -285,7 +281,7 @@ public class BicycleMessenger { //this is just to ensure that solution meet the above constraints validateSolution(Solutions.bestOf(solutions), bicycleMessengerProblem, nearestMessengers); - SolutionPrinter.print(bicycleMessengerProblem, Solutions.bestOf(solutions), Print.VERBOSE); + SolutionPrinter.print(bicycleMessengerProblem, Solutions.bestOf(solutions), SolutionPrinter.Print.VERBOSE); //you may want to plot the problem Plotter plotter = new Plotter(bicycleMessengerProblem); @@ -316,12 +312,12 @@ public class BicycleMessenger { for(VehicleRoute route : bestOf.getRoutes()){ for(TourActivity act : route.getActivities()){ if(act.getArrTime() > 3*nearestMessengers.get(((JobActivity)act).getJob().getId())){ - SolutionPrinter.print(bicycleMessengerProblem, bestOf, Print.VERBOSE); + SolutionPrinter.print(bicycleMessengerProblem, bestOf, SolutionPrinter.Print.VERBOSE); throw new IllegalStateException("three times less than ... constraint broken. this must not be. act.getArrTime(): " + act.getArrTime() + " allowed: " + 3*nearestMessengers.get(((JobActivity)act).getJob().getId())); } } if(route.getVehicle().getType() instanceof PenaltyVehicleType){ - SolutionPrinter.print(bicycleMessengerProblem, bestOf, Print.VERBOSE); + SolutionPrinter.print(bicycleMessengerProblem, bestOf, SolutionPrinter.Print.VERBOSE); throw new IllegalStateException("penaltyVehicle in solution. if there is a valid solution, this should not be"); } } diff --git a/jsprit-examples/src/main/java/jsprit/examples/BuildAlgorithmFromScratch.java b/jsprit-examples/src/main/java/jsprit/examples/BuildAlgorithmFromScratch.java index 233d702b..cfd16970 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/BuildAlgorithmFromScratch.java +++ b/jsprit-examples/src/main/java/jsprit/examples/BuildAlgorithmFromScratch.java @@ -1,24 +1,22 @@ /******************************************************************************* - * Copyright (c) 2013 Stefan Schroeder. - * + * Copyright (C) 2014 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 + * 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 + * 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 . - * - * Contributors: - * Stefan Schroeder - initial API and implementation ******************************************************************************/ package jsprit.examples; -import jsprit.analysis.toolbox.SolutionPrinter; + import jsprit.core.algorithm.*; import jsprit.core.algorithm.acceptor.GreedyAcceptance; import jsprit.core.algorithm.module.RuinAndRecreateModule; @@ -38,6 +36,7 @@ import jsprit.core.problem.solution.SolutionCostCalculator; import jsprit.core.problem.solution.VehicleRoutingProblemSolution; import jsprit.core.problem.vehicle.InfiniteFleetManagerFactory; import jsprit.core.problem.vehicle.VehicleFleetManager; +import jsprit.core.reporting.SolutionPrinter; import jsprit.core.util.Solutions; import jsprit.instance.reader.SolomonReader; import jsprit.util.Examples; @@ -46,9 +45,7 @@ import java.util.Collection; public class BuildAlgorithmFromScratch { - /** - * @param args - */ + public static void main(String[] args) { /* * some preparation - create output folder @@ -199,7 +196,7 @@ public class BuildAlgorithmFromScratch { /* * define the nIterations (by default nIteration=100) */ - vra.setNuOfIterations(1000); + vra.setMaxIterations(1000); /* * optionally define a premature termination criterion (by default: not criterion is set) diff --git a/jsprit-examples/src/main/java/jsprit/examples/BuildAlgorithmFromScratchWithHardAndSoftConstraints.java b/jsprit-examples/src/main/java/jsprit/examples/BuildAlgorithmFromScratchWithHardAndSoftConstraints.java index e513b1d3..eab091c8 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/BuildAlgorithmFromScratchWithHardAndSoftConstraints.java +++ b/jsprit-examples/src/main/java/jsprit/examples/BuildAlgorithmFromScratchWithHardAndSoftConstraints.java @@ -1,24 +1,21 @@ /******************************************************************************* - * Copyright (c) 2013 Stefan Schroeder. - * + * Copyright (C) 2014 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 + * 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 + * 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 . - * - * Contributors: - * Stefan Schroeder - initial API and implementation ******************************************************************************/ package jsprit.examples; -import jsprit.analysis.toolbox.SolutionPrinter; import jsprit.core.algorithm.*; import jsprit.core.algorithm.acceptor.GreedyAcceptance; import jsprit.core.algorithm.module.RuinAndRecreateModule; @@ -38,6 +35,7 @@ import jsprit.core.problem.solution.SolutionCostCalculator; import jsprit.core.problem.solution.VehicleRoutingProblemSolution; import jsprit.core.problem.vehicle.InfiniteFleetManagerFactory; import jsprit.core.problem.vehicle.VehicleFleetManager; +import jsprit.core.reporting.SolutionPrinter; import jsprit.core.util.Solutions; import jsprit.instance.reader.SolomonReader; import jsprit.util.Examples; @@ -46,9 +44,6 @@ import java.util.Collection; public class BuildAlgorithmFromScratchWithHardAndSoftConstraints { - /** - * @param args - */ public static void main(String[] args) { /* * some preparation - create output folder @@ -200,7 +195,7 @@ public class BuildAlgorithmFromScratchWithHardAndSoftConstraints { /* * define the nIterations (by default nIteration=100) */ - vra.setNuOfIterations(1000); + vra.setMaxIterations(1000); /* * optionally define a premature termination criterion (by default: not criterion is set) diff --git a/jsprit-examples/src/main/java/jsprit/examples/CompareAlgorithmExample.java b/jsprit-examples/src/main/java/jsprit/examples/CompareAlgorithmExample.java index 7f9c6f64..09e8f2a8 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/CompareAlgorithmExample.java +++ b/jsprit-examples/src/main/java/jsprit/examples/CompareAlgorithmExample.java @@ -1,16 +1,16 @@ /******************************************************************************* - * Copyright (C) 2013 Stefan Schroeder - * + * Copyright (C) 2014 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 + * 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 . ******************************************************************************/ @@ -30,9 +30,7 @@ import jsprit.util.Examples; public class CompareAlgorithmExample { - /** - * @param args - */ + public static void main(String[] args) { /* * some preparation - create output folder diff --git a/jsprit-examples/src/main/java/jsprit/examples/ComputationalExperiments_alphaSenstivity.java b/jsprit-examples/src/main/java/jsprit/examples/ComputationalExperiments_alphaSenstivity.java index ca7d8b9e..1c921542 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/ComputationalExperiments_alphaSenstivity.java +++ b/jsprit-examples/src/main/java/jsprit/examples/ComputationalExperiments_alphaSenstivity.java @@ -1,25 +1,21 @@ /******************************************************************************* - * Copyright (C) 2013 Stefan Schroeder - * + * Copyright (C) 2014 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 + * 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 java.util.Collection; - -import org.apache.commons.configuration.XMLConfiguration; - import jsprit.analysis.toolbox.ComputationalLaboratory; import jsprit.analysis.toolbox.ComputationalLaboratory.CalculationListener; import jsprit.analysis.toolbox.ComputationalLaboratory.DataCollector; @@ -38,6 +34,9 @@ import jsprit.core.util.BenchmarkInstance; import jsprit.core.util.Solutions; import jsprit.instance.reader.SolomonReader; import jsprit.util.Examples; +import org.apache.commons.configuration.XMLConfiguration; + +import java.util.Collection; /** * Based on Solomon's R101 instance @@ -92,8 +91,7 @@ public class ComputationalExperiments_alphaSenstivity { @Override public VehicleRoutingAlgorithm createAlgorithm(VehicleRoutingProblem vrp) { - VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.createAlgorithm(vrp, getAlgorithmConfig(alpha)); - return vra; + return VehicleRoutingAlgorithms.createAlgorithm(vrp, getAlgorithmConfig(alpha)); } }); diff --git a/jsprit-examples/src/main/java/jsprit/examples/ComputationalExperiments_randomVariations.java b/jsprit-examples/src/main/java/jsprit/examples/ComputationalExperiments_randomVariations.java index e57d1138..01a5b5a0 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/ComputationalExperiments_randomVariations.java +++ b/jsprit-examples/src/main/java/jsprit/examples/ComputationalExperiments_randomVariations.java @@ -1,23 +1,21 @@ /******************************************************************************* - * Copyright (C) 2013 Stefan Schroeder - * + * Copyright (C) 2014 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 + * 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 java.util.Collection; - import jsprit.analysis.toolbox.ComputationalLaboratory; import jsprit.analysis.toolbox.ComputationalLaboratory.CalculationListener; import jsprit.analysis.toolbox.XYLineChartBuilder; @@ -32,6 +30,8 @@ import jsprit.core.util.Solutions; import jsprit.instance.reader.SolomonReader; import jsprit.util.Examples; +import java.util.Collection; + /** * Based on Solomon's R101 instance * @@ -83,7 +83,7 @@ public class ComputationalExperiments_randomVariations { @Override public VehicleRoutingAlgorithm createAlgorithm(VehicleRoutingProblem vrp) { VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfigWithSchrimpfAcceptance.xml"); - vra.setNuOfIterations(4000); + vra.setMaxIterations(4000); return vra; } }); diff --git a/jsprit-examples/src/main/java/jsprit/examples/ComputationalExperiments_randomVariations_and_nuOfIterations.java b/jsprit-examples/src/main/java/jsprit/examples/ComputationalExperiments_randomVariations_and_nuOfIterations.java index e5169db6..c1b7f1e4 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/ComputationalExperiments_randomVariations_and_nuOfIterations.java +++ b/jsprit-examples/src/main/java/jsprit/examples/ComputationalExperiments_randomVariations_and_nuOfIterations.java @@ -1,23 +1,21 @@ /******************************************************************************* - * Copyright (C) 2013 Stefan Schroeder - * + * Copyright (C) 2014 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 + * 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 java.util.Collection; - import jsprit.analysis.toolbox.ComputationalLaboratory; import jsprit.analysis.toolbox.ComputationalLaboratory.CalculationListener; import jsprit.analysis.toolbox.ComputationalLaboratory.DataCollector; @@ -32,6 +30,8 @@ import jsprit.core.util.Solutions; import jsprit.instance.reader.SolomonReader; import jsprit.util.Examples; +import java.util.Collection; + /** * Based on Solomon's R101 instance * @@ -164,7 +164,7 @@ public class ComputationalExperiments_randomVariations_and_nuOfIterations { @Override public VehicleRoutingAlgorithm createAlgorithm(VehicleRoutingProblem vrp) { VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfigWithSchrimpfAcceptance.xml"); - vra.setNuOfIterations(iterations); + vra.setMaxIterations(iterations); return vra; } }; diff --git a/jsprit-examples/src/main/java/jsprit/examples/ComputationalExperiments_schrimpf_vs_greedy.java b/jsprit-examples/src/main/java/jsprit/examples/ComputationalExperiments_schrimpf_vs_greedy.java index 60063587..b506048a 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/ComputationalExperiments_schrimpf_vs_greedy.java +++ b/jsprit-examples/src/main/java/jsprit/examples/ComputationalExperiments_schrimpf_vs_greedy.java @@ -1,23 +1,21 @@ /******************************************************************************* - * Copyright (C) 2013 Stefan Schroeder - * + * Copyright (C) 2014 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 + * 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 java.util.Collection; - import jsprit.analysis.toolbox.ComputationalLaboratory; import jsprit.analysis.toolbox.ComputationalLaboratory.CalculationListener; import jsprit.analysis.toolbox.XYLineChartBuilder; @@ -32,6 +30,8 @@ import jsprit.core.util.Solutions; import jsprit.instance.reader.SolomonReader; import jsprit.util.Examples; +import java.util.Collection; + /** * Based on Solomon's R101 instance * @@ -86,7 +86,7 @@ public class ComputationalExperiments_schrimpf_vs_greedy { @Override public VehicleRoutingAlgorithm createAlgorithm(VehicleRoutingProblem vrp) { VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfigWithSchrimpfAcceptance.xml"); - vra.setNuOfIterations(4000); + vra.setMaxIterations(4000); return vra; } }); @@ -95,7 +95,7 @@ public class ComputationalExperiments_schrimpf_vs_greedy { @Override public VehicleRoutingAlgorithm createAlgorithm(VehicleRoutingProblem vrp) { VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfig_solomon.xml"); - vra.setNuOfIterations(4000); + vra.setMaxIterations(4000); return vra; } }); diff --git a/jsprit-examples/src/main/java/jsprit/examples/ConfigureAlgorithmInCodeInsteadOfPerXml.java b/jsprit-examples/src/main/java/jsprit/examples/ConfigureAlgorithmInCodeInsteadOfPerXml.java index 0a166104..f1e186e8 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/ConfigureAlgorithmInCodeInsteadOfPerXml.java +++ b/jsprit-examples/src/main/java/jsprit/examples/ConfigureAlgorithmInCodeInsteadOfPerXml.java @@ -1,25 +1,22 @@ /******************************************************************************* - * Copyright (C) 2013 Stefan Schroeder - * + * Copyright (C) 2014 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 + * 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 java.util.Collection; - import jsprit.analysis.toolbox.Plotter; -import jsprit.analysis.toolbox.SolutionPrinter; import jsprit.core.algorithm.VehicleRoutingAlgorithm; import jsprit.core.algorithm.io.AlgorithmConfig; import jsprit.core.algorithm.io.VehicleRoutingAlgorithms; @@ -27,17 +24,18 @@ import jsprit.core.problem.VehicleRoutingProblem; import jsprit.core.problem.io.VrpXMLWriter; import jsprit.core.problem.job.Service; import jsprit.core.problem.solution.VehicleRoutingProblemSolution; -import jsprit.core.problem.vehicle.Vehicle; import jsprit.core.problem.vehicle.VehicleImpl; import jsprit.core.problem.vehicle.VehicleImpl.Builder; import jsprit.core.problem.vehicle.VehicleType; import jsprit.core.problem.vehicle.VehicleTypeImpl; +import jsprit.core.reporting.SolutionPrinter; import jsprit.core.util.Coordinate; import jsprit.core.util.Solutions; import jsprit.util.Examples; - import org.apache.commons.configuration.XMLConfiguration; +import java.util.Collection; + public class ConfigureAlgorithmInCodeInsteadOfPerXml { @@ -59,7 +57,7 @@ public class ConfigureAlgorithmInCodeInsteadOfPerXml { Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle"); vehicleBuilder.setStartLocationCoordinate(Coordinate.newInstance(10, 10)); vehicleBuilder.setType(vehicleType); - Vehicle vehicle = vehicleBuilder.build(); + VehicleImpl vehicle = vehicleBuilder.build(); /* * build services at the required locations, each with a capacity-demand of 1. diff --git a/jsprit-examples/src/main/java/jsprit/examples/CostMatrixExample.java b/jsprit-examples/src/main/java/jsprit/examples/CostMatrixExample.java index d653ed81..1d83d0fc 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/CostMatrixExample.java +++ b/jsprit-examples/src/main/java/jsprit/examples/CostMatrixExample.java @@ -1,23 +1,22 @@ /******************************************************************************* - * Copyright (C) 2013 Stefan Schroeder - * + * Copyright (C) 2014 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 + * 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.analysis.toolbox.Plotter; -import jsprit.analysis.toolbox.SolutionPrinter; import jsprit.core.algorithm.VehicleRoutingAlgorithm; import jsprit.core.algorithm.io.VehicleRoutingAlgorithms; import jsprit.core.problem.VehicleRoutingProblem; @@ -28,6 +27,7 @@ import jsprit.core.problem.solution.VehicleRoutingProblemSolution; import jsprit.core.problem.vehicle.VehicleImpl; import jsprit.core.problem.vehicle.VehicleType; import jsprit.core.problem.vehicle.VehicleTypeImpl; +import jsprit.core.reporting.SolutionPrinter; import jsprit.core.util.Solutions; import jsprit.core.util.VehicleRoutingTransportCostsMatrix; import jsprit.util.Examples; diff --git a/jsprit-examples/src/main/java/jsprit/examples/EnRoutePickupAndDeliveryWithMultipleDepotsAndOpenRoutesExample.java b/jsprit-examples/src/main/java/jsprit/examples/EnRoutePickupAndDeliveryWithMultipleDepotsAndOpenRoutesExample.java index 3bcf09c7..b7b6c7f5 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/EnRoutePickupAndDeliveryWithMultipleDepotsAndOpenRoutesExample.java +++ b/jsprit-examples/src/main/java/jsprit/examples/EnRoutePickupAndDeliveryWithMultipleDepotsAndOpenRoutesExample.java @@ -1,28 +1,24 @@ /******************************************************************************* - * Copyright (C) 2013 Stefan Schroeder - * + * Copyright (C) 2014 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 + * 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 java.util.Arrays; -import java.util.Collection; - import jsprit.analysis.toolbox.GraphStreamViewer; import jsprit.analysis.toolbox.GraphStreamViewer.Label; import jsprit.analysis.toolbox.Plotter; -import jsprit.analysis.toolbox.SolutionPrinter; import jsprit.core.algorithm.VehicleRoutingAlgorithm; import jsprit.core.algorithm.io.VehicleRoutingAlgorithms; import jsprit.core.problem.VehicleRoutingProblem; @@ -30,15 +26,18 @@ import jsprit.core.problem.VehicleRoutingProblem.FleetSize; import jsprit.core.problem.io.VrpXMLWriter; import jsprit.core.problem.job.Shipment; import jsprit.core.problem.solution.VehicleRoutingProblemSolution; -import jsprit.core.problem.vehicle.Vehicle; import jsprit.core.problem.vehicle.VehicleImpl; import jsprit.core.problem.vehicle.VehicleImpl.Builder; import jsprit.core.problem.vehicle.VehicleType; import jsprit.core.problem.vehicle.VehicleTypeImpl; +import jsprit.core.reporting.SolutionPrinter; import jsprit.core.util.Coordinate; import jsprit.core.util.Solutions; import jsprit.util.Examples; +import java.util.Arrays; +import java.util.Collection; + public class EnRoutePickupAndDeliveryWithMultipleDepotsAndOpenRoutesExample { @@ -63,22 +62,22 @@ public class EnRoutePickupAndDeliveryWithMultipleDepotsAndOpenRoutesExample { Builder vehicleBuilder1 = VehicleImpl.Builder.newInstance("vehicles@[10,10]"); vehicleBuilder1.setStartLocationCoordinate(Coordinate.newInstance(10, 10)).setReturnToDepot(false); vehicleBuilder1.setType(vehicleType); - Vehicle vehicle1 = vehicleBuilder1.build(); + VehicleImpl vehicle1 = vehicleBuilder1.build(); Builder vehicleBuilder2 = VehicleImpl.Builder.newInstance("vehicles@[30,30]"); vehicleBuilder2.setStartLocationCoordinate(Coordinate.newInstance(30, 30)).setReturnToDepot(false); vehicleBuilder2.setType(vehicleType); - Vehicle vehicle2 = vehicleBuilder2.build(); + VehicleImpl vehicle2 = vehicleBuilder2.build(); Builder vehicleBuilder3 = VehicleImpl.Builder.newInstance("vehicles@[10,30]"); vehicleBuilder3.setStartLocationCoordinate(Coordinate.newInstance(10, 30)); vehicleBuilder3.setType(vehicleType); - Vehicle vehicle3 = vehicleBuilder3.build(); + VehicleImpl vehicle3 = vehicleBuilder3.build(); Builder vehicleBuilder4 = VehicleImpl.Builder.newInstance("vehicles@[30,10]"); vehicleBuilder4.setStartLocationCoordinate(Coordinate.newInstance(30, 10)); vehicleBuilder4.setType(vehicleType); - Vehicle vehicle4 = vehicleBuilder4.build(); + VehicleImpl vehicle4 = vehicleBuilder4.build(); /* * build shipments at the required locations, each with a capacity-demand of 1. diff --git a/jsprit-examples/src/main/java/jsprit/examples/EnRoutePickupAndDeliveryWithMultipleDepotsAndVehicleAccessConstraintAndSpecifiedVehicleEndLocationsExample.java b/jsprit-examples/src/main/java/jsprit/examples/EnRoutePickupAndDeliveryWithMultipleDepotsAndVehicleAccessConstraintAndSpecifiedVehicleEndLocationsExample.java index df566130..21d54126 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/EnRoutePickupAndDeliveryWithMultipleDepotsAndVehicleAccessConstraintAndSpecifiedVehicleEndLocationsExample.java +++ b/jsprit-examples/src/main/java/jsprit/examples/EnRoutePickupAndDeliveryWithMultipleDepotsAndVehicleAccessConstraintAndSpecifiedVehicleEndLocationsExample.java @@ -1,16 +1,16 @@ /******************************************************************************* - * Copyright (C) 2013 Stefan Schroeder - * + * Copyright (C) 2014 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 + * 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 . ******************************************************************************/ @@ -18,7 +18,6 @@ package jsprit.examples; import jsprit.analysis.toolbox.GraphStreamViewer; import jsprit.analysis.toolbox.GraphStreamViewer.Label; -import jsprit.analysis.toolbox.SolutionPrinter; import jsprit.core.algorithm.VehicleRoutingAlgorithm; import jsprit.core.algorithm.VehicleRoutingAlgorithmBuilder; import jsprit.core.algorithm.state.StateManager; @@ -34,6 +33,7 @@ import jsprit.core.problem.vehicle.VehicleImpl; import jsprit.core.problem.vehicle.VehicleImpl.Builder; import jsprit.core.problem.vehicle.VehicleType; import jsprit.core.problem.vehicle.VehicleTypeImpl; +import jsprit.core.reporting.SolutionPrinter; import jsprit.core.util.Coordinate; import jsprit.core.util.Solutions; import jsprit.util.Examples; diff --git a/jsprit-examples/src/main/java/jsprit/examples/HVRPBenchmarkExample.java b/jsprit-examples/src/main/java/jsprit/examples/HVRPBenchmarkExample.java index 2d77d4fc..03dff1cd 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/HVRPBenchmarkExample.java +++ b/jsprit-examples/src/main/java/jsprit/examples/HVRPBenchmarkExample.java @@ -1,32 +1,29 @@ /******************************************************************************* - * Copyright (c) 2014 Stefan Schroeder. - * + * Copyright (C) 2014 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 + * 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 + * 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 . - * - * Contributors: - * Stefan Schroeder - initial API and implementation ******************************************************************************/ package jsprit.examples; import jsprit.analysis.toolbox.AlgorithmSearchProgressChartListener; import jsprit.analysis.toolbox.GraphStreamViewer; 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.problem.VehicleRoutingProblem; import jsprit.core.problem.solution.VehicleRoutingProblemSolution; +import jsprit.core.reporting.SolutionPrinter; import jsprit.core.util.Solutions; import jsprit.instance.reader.VrphGoldenReader; import jsprit.instance.reader.VrphGoldenReader.VrphType; @@ -64,14 +61,14 @@ public class HVRPBenchmarkExample { //results might even be a bit better, but it is slower, since it checks insertion on routeLevel //rather than on local level VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfig_considerFixedCosts.xml"); - vra.setNuOfIterations(10000); + vra.setMaxIterations(10000); // vra.setPrematureAlgorithmTermination(new IterationWithoutImprovementTermination(500)); vra.addListener(new AlgorithmSearchProgressChartListener("output/progress.png")); Collection solutions = vra.searchSolutions(); VehicleRoutingProblemSolution best = Solutions.bestOf(solutions); - SolutionPrinter.print(vrp, best, Print.VERBOSE); + SolutionPrinter.print(vrp, best, SolutionPrinter.Print.VERBOSE); Plotter plotter = new Plotter(vrp,best); diff --git a/jsprit-examples/src/main/java/jsprit/examples/HVRPExample.java b/jsprit-examples/src/main/java/jsprit/examples/HVRPExample.java index df4c8020..9c8d7428 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/HVRPExample.java +++ b/jsprit-examples/src/main/java/jsprit/examples/HVRPExample.java @@ -1,26 +1,22 @@ /******************************************************************************* - * Copyright (c) 2014 Stefan Schroeder. - * + * Copyright (C) 2014 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 + * 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 + * 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 . - * - * Contributors: - * Stefan Schroeder - initial API and implementation ******************************************************************************/ package jsprit.examples; import jsprit.analysis.toolbox.GraphStreamViewer; -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.problem.VehicleRoutingProblem; @@ -30,6 +26,7 @@ import jsprit.core.problem.solution.VehicleRoutingProblemSolution; import jsprit.core.problem.vehicle.VehicleImpl; import jsprit.core.problem.vehicle.VehicleType; import jsprit.core.problem.vehicle.VehicleTypeImpl; +import jsprit.core.reporting.SolutionPrinter; import jsprit.core.util.Coordinate; import jsprit.core.util.Solutions; @@ -126,7 +123,7 @@ public class HVRPExample { VehicleRoutingProblemSolution best = Solutions.bestOf(solutions); - SolutionPrinter.print(vrp, best, Print.VERBOSE); + SolutionPrinter.print(vrp, best, SolutionPrinter.Print.VERBOSE); new GraphStreamViewer(vrp, best).setRenderDelay(100).display(); diff --git a/jsprit-examples/src/main/java/jsprit/examples/MultipleDepotExample.java b/jsprit-examples/src/main/java/jsprit/examples/MultipleDepotExample.java index 782babb0..bd3ec39b 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/MultipleDepotExample.java +++ b/jsprit-examples/src/main/java/jsprit/examples/MultipleDepotExample.java @@ -1,22 +1,25 @@ /******************************************************************************* - * Copyright (C) 2013 Stefan Schroeder - * + * Copyright (C) 2014 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 + * 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.analysis.toolbox.*; +import jsprit.analysis.toolbox.AlgorithmSearchProgressChartListener; +import jsprit.analysis.toolbox.GraphStreamViewer; +import jsprit.analysis.toolbox.Plotter; +import jsprit.analysis.toolbox.StopWatch; import jsprit.core.algorithm.VehicleRoutingAlgorithm; import jsprit.core.algorithm.io.VehicleRoutingAlgorithms; import jsprit.core.algorithm.listener.VehicleRoutingAlgorithmListeners.Priority; @@ -26,6 +29,7 @@ import jsprit.core.problem.io.VrpXMLReader; import jsprit.core.problem.solution.VehicleRoutingProblemSolution; import jsprit.core.problem.vehicle.VehicleImpl; import jsprit.core.problem.vehicle.VehicleTypeImpl; +import jsprit.core.reporting.SolutionPrinter; import jsprit.core.util.Coordinate; import jsprit.core.util.Solutions; import jsprit.util.Examples; diff --git a/jsprit-examples/src/main/java/jsprit/examples/MultipleDepotExampleWithPenaltyVehicles.java b/jsprit-examples/src/main/java/jsprit/examples/MultipleDepotExampleWithPenaltyVehicles.java index 633825a0..3269c85f 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/MultipleDepotExampleWithPenaltyVehicles.java +++ b/jsprit-examples/src/main/java/jsprit/examples/MultipleDepotExampleWithPenaltyVehicles.java @@ -1,16 +1,16 @@ /******************************************************************************* - * Copyright (C) 2013 Stefan Schroeder - * + * Copyright (C) 2014 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 + * 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 . ******************************************************************************/ @@ -107,7 +107,7 @@ public class MultipleDepotExampleWithPenaltyVehicles { * solve the problem */ VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfig.xml"); - vra.setMaxIterations(1); + vra.setMaxIterations(2000); vra.getAlgorithmListeners().addListener(new StopWatch(),Priority.HIGH); // vra.getAlgorithmListeners().addListener(new AlgorithmSearchProgressChartListener("output/progress.png")); Collection solutions = vra.searchSolutions(); diff --git a/jsprit-examples/src/main/java/jsprit/examples/MultipleDepotWithInitialRoutesExample.java b/jsprit-examples/src/main/java/jsprit/examples/MultipleDepotWithInitialRoutesExample.java index 36347993..68e932ad 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/MultipleDepotWithInitialRoutesExample.java +++ b/jsprit-examples/src/main/java/jsprit/examples/MultipleDepotWithInitialRoutesExample.java @@ -1,16 +1,16 @@ /******************************************************************************* - * Copyright (C) 2013 Stefan Schroeder - * + * Copyright (C) 2014 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 + * 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 . ******************************************************************************/ @@ -18,7 +18,6 @@ package jsprit.examples; import jsprit.analysis.toolbox.Plotter; import jsprit.analysis.toolbox.Plotter.Label; -import jsprit.analysis.toolbox.SolutionPrinter; import jsprit.core.algorithm.VehicleRoutingAlgorithm; import jsprit.core.algorithm.io.VehicleRoutingAlgorithms; import jsprit.core.problem.VehicleRoutingProblem; @@ -29,6 +28,7 @@ import jsprit.core.problem.job.Service; import jsprit.core.problem.solution.VehicleRoutingProblemSolution; import jsprit.core.problem.solution.route.VehicleRoute; import jsprit.core.problem.vehicle.Vehicle; +import jsprit.core.reporting.SolutionPrinter; import jsprit.core.util.Solutions; import jsprit.util.Examples; diff --git a/jsprit-examples/src/main/java/jsprit/examples/PickupAndDeliveryExample.java b/jsprit-examples/src/main/java/jsprit/examples/PickupAndDeliveryExample.java index 2583388b..587220b8 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/PickupAndDeliveryExample.java +++ b/jsprit-examples/src/main/java/jsprit/examples/PickupAndDeliveryExample.java @@ -1,35 +1,35 @@ /******************************************************************************* - * Copyright (C) 2013 Stefan Schroeder - * + * Copyright (C) 2014 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 + * 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 java.util.Collection; - import jsprit.analysis.toolbox.AlgorithmSearchProgressChartListener; import jsprit.analysis.toolbox.Plotter; import jsprit.analysis.toolbox.Plotter.Label; -import jsprit.analysis.toolbox.SolutionPrinter; import jsprit.core.algorithm.VehicleRoutingAlgorithm; import jsprit.core.algorithm.io.VehicleRoutingAlgorithms; import jsprit.core.algorithm.selector.SelectBest; import jsprit.core.problem.VehicleRoutingProblem; import jsprit.core.problem.io.VrpXMLReader; import jsprit.core.problem.solution.VehicleRoutingProblemSolution; +import jsprit.core.reporting.SolutionPrinter; import jsprit.util.Examples; +import java.util.Collection; + public class PickupAndDeliveryExample { diff --git a/jsprit-examples/src/main/java/jsprit/examples/PickupAndDeliveryExample2.java b/jsprit-examples/src/main/java/jsprit/examples/PickupAndDeliveryExample2.java index 5191000f..b3c4adbe 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/PickupAndDeliveryExample2.java +++ b/jsprit-examples/src/main/java/jsprit/examples/PickupAndDeliveryExample2.java @@ -1,16 +1,16 @@ /******************************************************************************* - * Copyright (C) 2013 Stefan Schroeder - * + * Copyright (C) 2014 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 + * 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 . ******************************************************************************/ @@ -20,13 +20,13 @@ import jsprit.analysis.toolbox.AlgorithmSearchProgressChartListener; import jsprit.analysis.toolbox.GraphStreamViewer; import jsprit.analysis.toolbox.Plotter; import jsprit.analysis.toolbox.Plotter.Label; -import jsprit.analysis.toolbox.SolutionPrinter; import jsprit.core.algorithm.VehicleRoutingAlgorithm; import jsprit.core.algorithm.io.VehicleRoutingAlgorithms; import jsprit.core.algorithm.selector.SelectBest; import jsprit.core.problem.VehicleRoutingProblem; import jsprit.core.problem.io.VrpXMLReader; import jsprit.core.problem.solution.VehicleRoutingProblemSolution; +import jsprit.core.reporting.SolutionPrinter; import jsprit.util.Examples; import java.util.Collection; diff --git a/jsprit-examples/src/main/java/jsprit/examples/PickupAndDeliveryOpenExample.java b/jsprit-examples/src/main/java/jsprit/examples/PickupAndDeliveryOpenExample.java index 30c85294..e6eead1c 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/PickupAndDeliveryOpenExample.java +++ b/jsprit-examples/src/main/java/jsprit/examples/PickupAndDeliveryOpenExample.java @@ -1,35 +1,35 @@ /******************************************************************************* - * Copyright (C) 2013 Stefan Schroeder - * + * Copyright (C) 2014 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 + * 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 java.util.Collection; - import jsprit.analysis.toolbox.AlgorithmSearchProgressChartListener; import jsprit.analysis.toolbox.Plotter; import jsprit.analysis.toolbox.Plotter.Label; -import jsprit.analysis.toolbox.SolutionPrinter; import jsprit.core.algorithm.VehicleRoutingAlgorithm; import jsprit.core.algorithm.io.VehicleRoutingAlgorithms; import jsprit.core.algorithm.selector.SelectBest; import jsprit.core.problem.VehicleRoutingProblem; import jsprit.core.problem.io.VrpXMLReader; import jsprit.core.problem.solution.VehicleRoutingProblemSolution; +import jsprit.core.reporting.SolutionPrinter; import jsprit.util.Examples; +import java.util.Collection; + public class PickupAndDeliveryOpenExample { diff --git a/jsprit-examples/src/main/java/jsprit/examples/RefuseCollectionExample.java b/jsprit-examples/src/main/java/jsprit/examples/RefuseCollectionExample.java index 61347000..a5d70d82 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/RefuseCollectionExample.java +++ b/jsprit-examples/src/main/java/jsprit/examples/RefuseCollectionExample.java @@ -1,48 +1,43 @@ /******************************************************************************* - * Copyright (C) 2013 Stefan Schroeder - * + * Copyright (C) 2014 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 + * 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 java.io.BufferedReader; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.IOException; -import java.util.Collection; -import java.util.Map; - -import jsprit.analysis.toolbox.SolutionPrinter; import jsprit.core.algorithm.VehicleRoutingAlgorithm; import jsprit.core.algorithm.box.GreedySchrimpfFactory; import jsprit.core.algorithm.termination.IterationWithoutImprovementTermination; import jsprit.core.problem.VehicleRoutingProblem; import jsprit.core.problem.VehicleRoutingProblem.FleetSize; -import jsprit.core.problem.cost.VehicleRoutingTransportCosts; -import jsprit.core.problem.driver.Driver; import jsprit.core.problem.io.VrpXMLWriter; import jsprit.core.problem.job.Service; import jsprit.core.problem.solution.VehicleRoutingProblemSolution; -import jsprit.core.problem.vehicle.Vehicle; import jsprit.core.problem.vehicle.VehicleImpl; import jsprit.core.problem.vehicle.VehicleTypeImpl; +import jsprit.core.reporting.SolutionPrinter; import jsprit.core.util.Solutions; import jsprit.core.util.VehicleRoutingTransportCostsMatrix; import jsprit.core.util.VehicleRoutingTransportCostsMatrix.Builder; import jsprit.util.Examples; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.util.Collection; + /** @@ -56,16 +51,16 @@ public class RefuseCollectionExample { static class RelationKey { - static RelationKey newKey(String from, String to){ - int fromInt = Integer.parseInt(from); - int toInt = Integer.parseInt(to); - if(fromInt < toInt){ - return new RelationKey(from, to); - } - else { - return new RelationKey(to, from); - } - } +// static RelationKey newKey(String from, String to){ +// int fromInt = Integer.parseInt(from); +// int toInt = Integer.parseInt(to); +// if(fromInt < toInt){ +// return new RelationKey(from, to); +// } +// else { +// return new RelationKey(to, from); +// } +// } final String from; final String to; @@ -114,43 +109,39 @@ public class RefuseCollectionExample { } } - static class RoutingCosts implements VehicleRoutingTransportCosts { +// static class RoutingCosts implements VehicleRoutingTransportCosts { +// +// private Map distances; +// +// public RoutingCosts(Map distances) { +// super(); +// this.distances = distances; +// } +// +// @Override +// public double getTransportTime(String fromId, String toId, double departureTime, Driver driver, Vehicle vehicle) { +// return getTransportCost(fromId, toId, departureTime, driver, vehicle); +// } +// +// @Override +// public double getBackwardTransportTime(String fromId, String toId, double arrivalTime, Driver driver, Vehicle vehicle) { +// return getTransportCost(fromId, toId, arrivalTime, driver, vehicle); +// } +// +// @Override +// public double getTransportCost(String fromId, String toId,double departureTime, Driver driver, Vehicle vehicle) { +// if(fromId.equals(toId)) return 0.0; +// RelationKey key = RelationKey.newKey(fromId, toId); +// return distances.get(key); +// } +// +// @Override +// public double getBackwardTransportCost(String fromId, String toId,double arrivalTime, Driver driver, Vehicle vehicle) { +// return getTransportCost(fromId, toId, arrivalTime, driver, vehicle); +// } +// +// } - private Map distances; - - public RoutingCosts(Map distances) { - super(); - this.distances = distances; - } - - @Override - public double getTransportTime(String fromId, String toId, double departureTime, Driver driver, Vehicle vehicle) { - return getTransportCost(fromId, toId, departureTime, driver, vehicle); - } - - @Override - public double getBackwardTransportTime(String fromId, String toId, double arrivalTime, Driver driver, Vehicle vehicle) { - return getTransportCost(fromId, toId, arrivalTime, driver, vehicle); - } - - @Override - public double getTransportCost(String fromId, String toId,double departureTime, Driver driver, Vehicle vehicle) { - if(fromId.equals(toId)) return 0.0; - RelationKey key = RelationKey.newKey(fromId, toId); - return distances.get(key); - } - - @Override - public double getBackwardTransportCost(String fromId, String toId,double arrivalTime, Driver driver, Vehicle vehicle) { - return getTransportCost(fromId, toId, arrivalTime, driver, vehicle); - } - - } - - /** - * @param args - * @throws IOException - */ public static void main(String[] args) throws IOException { /* * some preparation - create output folder @@ -167,7 +158,7 @@ public class RefuseCollectionExample { VehicleImpl.Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle"); vehicleBuilder.setStartLocationId("1"); vehicleBuilder.setType(bigType); - Vehicle bigVehicle = vehicleBuilder.build(); + VehicleImpl bigVehicle = vehicleBuilder.build(); /* * start building the problem @@ -202,9 +193,9 @@ public class RefuseCollectionExample { } - private static void readDemandQuantities(VehicleRoutingProblem.Builder vrpBuilder) throws FileNotFoundException, IOException { + private static void readDemandQuantities(VehicleRoutingProblem.Builder vrpBuilder) throws IOException { BufferedReader reader = new BufferedReader(new FileReader(new File("input/RefuseCollectionExample_Quantities"))); - String line = null; + String line; boolean firstLine = true; while((line = reader.readLine()) != null){ if(firstLine) { @@ -227,7 +218,7 @@ public class RefuseCollectionExample { private static void readDistances(Builder matrixBuilder) throws IOException { BufferedReader reader = new BufferedReader(new FileReader(new File("input/RefuseCollectionExample_Distances"))); - String line = null; + String line; boolean firstLine = true; while((line = reader.readLine()) != null){ if(firstLine) { diff --git a/jsprit-examples/src/main/java/jsprit/examples/ServicePickupsWithMultipleDepotsExample.java b/jsprit-examples/src/main/java/jsprit/examples/ServicePickupsWithMultipleDepotsExample.java index e23fa780..b953d326 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/ServicePickupsWithMultipleDepotsExample.java +++ b/jsprit-examples/src/main/java/jsprit/examples/ServicePickupsWithMultipleDepotsExample.java @@ -1,43 +1,42 @@ /******************************************************************************* - * Copyright (C) 2013 Stefan Schroeder - * + * Copyright (C) 2014 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 + * 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 java.util.Arrays; -import java.util.Collection; - import jsprit.analysis.toolbox.GraphStreamViewer; import jsprit.analysis.toolbox.GraphStreamViewer.Label; import jsprit.analysis.toolbox.Plotter; -import jsprit.analysis.toolbox.SolutionPrinter; import jsprit.core.algorithm.VehicleRoutingAlgorithm; import jsprit.core.algorithm.io.VehicleRoutingAlgorithms; import jsprit.core.problem.VehicleRoutingProblem; import jsprit.core.problem.io.VrpXMLWriter; import jsprit.core.problem.job.Service; import jsprit.core.problem.solution.VehicleRoutingProblemSolution; -import jsprit.core.problem.vehicle.Vehicle; import jsprit.core.problem.vehicle.VehicleImpl; import jsprit.core.problem.vehicle.VehicleImpl.Builder; import jsprit.core.problem.vehicle.VehicleType; import jsprit.core.problem.vehicle.VehicleTypeImpl; +import jsprit.core.reporting.SolutionPrinter; import jsprit.core.util.Coordinate; import jsprit.core.util.Solutions; import jsprit.util.Examples; +import java.util.Arrays; +import java.util.Collection; + public class ServicePickupsWithMultipleDepotsExample { @@ -60,12 +59,12 @@ public class ServicePickupsWithMultipleDepotsExample { Builder vehicleBuilder1 = VehicleImpl.Builder.newInstance("vehicles@[10,10]"); vehicleBuilder1.setStartLocationCoordinate(Coordinate.newInstance(10, 10)); vehicleBuilder1.setType(vehicleType); - Vehicle vehicle1 = vehicleBuilder1.build(); + VehicleImpl vehicle1 = vehicleBuilder1.build(); Builder vehicleBuilder2 = VehicleImpl.Builder.newInstance("vehicles@[50,50]"); vehicleBuilder2.setStartLocationCoordinate(Coordinate.newInstance(50, 50)); vehicleBuilder2.setType(vehicleType); - Vehicle vehicle2 = vehicleBuilder2.build(); + VehicleImpl vehicle2 = vehicleBuilder2.build(); /* @@ -102,7 +101,7 @@ public class ServicePickupsWithMultipleDepotsExample { * get the algorithm out-of-the-box. */ VehicleRoutingAlgorithm algorithm = VehicleRoutingAlgorithms.readAndCreateAlgorithm(problem, "input/algorithmConfig.xml"); - algorithm.setNuOfIterations(10); + algorithm.setMaxIterations(10); /* * and search a solution diff --git a/jsprit-examples/src/main/java/jsprit/examples/SimpleDepotBoundedPickupAndDeliveryExample.java b/jsprit-examples/src/main/java/jsprit/examples/SimpleDepotBoundedPickupAndDeliveryExample.java index 8c7e1680..1b06d866 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/SimpleDepotBoundedPickupAndDeliveryExample.java +++ b/jsprit-examples/src/main/java/jsprit/examples/SimpleDepotBoundedPickupAndDeliveryExample.java @@ -1,26 +1,23 @@ /******************************************************************************* - * Copyright (C) 2013 Stefan Schroeder - * + * Copyright (C) 2014 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 + * 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 java.util.Collection; - import jsprit.analysis.toolbox.Plotter; import jsprit.analysis.toolbox.Plotter.Label; -import jsprit.analysis.toolbox.SolutionPrinter; import jsprit.core.algorithm.VehicleRoutingAlgorithm; import jsprit.core.algorithm.box.SchrimpfFactory; import jsprit.core.problem.VehicleRoutingProblem; @@ -28,15 +25,17 @@ import jsprit.core.problem.io.VrpXMLWriter; import jsprit.core.problem.job.Delivery; import jsprit.core.problem.job.Pickup; import jsprit.core.problem.solution.VehicleRoutingProblemSolution; -import jsprit.core.problem.vehicle.Vehicle; import jsprit.core.problem.vehicle.VehicleImpl; import jsprit.core.problem.vehicle.VehicleImpl.Builder; import jsprit.core.problem.vehicle.VehicleType; import jsprit.core.problem.vehicle.VehicleTypeImpl; +import jsprit.core.reporting.SolutionPrinter; import jsprit.core.util.Coordinate; import jsprit.core.util.Solutions; import jsprit.util.Examples; +import java.util.Collection; + public class SimpleDepotBoundedPickupAndDeliveryExample { @@ -58,7 +57,7 @@ public class SimpleDepotBoundedPickupAndDeliveryExample { Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle"); vehicleBuilder.setStartLocationCoordinate(Coordinate.newInstance(10, 10)); vehicleBuilder.setType(vehicleType); - Vehicle vehicle = vehicleBuilder.build(); + VehicleImpl vehicle = vehicleBuilder.build(); /* * build pickups and deliveries at the required locations, each with a capacity-demand of 1. diff --git a/jsprit-examples/src/main/java/jsprit/examples/SimpleEnRoutePickupAndDeliveryExample.java b/jsprit-examples/src/main/java/jsprit/examples/SimpleEnRoutePickupAndDeliveryExample.java index 662726f5..f0e054f5 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/SimpleEnRoutePickupAndDeliveryExample.java +++ b/jsprit-examples/src/main/java/jsprit/examples/SimpleEnRoutePickupAndDeliveryExample.java @@ -1,42 +1,41 @@ /******************************************************************************* - * Copyright (C) 2013 Stefan Schroeder - * + * Copyright (C) 2014 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 + * 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 java.util.Arrays; -import java.util.Collection; - import jsprit.analysis.toolbox.GraphStreamViewer; import jsprit.analysis.toolbox.Plotter; -import jsprit.analysis.toolbox.SolutionPrinter; import jsprit.core.algorithm.VehicleRoutingAlgorithm; import jsprit.core.algorithm.box.SchrimpfFactory; import jsprit.core.problem.VehicleRoutingProblem; import jsprit.core.problem.io.VrpXMLWriter; import jsprit.core.problem.job.Shipment; import jsprit.core.problem.solution.VehicleRoutingProblemSolution; -import jsprit.core.problem.vehicle.Vehicle; import jsprit.core.problem.vehicle.VehicleImpl; import jsprit.core.problem.vehicle.VehicleImpl.Builder; import jsprit.core.problem.vehicle.VehicleType; import jsprit.core.problem.vehicle.VehicleTypeImpl; +import jsprit.core.reporting.SolutionPrinter; import jsprit.core.util.Coordinate; import jsprit.core.util.Solutions; import jsprit.util.Examples; +import java.util.Arrays; +import java.util.Collection; + public class SimpleEnRoutePickupAndDeliveryExample { @@ -58,7 +57,7 @@ public class SimpleEnRoutePickupAndDeliveryExample { Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle"); vehicleBuilder.setStartLocationCoordinate(Coordinate.newInstance(10, 10)); vehicleBuilder.setType(vehicleType); - Vehicle vehicle = vehicleBuilder.build(); + VehicleImpl vehicle = vehicleBuilder.build(); /* * build shipments at the required locations, each with a capacity-demand of 1. diff --git a/jsprit-examples/src/main/java/jsprit/examples/SimpleEnRoutePickupAndDeliveryOpenRoutesExample.java b/jsprit-examples/src/main/java/jsprit/examples/SimpleEnRoutePickupAndDeliveryOpenRoutesExample.java index 0d0c4c48..3559e8bc 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/SimpleEnRoutePickupAndDeliveryOpenRoutesExample.java +++ b/jsprit-examples/src/main/java/jsprit/examples/SimpleEnRoutePickupAndDeliveryOpenRoutesExample.java @@ -1,42 +1,40 @@ /******************************************************************************* - * Copyright (C) 2013 Stefan Schroeder - * + * Copyright (C) 2014 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 + * 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 java.util.Collection; - import jsprit.analysis.toolbox.GraphStreamViewer; 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.box.SchrimpfFactory; import jsprit.core.problem.VehicleRoutingProblem; import jsprit.core.problem.io.VrpXMLWriter; import jsprit.core.problem.job.Shipment; import jsprit.core.problem.solution.VehicleRoutingProblemSolution; -import jsprit.core.problem.vehicle.Vehicle; import jsprit.core.problem.vehicle.VehicleImpl; import jsprit.core.problem.vehicle.VehicleImpl.Builder; import jsprit.core.problem.vehicle.VehicleType; import jsprit.core.problem.vehicle.VehicleTypeImpl; +import jsprit.core.reporting.SolutionPrinter; import jsprit.core.util.Coordinate; import jsprit.core.util.Solutions; import jsprit.util.Examples; +import java.util.Collection; + public class SimpleEnRoutePickupAndDeliveryOpenRoutesExample { @@ -59,7 +57,7 @@ public class SimpleEnRoutePickupAndDeliveryOpenRoutesExample { vehicleBuilder.setStartLocationCoordinate(Coordinate.newInstance(10, 10)); vehicleBuilder.setType(vehicleType); vehicleBuilder.setReturnToDepot(false); - Vehicle vehicle = vehicleBuilder.build(); + VehicleImpl vehicle = vehicleBuilder.build(); /* * build shipments at the required locations, each with a capacity-demand of 1. @@ -106,7 +104,7 @@ public class SimpleEnRoutePickupAndDeliveryOpenRoutesExample { /* * print nRoutes and totalCosts of bestSolution */ - SolutionPrinter.print(problem,bestSolution,Print.VERBOSE); + SolutionPrinter.print(problem, bestSolution, SolutionPrinter.Print.VERBOSE); /* * plot problem without solution diff --git a/jsprit-examples/src/main/java/jsprit/examples/SimpleEnRoutePickupAndDeliveryWithDepotBoundedDeliveriesExample.java b/jsprit-examples/src/main/java/jsprit/examples/SimpleEnRoutePickupAndDeliveryWithDepotBoundedDeliveriesExample.java index 5fcfec0d..e2404c8d 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/SimpleEnRoutePickupAndDeliveryWithDepotBoundedDeliveriesExample.java +++ b/jsprit-examples/src/main/java/jsprit/examples/SimpleEnRoutePickupAndDeliveryWithDepotBoundedDeliveriesExample.java @@ -1,23 +1,22 @@ /******************************************************************************* - * Copyright (C) 2013 Stefan Schroeder - * + * Copyright (C) 2014 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 + * 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.analysis.toolbox.Plotter; -import jsprit.analysis.toolbox.SolutionPrinter; import jsprit.core.algorithm.VehicleRoutingAlgorithm; import jsprit.core.algorithm.VehicleRoutingAlgorithmBuilder; import jsprit.core.algorithm.state.StateManager; @@ -28,11 +27,11 @@ import jsprit.core.problem.io.VrpXMLWriter; import jsprit.core.problem.job.Delivery; import jsprit.core.problem.job.Shipment; import jsprit.core.problem.solution.VehicleRoutingProblemSolution; -import jsprit.core.problem.vehicle.Vehicle; import jsprit.core.problem.vehicle.VehicleImpl; import jsprit.core.problem.vehicle.VehicleImpl.Builder; import jsprit.core.problem.vehicle.VehicleType; import jsprit.core.problem.vehicle.VehicleTypeImpl; +import jsprit.core.reporting.SolutionPrinter; import jsprit.core.util.Coordinate; import jsprit.core.util.Solutions; import jsprit.util.Examples; @@ -60,7 +59,7 @@ public class SimpleEnRoutePickupAndDeliveryWithDepotBoundedDeliveriesExample { Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle"); vehicleBuilder.setStartLocationCoordinate(Coordinate.newInstance(10, 10)); vehicleBuilder.setType(vehicleType); - Vehicle vehicle = vehicleBuilder.build(); + VehicleImpl vehicle = vehicleBuilder.build(); /* * build shipments at the required locations, each with a capacity-demand of 1. diff --git a/jsprit-examples/src/main/java/jsprit/examples/SimpleExample.java b/jsprit-examples/src/main/java/jsprit/examples/SimpleExample.java index 7a56b4f9..fbb99d67 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/SimpleExample.java +++ b/jsprit-examples/src/main/java/jsprit/examples/SimpleExample.java @@ -1,16 +1,16 @@ /******************************************************************************* - * Copyright (C) 2013 Stefan Schroeder - * + * Copyright (C) 2014 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 + * 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 . ******************************************************************************/ @@ -18,19 +18,17 @@ package jsprit.examples; import jsprit.analysis.toolbox.GraphStreamViewer; import jsprit.analysis.toolbox.GraphStreamViewer.Label; -import jsprit.analysis.toolbox.SolutionPrinter; -import jsprit.analysis.toolbox.SolutionPrinter.Print; import jsprit.core.algorithm.VehicleRoutingAlgorithm; import jsprit.core.algorithm.box.SchrimpfFactory; import jsprit.core.problem.VehicleRoutingProblem; import jsprit.core.problem.io.VrpXMLWriter; import jsprit.core.problem.job.Service; import jsprit.core.problem.solution.VehicleRoutingProblemSolution; -import jsprit.core.problem.vehicle.Vehicle; import jsprit.core.problem.vehicle.VehicleImpl; import jsprit.core.problem.vehicle.VehicleImpl.Builder; import jsprit.core.problem.vehicle.VehicleType; import jsprit.core.problem.vehicle.VehicleTypeImpl; +import jsprit.core.reporting.SolutionPrinter; import jsprit.core.util.Coordinate; import jsprit.core.util.Solutions; @@ -67,7 +65,7 @@ public class SimpleExample { Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle"); vehicleBuilder.setStartLocationCoordinate(Coordinate.newInstance(10, 10)); vehicleBuilder.setType(vehicleType); - Vehicle vehicle = vehicleBuilder.build(); + VehicleImpl vehicle = vehicleBuilder.build(); /* * build services at the required locations, each with a capacity-demand of 1. @@ -102,7 +100,7 @@ public class SimpleExample { new VrpXMLWriter(problem, solutions).write("output/problem-with-solution.xml"); - SolutionPrinter.print(problem,bestSolution,Print.VERBOSE); + SolutionPrinter.print(problem, bestSolution, SolutionPrinter.Print.VERBOSE); /* * plot diff --git a/jsprit-examples/src/main/java/jsprit/examples/SimpleExampleOpenRoutes.java b/jsprit-examples/src/main/java/jsprit/examples/SimpleExampleOpenRoutes.java index 3f64bc61..1a246308 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/SimpleExampleOpenRoutes.java +++ b/jsprit-examples/src/main/java/jsprit/examples/SimpleExampleOpenRoutes.java @@ -1,40 +1,39 @@ /******************************************************************************* - * Copyright (C) 2013 Stefan Schroeder - * + * Copyright (C) 2014 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 + * 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 java.util.Collection; - import jsprit.analysis.toolbox.Plotter; -import jsprit.analysis.toolbox.SolutionPrinter; import jsprit.core.algorithm.VehicleRoutingAlgorithm; import jsprit.core.algorithm.io.VehicleRoutingAlgorithms; import jsprit.core.problem.VehicleRoutingProblem; import jsprit.core.problem.io.VrpXMLWriter; import jsprit.core.problem.job.Service; import jsprit.core.problem.solution.VehicleRoutingProblemSolution; -import jsprit.core.problem.vehicle.Vehicle; import jsprit.core.problem.vehicle.VehicleImpl; import jsprit.core.problem.vehicle.VehicleImpl.Builder; import jsprit.core.problem.vehicle.VehicleType; import jsprit.core.problem.vehicle.VehicleTypeImpl; +import jsprit.core.reporting.SolutionPrinter; import jsprit.core.util.Coordinate; import jsprit.core.util.Solutions; import jsprit.util.Examples; +import java.util.Collection; + public class SimpleExampleOpenRoutes { @@ -59,7 +58,7 @@ public class SimpleExampleOpenRoutes { vehicleBuilder.setType(vehicleType); vehicleBuilder.setReturnToDepot(false); - Vehicle vehicle = vehicleBuilder.build(); + VehicleImpl vehicle = vehicleBuilder.build(); /* * build services at the required locations, each with a capacity-demand of 1. diff --git a/jsprit-examples/src/main/java/jsprit/examples/SimpleExampleWithSkills.java b/jsprit-examples/src/main/java/jsprit/examples/SimpleExampleWithSkills.java index ae69f519..a55655ba 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/SimpleExampleWithSkills.java +++ b/jsprit-examples/src/main/java/jsprit/examples/SimpleExampleWithSkills.java @@ -1,16 +1,16 @@ /******************************************************************************* - * Copyright (C) 2013 Stefan Schroeder - * + * Copyright (C) 2014 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 + * 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 . ******************************************************************************/ @@ -18,8 +18,6 @@ package jsprit.examples; import jsprit.analysis.toolbox.GraphStreamViewer; import jsprit.analysis.toolbox.GraphStreamViewer.Label; -import jsprit.analysis.toolbox.SolutionPrinter; -import jsprit.analysis.toolbox.SolutionPrinter.Print; import jsprit.core.algorithm.VehicleRoutingAlgorithm; import jsprit.core.algorithm.VehicleRoutingAlgorithmBuilder; import jsprit.core.algorithm.state.StateManager; @@ -32,6 +30,7 @@ import jsprit.core.problem.vehicle.VehicleImpl; import jsprit.core.problem.vehicle.VehicleImpl.Builder; import jsprit.core.problem.vehicle.VehicleType; import jsprit.core.problem.vehicle.VehicleTypeImpl; +import jsprit.core.reporting.SolutionPrinter; import jsprit.core.util.Coordinate; import jsprit.core.util.Solutions; @@ -123,7 +122,7 @@ public class SimpleExampleWithSkills { new VrpXMLWriter(problem, solutions).write("output/problem-with-solution.xml"); - SolutionPrinter.print(problem,bestSolution,Print.VERBOSE); + SolutionPrinter.print(problem, bestSolution, SolutionPrinter.Print.VERBOSE); /* * plot diff --git a/jsprit-examples/src/main/java/jsprit/examples/SimpleVRPWithBackhaulsExample.java b/jsprit-examples/src/main/java/jsprit/examples/SimpleVRPWithBackhaulsExample.java index fb6e642d..af770ed4 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/SimpleVRPWithBackhaulsExample.java +++ b/jsprit-examples/src/main/java/jsprit/examples/SimpleVRPWithBackhaulsExample.java @@ -1,16 +1,16 @@ /******************************************************************************* - * Copyright (C) 2013 Stefan Schroeder - * + * Copyright (C) 2014 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 + * 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 . ******************************************************************************/ @@ -18,7 +18,6 @@ package jsprit.examples; import jsprit.analysis.toolbox.Plotter; import jsprit.analysis.toolbox.Plotter.Label; -import jsprit.analysis.toolbox.SolutionPrinter; import jsprit.core.algorithm.VehicleRoutingAlgorithm; import jsprit.core.algorithm.VehicleRoutingAlgorithmBuilder; import jsprit.core.algorithm.state.StateManager; @@ -29,11 +28,11 @@ import jsprit.core.problem.io.VrpXMLWriter; import jsprit.core.problem.job.Delivery; import jsprit.core.problem.job.Pickup; import jsprit.core.problem.solution.VehicleRoutingProblemSolution; -import jsprit.core.problem.vehicle.Vehicle; import jsprit.core.problem.vehicle.VehicleImpl; import jsprit.core.problem.vehicle.VehicleImpl.Builder; import jsprit.core.problem.vehicle.VehicleType; import jsprit.core.problem.vehicle.VehicleTypeImpl; +import jsprit.core.reporting.SolutionPrinter; import jsprit.core.util.Coordinate; import jsprit.core.util.Solutions; import jsprit.util.Examples; @@ -61,7 +60,7 @@ public class SimpleVRPWithBackhaulsExample { Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle"); vehicleBuilder.setStartLocationCoordinate(Coordinate.newInstance(10, 10)); vehicleBuilder.setType(vehicleType); - Vehicle vehicle = vehicleBuilder.build(); + VehicleImpl vehicle = vehicleBuilder.build(); /* * build pickups and deliveries at the required locations, each with a capacity-demand of 1. diff --git a/jsprit-examples/src/main/java/jsprit/examples/SolomonExample.java b/jsprit-examples/src/main/java/jsprit/examples/SolomonExample.java index d77ec7d4..bac3308c 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/SolomonExample.java +++ b/jsprit-examples/src/main/java/jsprit/examples/SolomonExample.java @@ -1,16 +1,16 @@ /******************************************************************************* - * Copyright (C) 2013 Stefan Schroeder - * + * Copyright (C) 2014 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 + * 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 . ******************************************************************************/ @@ -19,13 +19,12 @@ package jsprit.examples; import jsprit.analysis.toolbox.GraphStreamViewer; import jsprit.analysis.toolbox.GraphStreamViewer.Label; 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.box.SchrimpfFactory; import jsprit.core.algorithm.selector.SelectBest; import jsprit.core.problem.VehicleRoutingProblem; import jsprit.core.problem.solution.VehicleRoutingProblemSolution; +import jsprit.core.reporting.SolutionPrinter; import jsprit.instance.reader.SolomonReader; import jsprit.util.Examples; @@ -83,7 +82,7 @@ public class SolomonExample { /* * print solution */ - SolutionPrinter.print(vrp,solution,Print.VERBOSE); + SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE); /* * Plot solution. diff --git a/jsprit-examples/src/main/java/jsprit/examples/SolomonExampleWithSpecifiedVehicleEndLocations.java b/jsprit-examples/src/main/java/jsprit/examples/SolomonExampleWithSpecifiedVehicleEndLocations.java index 9cb6b2c5..6371c9f3 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/SolomonExampleWithSpecifiedVehicleEndLocations.java +++ b/jsprit-examples/src/main/java/jsprit/examples/SolomonExampleWithSpecifiedVehicleEndLocations.java @@ -1,35 +1,35 @@ /******************************************************************************* - * Copyright (C) 2013 Stefan Schroeder - * + * Copyright (C) 2014 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 + * 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 java.io.File; -import java.util.Collection; - import jsprit.analysis.toolbox.AlgorithmSearchProgressChartListener; import jsprit.analysis.toolbox.GraphStreamViewer; import jsprit.analysis.toolbox.GraphStreamViewer.Label; import jsprit.analysis.toolbox.Plotter; -import jsprit.analysis.toolbox.SolutionPrinter; import jsprit.core.algorithm.VehicleRoutingAlgorithm; import jsprit.core.algorithm.io.VehicleRoutingAlgorithms; import jsprit.core.algorithm.selector.SelectBest; import jsprit.core.problem.VehicleRoutingProblem; import jsprit.core.problem.io.VrpXMLReader; import jsprit.core.problem.solution.VehicleRoutingProblemSolution; +import jsprit.core.reporting.SolutionPrinter; + +import java.io.File; +import java.util.Collection; public class SolomonExampleWithSpecifiedVehicleEndLocations { @@ -73,7 +73,7 @@ public class SolomonExampleWithSpecifiedVehicleEndLocations { */ // VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp); VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfig_fix.xml"); - vra.setNuOfIterations(20000); + vra.setMaxIterations(20000); // vra.setPrematureBreak(100); vra.getAlgorithmListeners().addListener(new AlgorithmSearchProgressChartListener("output/sol_progress.png")); /* diff --git a/jsprit-examples/src/main/java/jsprit/examples/SolomonExampleWithSpecifiedVehicleEndLocationsWithoutTWs.java b/jsprit-examples/src/main/java/jsprit/examples/SolomonExampleWithSpecifiedVehicleEndLocationsWithoutTWs.java index 71dadb1f..a5ed1922 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/SolomonExampleWithSpecifiedVehicleEndLocationsWithoutTWs.java +++ b/jsprit-examples/src/main/java/jsprit/examples/SolomonExampleWithSpecifiedVehicleEndLocationsWithoutTWs.java @@ -1,34 +1,34 @@ /******************************************************************************* - * Copyright (C) 2013 Stefan Schroeder - * + * Copyright (C) 2014 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 + * 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 java.io.File; -import java.util.Collection; - import jsprit.analysis.toolbox.GraphStreamViewer; import jsprit.analysis.toolbox.GraphStreamViewer.Label; import jsprit.analysis.toolbox.Plotter; -import jsprit.analysis.toolbox.SolutionPrinter; import jsprit.core.algorithm.VehicleRoutingAlgorithm; import jsprit.core.algorithm.io.VehicleRoutingAlgorithms; import jsprit.core.algorithm.selector.SelectBest; import jsprit.core.problem.VehicleRoutingProblem; import jsprit.core.problem.io.VrpXMLReader; import jsprit.core.problem.solution.VehicleRoutingProblemSolution; +import jsprit.core.reporting.SolutionPrinter; + +import java.io.File; +import java.util.Collection; public class SolomonExampleWithSpecifiedVehicleEndLocationsWithoutTWs { @@ -73,7 +73,7 @@ public class SolomonExampleWithSpecifiedVehicleEndLocationsWithoutTWs { */ // VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp); VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfigWithSchrimpfAcceptance.xml"); - vra.setNuOfIterations(20000); + vra.setMaxIterations(20000); // vra.setPrematureBreak(100); // vra.getAlgorithmListeners().addListener(new AlgorithmSearchProgressChartListener("output/sol_progress.png")); /* diff --git a/jsprit-examples/src/main/java/jsprit/examples/SolomonOpenExample.java b/jsprit-examples/src/main/java/jsprit/examples/SolomonOpenExample.java index 48228e7b..78304895 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/SolomonOpenExample.java +++ b/jsprit-examples/src/main/java/jsprit/examples/SolomonOpenExample.java @@ -1,37 +1,35 @@ /******************************************************************************* - * Copyright (C) 2013 Stefan Schroeder - * + * Copyright (C) 2014 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 + * 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 java.util.Collection; - import jsprit.analysis.toolbox.GraphStreamViewer; import jsprit.analysis.toolbox.GraphStreamViewer.Label; - import jsprit.analysis.toolbox.Plotter; - -import jsprit.analysis.toolbox.SolutionPrinter; import jsprit.core.algorithm.VehicleRoutingAlgorithm; import jsprit.core.algorithm.io.VehicleRoutingAlgorithms; import jsprit.core.algorithm.selector.SelectBest; import jsprit.core.problem.VehicleRoutingProblem; import jsprit.core.problem.io.VrpXMLReader; import jsprit.core.problem.solution.VehicleRoutingProblemSolution; +import jsprit.core.reporting.SolutionPrinter; import jsprit.util.Examples; +import java.util.Collection; + public class SolomonOpenExample { diff --git a/jsprit-examples/src/main/java/jsprit/examples/SolomonR101Example.java b/jsprit-examples/src/main/java/jsprit/examples/SolomonR101Example.java index 0be001d4..bebea55b 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/SolomonR101Example.java +++ b/jsprit-examples/src/main/java/jsprit/examples/SolomonR101Example.java @@ -1,33 +1,33 @@ /******************************************************************************* - * Copyright (C) 2013 Stefan Schroeder - * + * Copyright (C) 2014 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 + * 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 java.util.Collection; - import jsprit.analysis.toolbox.Plotter; -import jsprit.analysis.toolbox.SolutionPrinter; import jsprit.core.algorithm.VehicleRoutingAlgorithm; import jsprit.core.algorithm.io.VehicleRoutingAlgorithms; import jsprit.core.algorithm.selector.SelectBest; import jsprit.core.problem.VehicleRoutingProblem; import jsprit.core.problem.solution.VehicleRoutingProblemSolution; +import jsprit.core.reporting.SolutionPrinter; import jsprit.instance.reader.SolomonReader; import jsprit.util.Examples; +import java.util.Collection; + public class SolomonR101Example { diff --git a/jsprit-examples/src/main/java/jsprit/examples/SolomonWithSkillsExample.java b/jsprit-examples/src/main/java/jsprit/examples/SolomonWithSkillsExample.java index 476d4403..7cada476 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/SolomonWithSkillsExample.java +++ b/jsprit-examples/src/main/java/jsprit/examples/SolomonWithSkillsExample.java @@ -1,8 +1,24 @@ +/******************************************************************************* + * Copyright (C) 2014 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.analysis.toolbox.Plotter; -import jsprit.analysis.toolbox.SolutionPrinter; import jsprit.core.algorithm.VehicleRoutingAlgorithm; import jsprit.core.algorithm.VehicleRoutingAlgorithmBuilder; import jsprit.core.algorithm.state.StateManager; @@ -15,6 +31,7 @@ import jsprit.core.problem.solution.VehicleRoutingProblemSolution; import jsprit.core.problem.vehicle.Vehicle; import jsprit.core.problem.vehicle.VehicleImpl; import jsprit.core.problem.vehicle.VehicleType; +import jsprit.core.reporting.SolutionPrinter; import jsprit.core.util.Solutions; import jsprit.instance.reader.SolomonReader; @@ -60,7 +77,6 @@ public class SolomonWithSkillsExample { } skillProblemBuilder.addJob(skillServiceBuilder.build()); } - skillProblemBuilder.addPenaltyVehicles(3.,100.); skillProblemBuilder.setFleetSize(VehicleRoutingProblem.FleetSize.FINITE); VehicleRoutingProblem skillProblem = skillProblemBuilder.build(); diff --git a/jsprit-examples/src/main/java/jsprit/examples/TransportOfDisabledPeople.java b/jsprit-examples/src/main/java/jsprit/examples/TransportOfDisabledPeople.java index e36da1a0..7a4ec70a 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/TransportOfDisabledPeople.java +++ b/jsprit-examples/src/main/java/jsprit/examples/TransportOfDisabledPeople.java @@ -1,28 +1,24 @@ /******************************************************************************* - * Copyright (c) 2014 Stefan Schroeder. - * + * Copyright (C) 2014 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 + * 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 + * 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 . - * - * Contributors: - * Stefan Schroeder - initial API and implementation ******************************************************************************/ package jsprit.examples; import jsprit.analysis.toolbox.GraphStreamViewer; import jsprit.analysis.toolbox.GraphStreamViewer.Label; 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.VehicleRoutingAlgorithmBuilder; import jsprit.core.algorithm.state.StateManager; @@ -34,11 +30,11 @@ import jsprit.core.problem.constraint.HardRouteStateLevelConstraint; import jsprit.core.problem.job.Shipment; import jsprit.core.problem.misc.JobInsertionContext; import jsprit.core.problem.solution.VehicleRoutingProblemSolution; -import jsprit.core.problem.vehicle.Vehicle; import jsprit.core.problem.vehicle.VehicleImpl; import jsprit.core.problem.vehicle.VehicleImpl.Builder; import jsprit.core.problem.vehicle.VehicleType; import jsprit.core.problem.vehicle.VehicleTypeImpl; +import jsprit.core.reporting.SolutionPrinter; import jsprit.core.util.Coordinate; import jsprit.core.util.Solutions; import jsprit.util.Examples; @@ -80,22 +76,22 @@ public class TransportOfDisabledPeople { Builder vehicleBuilder1 = VehicleImpl.Builder.newInstance("wheelchair_bus"); vehicleBuilder1.setStartLocationCoordinate(Coordinate.newInstance(10, 10)); vehicleBuilder1.setType(vehicleType_wheelchair); - Vehicle vehicle1 = vehicleBuilder1.build(); + VehicleImpl vehicle1 = vehicleBuilder1.build(); Builder vehicleBuilder1_2 = VehicleImpl.Builder.newInstance("wheelchair_bus_2"); vehicleBuilder1_2.setStartLocationCoordinate(Coordinate.newInstance(10, 10)); vehicleBuilder1_2.setType(vehicleType_wheelchair); - Vehicle vehicle1_2 = vehicleBuilder1_2.build(); + VehicleImpl vehicle1_2 = vehicleBuilder1_2.build(); Builder vehicleBuilder2 = VehicleImpl.Builder.newInstance("passenger_bus"); vehicleBuilder2.setStartLocationCoordinate(Coordinate.newInstance(30, 30)).setEndLocationCoordinate(Coordinate.newInstance(30, 19)); vehicleBuilder2.setType(vehicleType_solelypassenger); - Vehicle vehicle2 = vehicleBuilder2.build(); + VehicleImpl vehicle2 = vehicleBuilder2.build(); Builder vehicleBuilder2_2 = VehicleImpl.Builder.newInstance("passenger_bus_2"); vehicleBuilder2_2.setStartLocationCoordinate(Coordinate.newInstance(30, 30)).setEndLocationCoordinate(Coordinate.newInstance(30, 19)); vehicleBuilder2_2.setType(vehicleType_solelypassenger); - Vehicle vehicle2_2 = vehicleBuilder2_2.build(); + VehicleImpl vehicle2_2 = vehicleBuilder2_2.build(); /* @@ -206,7 +202,7 @@ public class TransportOfDisabledPeople { /* * print nRoutes and totalCosts of bestSolution */ - SolutionPrinter.print(problem,bestSolution,Print.VERBOSE); + SolutionPrinter.print(problem, bestSolution, SolutionPrinter.Print.VERBOSE); /* * plot problem without solution diff --git a/jsprit-examples/src/main/java/jsprit/examples/VRPWithBackhaulsExample.java b/jsprit-examples/src/main/java/jsprit/examples/VRPWithBackhaulsExample.java index 0b0706d9..3f48d176 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/VRPWithBackhaulsExample.java +++ b/jsprit-examples/src/main/java/jsprit/examples/VRPWithBackhaulsExample.java @@ -1,16 +1,16 @@ /******************************************************************************* - * Copyright (C) 2013 Stefan Schroeder - * + * Copyright (C) 2014 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 + * 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 . ******************************************************************************/ @@ -18,8 +18,6 @@ package jsprit.examples; import jsprit.analysis.toolbox.AlgorithmSearchProgressChartListener; import jsprit.analysis.toolbox.GraphStreamViewer; -import jsprit.analysis.toolbox.SolutionPrinter; -import jsprit.analysis.toolbox.SolutionPrinter.Print; import jsprit.core.algorithm.VehicleRoutingAlgorithm; import jsprit.core.algorithm.VehicleRoutingAlgorithmBuilder; import jsprit.core.algorithm.selector.SelectBest; @@ -29,6 +27,7 @@ import jsprit.core.problem.constraint.ConstraintManager; import jsprit.core.problem.constraint.ServiceDeliveriesFirstConstraint; import jsprit.core.problem.io.VrpXMLReader; import jsprit.core.problem.solution.VehicleRoutingProblemSolution; +import jsprit.core.reporting.SolutionPrinter; import jsprit.util.Examples; import java.util.Collection; @@ -92,7 +91,7 @@ public class VRPWithBackhaulsExample { /* * print solution */ - SolutionPrinter.print(vrp,solution,Print.VERBOSE); + SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE); /* * Plot solution. diff --git a/jsprit-examples/src/main/java/jsprit/examples/VRPWithBackhaulsExample2.java b/jsprit-examples/src/main/java/jsprit/examples/VRPWithBackhaulsExample2.java index b45e2534..b8872dae 100644 --- a/jsprit-examples/src/main/java/jsprit/examples/VRPWithBackhaulsExample2.java +++ b/jsprit-examples/src/main/java/jsprit/examples/VRPWithBackhaulsExample2.java @@ -1,16 +1,16 @@ /******************************************************************************* - * Copyright (C) 2013 Stefan Schroeder - * + * Copyright (C) 2014 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 + * 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 . ******************************************************************************/ @@ -18,7 +18,6 @@ package jsprit.examples; import jsprit.analysis.toolbox.Plotter; import jsprit.analysis.toolbox.Plotter.Label; -import jsprit.analysis.toolbox.SolutionPrinter; import jsprit.core.algorithm.VehicleRoutingAlgorithm; import jsprit.core.algorithm.VehicleRoutingAlgorithmBuilder; import jsprit.core.algorithm.selector.SelectBest; @@ -28,6 +27,7 @@ import jsprit.core.problem.constraint.ConstraintManager; import jsprit.core.problem.constraint.ServiceDeliveriesFirstConstraint; import jsprit.core.problem.io.VrpXMLReader; import jsprit.core.problem.solution.VehicleRoutingProblemSolution; +import jsprit.core.reporting.SolutionPrinter; import jsprit.util.Examples; import java.util.Collection;