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

adapt examples to head of development

This commit is contained in:
oblonski 2014-08-26 21:38:32 +02:00
parent 264dafd06a
commit 759359b702
40 changed files with 413 additions and 445 deletions

View file

@ -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 <http://www.gnu.org/licenses/>.
*
* 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<VehicleRoutingProblemSolution> 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);