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:
parent
264dafd06a
commit
759359b702
40 changed files with 413 additions and 445 deletions
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* 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/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
@ -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));
|
System.out.format(leftAlgin, routeNu, getVehicleString(route), route.getEnd().getName(), "-", Math.round(route.getEnd().getArrTime()), "undef", Math.round(costs));
|
||||||
routeNu++;
|
routeNu++;
|
||||||
}
|
}
|
||||||
System.out.format("+*:=PenaltyVehicle+%n");
|
|
||||||
System.out.format("+--------------------------------------------------------------------------------------------------------------------------------+%n");
|
System.out.format("+--------------------------------------------------------------------------------------------------------------------------------+%n");
|
||||||
System.out.format("+----------------+%n");
|
if(!solution.getUnassignedJobs().isEmpty()) {
|
||||||
System.out.format("| unassignedJobs |%n");
|
System.out.format("+----------------+%n");
|
||||||
System.out.format("+----------------+%n");
|
System.out.format("| unassignedJobs |%n");
|
||||||
String unassignedJobAlgin = "| %-14s |%n";
|
System.out.format("+----------------+%n");
|
||||||
for(Job j : solution.getUnassignedJobs()){
|
String unassignedJobAlgin = "| %-14s |%n";
|
||||||
System.out.format(unassignedJobAlgin,j.getId());
|
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) {
|
private static String getVehicleString(VehicleRoute route) {
|
||||||
|
|
|
||||||
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* 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.
|
* 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
|
*
|
||||||
|
* 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/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Stefan Schroeder - initial API and implementation
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package jsprit.examples;
|
package jsprit.examples;
|
||||||
|
|
||||||
import jsprit.analysis.toolbox.GraphStreamViewer;
|
import jsprit.analysis.toolbox.GraphStreamViewer;
|
||||||
import jsprit.analysis.toolbox.GraphStreamViewer.Label;
|
import jsprit.analysis.toolbox.GraphStreamViewer.Label;
|
||||||
import jsprit.analysis.toolbox.Plotter;
|
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.VehicleRoutingAlgorithm;
|
||||||
import jsprit.core.algorithm.VehicleRoutingAlgorithmBuilder;
|
import jsprit.core.algorithm.VehicleRoutingAlgorithmBuilder;
|
||||||
import jsprit.core.algorithm.state.StateId;
|
import jsprit.core.algorithm.state.StateId;
|
||||||
import jsprit.core.algorithm.state.StateManager;
|
import jsprit.core.algorithm.state.StateManager;
|
||||||
import jsprit.core.algorithm.state.StateUpdater;
|
import jsprit.core.algorithm.state.StateUpdater;
|
||||||
import jsprit.core.algorithm.termination.VariationCoefficientTermination;
|
|
||||||
import jsprit.core.problem.VehicleRoutingProblem;
|
import jsprit.core.problem.VehicleRoutingProblem;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem.Builder;
|
import jsprit.core.problem.VehicleRoutingProblem.Builder;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem.FleetSize;
|
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.activity.TourActivity.JobActivity;
|
||||||
import jsprit.core.problem.solution.route.state.RouteAndActivityStateGetter;
|
import jsprit.core.problem.solution.route.state.RouteAndActivityStateGetter;
|
||||||
import jsprit.core.problem.vehicle.*;
|
import jsprit.core.problem.vehicle.*;
|
||||||
|
import jsprit.core.reporting.SolutionPrinter;
|
||||||
import jsprit.core.util.Coordinate;
|
import jsprit.core.util.Coordinate;
|
||||||
import jsprit.core.util.CrowFlyCosts;
|
import jsprit.core.util.CrowFlyCosts;
|
||||||
import jsprit.core.util.Solutions;
|
import jsprit.core.util.Solutions;
|
||||||
|
|
@ -274,7 +270,7 @@ public class BicycleMessenger {
|
||||||
vraBuilder.setStateAndConstraintManager(stateManager, constraintManager);
|
vraBuilder.setStateAndConstraintManager(stateManager, constraintManager);
|
||||||
VehicleRoutingAlgorithm algorithm = vraBuilder.build();
|
VehicleRoutingAlgorithm algorithm = vraBuilder.build();
|
||||||
algorithm.setMaxIterations(5000);
|
algorithm.setMaxIterations(5000);
|
||||||
VariationCoefficientTermination prematureAlgorithmTermination = new VariationCoefficientTermination(200, 0.001);
|
// VariationCoefficientTermination prematureAlgorithmTermination = new VariationCoefficientTermination(200, 0.001);
|
||||||
// algorithm.setPrematureAlgorithmTermination(prematureAlgorithmTermination);
|
// algorithm.setPrematureAlgorithmTermination(prematureAlgorithmTermination);
|
||||||
// algorithm.addListener(prematureAlgorithmTermination);
|
// algorithm.addListener(prematureAlgorithmTermination);
|
||||||
// algorithm.addListener(new AlgorithmSearchProgressChartListener("output/progress.png"));
|
// 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
|
//this is just to ensure that solution meet the above constraints
|
||||||
validateSolution(Solutions.bestOf(solutions), bicycleMessengerProblem, nearestMessengers);
|
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
|
//you may want to plot the problem
|
||||||
Plotter plotter = new Plotter(bicycleMessengerProblem);
|
Plotter plotter = new Plotter(bicycleMessengerProblem);
|
||||||
|
|
@ -316,12 +312,12 @@ public class BicycleMessenger {
|
||||||
for(VehicleRoute route : bestOf.getRoutes()){
|
for(VehicleRoute route : bestOf.getRoutes()){
|
||||||
for(TourActivity act : route.getActivities()){
|
for(TourActivity act : route.getActivities()){
|
||||||
if(act.getArrTime() > 3*nearestMessengers.get(((JobActivity)act).getJob().getId())){
|
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()));
|
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){
|
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");
|
throw new IllegalStateException("penaltyVehicle in solution. if there is a valid solution, this should not be");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* 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.
|
* 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
|
*
|
||||||
|
* 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/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Stefan Schroeder - initial API and implementation
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package jsprit.examples;
|
package jsprit.examples;
|
||||||
|
|
||||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
|
||||||
import jsprit.core.algorithm.*;
|
import jsprit.core.algorithm.*;
|
||||||
import jsprit.core.algorithm.acceptor.GreedyAcceptance;
|
import jsprit.core.algorithm.acceptor.GreedyAcceptance;
|
||||||
import jsprit.core.algorithm.module.RuinAndRecreateModule;
|
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.solution.VehicleRoutingProblemSolution;
|
||||||
import jsprit.core.problem.vehicle.InfiniteFleetManagerFactory;
|
import jsprit.core.problem.vehicle.InfiniteFleetManagerFactory;
|
||||||
import jsprit.core.problem.vehicle.VehicleFleetManager;
|
import jsprit.core.problem.vehicle.VehicleFleetManager;
|
||||||
|
import jsprit.core.reporting.SolutionPrinter;
|
||||||
import jsprit.core.util.Solutions;
|
import jsprit.core.util.Solutions;
|
||||||
import jsprit.instance.reader.SolomonReader;
|
import jsprit.instance.reader.SolomonReader;
|
||||||
import jsprit.util.Examples;
|
import jsprit.util.Examples;
|
||||||
|
|
@ -46,9 +45,7 @@ import java.util.Collection;
|
||||||
|
|
||||||
public class BuildAlgorithmFromScratch {
|
public class BuildAlgorithmFromScratch {
|
||||||
|
|
||||||
/**
|
|
||||||
* @param args
|
|
||||||
*/
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
/*
|
/*
|
||||||
* some preparation - create output folder
|
* some preparation - create output folder
|
||||||
|
|
@ -199,7 +196,7 @@ public class BuildAlgorithmFromScratch {
|
||||||
/*
|
/*
|
||||||
* define the nIterations (by default nIteration=100)
|
* 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)
|
* optionally define a premature termination criterion (by default: not criterion is set)
|
||||||
|
|
|
||||||
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* 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.
|
* 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
|
*
|
||||||
|
* 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/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Stefan Schroeder - initial API and implementation
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package jsprit.examples;
|
package jsprit.examples;
|
||||||
|
|
||||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
|
||||||
import jsprit.core.algorithm.*;
|
import jsprit.core.algorithm.*;
|
||||||
import jsprit.core.algorithm.acceptor.GreedyAcceptance;
|
import jsprit.core.algorithm.acceptor.GreedyAcceptance;
|
||||||
import jsprit.core.algorithm.module.RuinAndRecreateModule;
|
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.solution.VehicleRoutingProblemSolution;
|
||||||
import jsprit.core.problem.vehicle.InfiniteFleetManagerFactory;
|
import jsprit.core.problem.vehicle.InfiniteFleetManagerFactory;
|
||||||
import jsprit.core.problem.vehicle.VehicleFleetManager;
|
import jsprit.core.problem.vehicle.VehicleFleetManager;
|
||||||
|
import jsprit.core.reporting.SolutionPrinter;
|
||||||
import jsprit.core.util.Solutions;
|
import jsprit.core.util.Solutions;
|
||||||
import jsprit.instance.reader.SolomonReader;
|
import jsprit.instance.reader.SolomonReader;
|
||||||
import jsprit.util.Examples;
|
import jsprit.util.Examples;
|
||||||
|
|
@ -46,9 +44,6 @@ import java.util.Collection;
|
||||||
|
|
||||||
public class BuildAlgorithmFromScratchWithHardAndSoftConstraints {
|
public class BuildAlgorithmFromScratchWithHardAndSoftConstraints {
|
||||||
|
|
||||||
/**
|
|
||||||
* @param args
|
|
||||||
*/
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
/*
|
/*
|
||||||
* some preparation - create output folder
|
* some preparation - create output folder
|
||||||
|
|
@ -200,7 +195,7 @@ public class BuildAlgorithmFromScratchWithHardAndSoftConstraints {
|
||||||
/*
|
/*
|
||||||
* define the nIterations (by default nIteration=100)
|
* 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)
|
* optionally define a premature termination criterion (by default: not criterion is set)
|
||||||
|
|
|
||||||
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* 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/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
@ -30,9 +30,7 @@ import jsprit.util.Examples;
|
||||||
|
|
||||||
public class CompareAlgorithmExample {
|
public class CompareAlgorithmExample {
|
||||||
|
|
||||||
/**
|
|
||||||
* @param args
|
|
||||||
*/
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
/*
|
/*
|
||||||
* some preparation - create output folder
|
* some preparation - create output folder
|
||||||
|
|
|
||||||
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* 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/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package jsprit.examples;
|
package jsprit.examples;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import org.apache.commons.configuration.XMLConfiguration;
|
|
||||||
|
|
||||||
import jsprit.analysis.toolbox.ComputationalLaboratory;
|
import jsprit.analysis.toolbox.ComputationalLaboratory;
|
||||||
import jsprit.analysis.toolbox.ComputationalLaboratory.CalculationListener;
|
import jsprit.analysis.toolbox.ComputationalLaboratory.CalculationListener;
|
||||||
import jsprit.analysis.toolbox.ComputationalLaboratory.DataCollector;
|
import jsprit.analysis.toolbox.ComputationalLaboratory.DataCollector;
|
||||||
|
|
@ -38,6 +34,9 @@ import jsprit.core.util.BenchmarkInstance;
|
||||||
import jsprit.core.util.Solutions;
|
import jsprit.core.util.Solutions;
|
||||||
import jsprit.instance.reader.SolomonReader;
|
import jsprit.instance.reader.SolomonReader;
|
||||||
import jsprit.util.Examples;
|
import jsprit.util.Examples;
|
||||||
|
import org.apache.commons.configuration.XMLConfiguration;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Based on Solomon's R101 instance
|
* Based on Solomon's R101 instance
|
||||||
|
|
@ -92,8 +91,7 @@ public class ComputationalExperiments_alphaSenstivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VehicleRoutingAlgorithm createAlgorithm(VehicleRoutingProblem vrp) {
|
public VehicleRoutingAlgorithm createAlgorithm(VehicleRoutingProblem vrp) {
|
||||||
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.createAlgorithm(vrp, getAlgorithmConfig(alpha));
|
return VehicleRoutingAlgorithms.createAlgorithm(vrp, getAlgorithmConfig(alpha));
|
||||||
return vra;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* 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/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package jsprit.examples;
|
package jsprit.examples;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import jsprit.analysis.toolbox.ComputationalLaboratory;
|
import jsprit.analysis.toolbox.ComputationalLaboratory;
|
||||||
import jsprit.analysis.toolbox.ComputationalLaboratory.CalculationListener;
|
import jsprit.analysis.toolbox.ComputationalLaboratory.CalculationListener;
|
||||||
import jsprit.analysis.toolbox.XYLineChartBuilder;
|
import jsprit.analysis.toolbox.XYLineChartBuilder;
|
||||||
|
|
@ -32,6 +30,8 @@ import jsprit.core.util.Solutions;
|
||||||
import jsprit.instance.reader.SolomonReader;
|
import jsprit.instance.reader.SolomonReader;
|
||||||
import jsprit.util.Examples;
|
import jsprit.util.Examples;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Based on Solomon's R101 instance
|
* Based on Solomon's R101 instance
|
||||||
*
|
*
|
||||||
|
|
@ -83,7 +83,7 @@ public class ComputationalExperiments_randomVariations {
|
||||||
@Override
|
@Override
|
||||||
public VehicleRoutingAlgorithm createAlgorithm(VehicleRoutingProblem vrp) {
|
public VehicleRoutingAlgorithm createAlgorithm(VehicleRoutingProblem vrp) {
|
||||||
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfigWithSchrimpfAcceptance.xml");
|
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfigWithSchrimpfAcceptance.xml");
|
||||||
vra.setNuOfIterations(4000);
|
vra.setMaxIterations(4000);
|
||||||
return vra;
|
return vra;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* 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/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package jsprit.examples;
|
package jsprit.examples;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import jsprit.analysis.toolbox.ComputationalLaboratory;
|
import jsprit.analysis.toolbox.ComputationalLaboratory;
|
||||||
import jsprit.analysis.toolbox.ComputationalLaboratory.CalculationListener;
|
import jsprit.analysis.toolbox.ComputationalLaboratory.CalculationListener;
|
||||||
import jsprit.analysis.toolbox.ComputationalLaboratory.DataCollector;
|
import jsprit.analysis.toolbox.ComputationalLaboratory.DataCollector;
|
||||||
|
|
@ -32,6 +30,8 @@ import jsprit.core.util.Solutions;
|
||||||
import jsprit.instance.reader.SolomonReader;
|
import jsprit.instance.reader.SolomonReader;
|
||||||
import jsprit.util.Examples;
|
import jsprit.util.Examples;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Based on Solomon's R101 instance
|
* Based on Solomon's R101 instance
|
||||||
*
|
*
|
||||||
|
|
@ -164,7 +164,7 @@ public class ComputationalExperiments_randomVariations_and_nuOfIterations {
|
||||||
@Override
|
@Override
|
||||||
public VehicleRoutingAlgorithm createAlgorithm(VehicleRoutingProblem vrp) {
|
public VehicleRoutingAlgorithm createAlgorithm(VehicleRoutingProblem vrp) {
|
||||||
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfigWithSchrimpfAcceptance.xml");
|
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfigWithSchrimpfAcceptance.xml");
|
||||||
vra.setNuOfIterations(iterations);
|
vra.setMaxIterations(iterations);
|
||||||
return vra;
|
return vra;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* 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/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package jsprit.examples;
|
package jsprit.examples;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import jsprit.analysis.toolbox.ComputationalLaboratory;
|
import jsprit.analysis.toolbox.ComputationalLaboratory;
|
||||||
import jsprit.analysis.toolbox.ComputationalLaboratory.CalculationListener;
|
import jsprit.analysis.toolbox.ComputationalLaboratory.CalculationListener;
|
||||||
import jsprit.analysis.toolbox.XYLineChartBuilder;
|
import jsprit.analysis.toolbox.XYLineChartBuilder;
|
||||||
|
|
@ -32,6 +30,8 @@ import jsprit.core.util.Solutions;
|
||||||
import jsprit.instance.reader.SolomonReader;
|
import jsprit.instance.reader.SolomonReader;
|
||||||
import jsprit.util.Examples;
|
import jsprit.util.Examples;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Based on Solomon's R101 instance
|
* Based on Solomon's R101 instance
|
||||||
*
|
*
|
||||||
|
|
@ -86,7 +86,7 @@ public class ComputationalExperiments_schrimpf_vs_greedy {
|
||||||
@Override
|
@Override
|
||||||
public VehicleRoutingAlgorithm createAlgorithm(VehicleRoutingProblem vrp) {
|
public VehicleRoutingAlgorithm createAlgorithm(VehicleRoutingProblem vrp) {
|
||||||
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfigWithSchrimpfAcceptance.xml");
|
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfigWithSchrimpfAcceptance.xml");
|
||||||
vra.setNuOfIterations(4000);
|
vra.setMaxIterations(4000);
|
||||||
return vra;
|
return vra;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -95,7 +95,7 @@ public class ComputationalExperiments_schrimpf_vs_greedy {
|
||||||
@Override
|
@Override
|
||||||
public VehicleRoutingAlgorithm createAlgorithm(VehicleRoutingProblem vrp) {
|
public VehicleRoutingAlgorithm createAlgorithm(VehicleRoutingProblem vrp) {
|
||||||
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfig_solomon.xml");
|
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfig_solomon.xml");
|
||||||
vra.setNuOfIterations(4000);
|
vra.setMaxIterations(4000);
|
||||||
return vra;
|
return vra;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* 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/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package jsprit.examples;
|
package jsprit.examples;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import jsprit.analysis.toolbox.Plotter;
|
import jsprit.analysis.toolbox.Plotter;
|
||||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
|
||||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||||
import jsprit.core.algorithm.io.AlgorithmConfig;
|
import jsprit.core.algorithm.io.AlgorithmConfig;
|
||||||
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
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.io.VrpXMLWriter;
|
||||||
import jsprit.core.problem.job.Service;
|
import jsprit.core.problem.job.Service;
|
||||||
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||||
import jsprit.core.problem.vehicle.Vehicle;
|
|
||||||
import jsprit.core.problem.vehicle.VehicleImpl;
|
import jsprit.core.problem.vehicle.VehicleImpl;
|
||||||
import jsprit.core.problem.vehicle.VehicleImpl.Builder;
|
import jsprit.core.problem.vehicle.VehicleImpl.Builder;
|
||||||
import jsprit.core.problem.vehicle.VehicleType;
|
import jsprit.core.problem.vehicle.VehicleType;
|
||||||
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
||||||
|
import jsprit.core.reporting.SolutionPrinter;
|
||||||
import jsprit.core.util.Coordinate;
|
import jsprit.core.util.Coordinate;
|
||||||
import jsprit.core.util.Solutions;
|
import jsprit.core.util.Solutions;
|
||||||
import jsprit.util.Examples;
|
import jsprit.util.Examples;
|
||||||
|
|
||||||
import org.apache.commons.configuration.XMLConfiguration;
|
import org.apache.commons.configuration.XMLConfiguration;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
|
||||||
public class ConfigureAlgorithmInCodeInsteadOfPerXml {
|
public class ConfigureAlgorithmInCodeInsteadOfPerXml {
|
||||||
|
|
||||||
|
|
@ -59,7 +57,7 @@ public class ConfigureAlgorithmInCodeInsteadOfPerXml {
|
||||||
Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
|
Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
|
||||||
vehicleBuilder.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
|
vehicleBuilder.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
|
||||||
vehicleBuilder.setType(vehicleType);
|
vehicleBuilder.setType(vehicleType);
|
||||||
Vehicle vehicle = vehicleBuilder.build();
|
VehicleImpl vehicle = vehicleBuilder.build();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* build services at the required locations, each with a capacity-demand of 1.
|
* build services at the required locations, each with a capacity-demand of 1.
|
||||||
|
|
|
||||||
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* 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/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package jsprit.examples;
|
package jsprit.examples;
|
||||||
|
|
||||||
import jsprit.analysis.toolbox.Plotter;
|
import jsprit.analysis.toolbox.Plotter;
|
||||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
|
||||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||||
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem;
|
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.VehicleImpl;
|
||||||
import jsprit.core.problem.vehicle.VehicleType;
|
import jsprit.core.problem.vehicle.VehicleType;
|
||||||
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
||||||
|
import jsprit.core.reporting.SolutionPrinter;
|
||||||
import jsprit.core.util.Solutions;
|
import jsprit.core.util.Solutions;
|
||||||
import jsprit.core.util.VehicleRoutingTransportCostsMatrix;
|
import jsprit.core.util.VehicleRoutingTransportCostsMatrix;
|
||||||
import jsprit.util.Examples;
|
import jsprit.util.Examples;
|
||||||
|
|
|
||||||
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* 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/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package jsprit.examples;
|
package jsprit.examples;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import jsprit.analysis.toolbox.GraphStreamViewer;
|
import jsprit.analysis.toolbox.GraphStreamViewer;
|
||||||
import jsprit.analysis.toolbox.GraphStreamViewer.Label;
|
import jsprit.analysis.toolbox.GraphStreamViewer.Label;
|
||||||
import jsprit.analysis.toolbox.Plotter;
|
import jsprit.analysis.toolbox.Plotter;
|
||||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
|
||||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||||
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem;
|
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.io.VrpXMLWriter;
|
||||||
import jsprit.core.problem.job.Shipment;
|
import jsprit.core.problem.job.Shipment;
|
||||||
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||||
import jsprit.core.problem.vehicle.Vehicle;
|
|
||||||
import jsprit.core.problem.vehicle.VehicleImpl;
|
import jsprit.core.problem.vehicle.VehicleImpl;
|
||||||
import jsprit.core.problem.vehicle.VehicleImpl.Builder;
|
import jsprit.core.problem.vehicle.VehicleImpl.Builder;
|
||||||
import jsprit.core.problem.vehicle.VehicleType;
|
import jsprit.core.problem.vehicle.VehicleType;
|
||||||
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
||||||
|
import jsprit.core.reporting.SolutionPrinter;
|
||||||
import jsprit.core.util.Coordinate;
|
import jsprit.core.util.Coordinate;
|
||||||
import jsprit.core.util.Solutions;
|
import jsprit.core.util.Solutions;
|
||||||
import jsprit.util.Examples;
|
import jsprit.util.Examples;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
|
||||||
public class EnRoutePickupAndDeliveryWithMultipleDepotsAndOpenRoutesExample {
|
public class EnRoutePickupAndDeliveryWithMultipleDepotsAndOpenRoutesExample {
|
||||||
|
|
||||||
|
|
@ -63,22 +62,22 @@ public class EnRoutePickupAndDeliveryWithMultipleDepotsAndOpenRoutesExample {
|
||||||
Builder vehicleBuilder1 = VehicleImpl.Builder.newInstance("vehicles@[10,10]");
|
Builder vehicleBuilder1 = VehicleImpl.Builder.newInstance("vehicles@[10,10]");
|
||||||
vehicleBuilder1.setStartLocationCoordinate(Coordinate.newInstance(10, 10)).setReturnToDepot(false);
|
vehicleBuilder1.setStartLocationCoordinate(Coordinate.newInstance(10, 10)).setReturnToDepot(false);
|
||||||
vehicleBuilder1.setType(vehicleType);
|
vehicleBuilder1.setType(vehicleType);
|
||||||
Vehicle vehicle1 = vehicleBuilder1.build();
|
VehicleImpl vehicle1 = vehicleBuilder1.build();
|
||||||
|
|
||||||
Builder vehicleBuilder2 = VehicleImpl.Builder.newInstance("vehicles@[30,30]");
|
Builder vehicleBuilder2 = VehicleImpl.Builder.newInstance("vehicles@[30,30]");
|
||||||
vehicleBuilder2.setStartLocationCoordinate(Coordinate.newInstance(30, 30)).setReturnToDepot(false);
|
vehicleBuilder2.setStartLocationCoordinate(Coordinate.newInstance(30, 30)).setReturnToDepot(false);
|
||||||
vehicleBuilder2.setType(vehicleType);
|
vehicleBuilder2.setType(vehicleType);
|
||||||
Vehicle vehicle2 = vehicleBuilder2.build();
|
VehicleImpl vehicle2 = vehicleBuilder2.build();
|
||||||
|
|
||||||
Builder vehicleBuilder3 = VehicleImpl.Builder.newInstance("vehicles@[10,30]");
|
Builder vehicleBuilder3 = VehicleImpl.Builder.newInstance("vehicles@[10,30]");
|
||||||
vehicleBuilder3.setStartLocationCoordinate(Coordinate.newInstance(10, 30));
|
vehicleBuilder3.setStartLocationCoordinate(Coordinate.newInstance(10, 30));
|
||||||
vehicleBuilder3.setType(vehicleType);
|
vehicleBuilder3.setType(vehicleType);
|
||||||
Vehicle vehicle3 = vehicleBuilder3.build();
|
VehicleImpl vehicle3 = vehicleBuilder3.build();
|
||||||
|
|
||||||
Builder vehicleBuilder4 = VehicleImpl.Builder.newInstance("vehicles@[30,10]");
|
Builder vehicleBuilder4 = VehicleImpl.Builder.newInstance("vehicles@[30,10]");
|
||||||
vehicleBuilder4.setStartLocationCoordinate(Coordinate.newInstance(30, 10));
|
vehicleBuilder4.setStartLocationCoordinate(Coordinate.newInstance(30, 10));
|
||||||
vehicleBuilder4.setType(vehicleType);
|
vehicleBuilder4.setType(vehicleType);
|
||||||
Vehicle vehicle4 = vehicleBuilder4.build();
|
VehicleImpl vehicle4 = vehicleBuilder4.build();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* build shipments at the required locations, each with a capacity-demand of 1.
|
* build shipments at the required locations, each with a capacity-demand of 1.
|
||||||
|
|
|
||||||
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* 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/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
@ -18,7 +18,6 @@ package jsprit.examples;
|
||||||
|
|
||||||
import jsprit.analysis.toolbox.GraphStreamViewer;
|
import jsprit.analysis.toolbox.GraphStreamViewer;
|
||||||
import jsprit.analysis.toolbox.GraphStreamViewer.Label;
|
import jsprit.analysis.toolbox.GraphStreamViewer.Label;
|
||||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
|
||||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||||
import jsprit.core.algorithm.VehicleRoutingAlgorithmBuilder;
|
import jsprit.core.algorithm.VehicleRoutingAlgorithmBuilder;
|
||||||
import jsprit.core.algorithm.state.StateManager;
|
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.VehicleImpl.Builder;
|
||||||
import jsprit.core.problem.vehicle.VehicleType;
|
import jsprit.core.problem.vehicle.VehicleType;
|
||||||
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
||||||
|
import jsprit.core.reporting.SolutionPrinter;
|
||||||
import jsprit.core.util.Coordinate;
|
import jsprit.core.util.Coordinate;
|
||||||
import jsprit.core.util.Solutions;
|
import jsprit.core.util.Solutions;
|
||||||
import jsprit.util.Examples;
|
import jsprit.util.Examples;
|
||||||
|
|
|
||||||
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* 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.
|
* 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
|
*
|
||||||
|
* 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/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Stefan Schroeder - initial API and implementation
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package jsprit.examples;
|
package jsprit.examples;
|
||||||
|
|
||||||
import jsprit.analysis.toolbox.AlgorithmSearchProgressChartListener;
|
import jsprit.analysis.toolbox.AlgorithmSearchProgressChartListener;
|
||||||
import jsprit.analysis.toolbox.GraphStreamViewer;
|
import jsprit.analysis.toolbox.GraphStreamViewer;
|
||||||
import jsprit.analysis.toolbox.Plotter;
|
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.VehicleRoutingAlgorithm;
|
||||||
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem;
|
import jsprit.core.problem.VehicleRoutingProblem;
|
||||||
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||||
|
import jsprit.core.reporting.SolutionPrinter;
|
||||||
import jsprit.core.util.Solutions;
|
import jsprit.core.util.Solutions;
|
||||||
import jsprit.instance.reader.VrphGoldenReader;
|
import jsprit.instance.reader.VrphGoldenReader;
|
||||||
import jsprit.instance.reader.VrphGoldenReader.VrphType;
|
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
|
//results might even be a bit better, but it is slower, since it checks insertion on routeLevel
|
||||||
//rather than on local level
|
//rather than on local level
|
||||||
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfig_considerFixedCosts.xml");
|
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfig_considerFixedCosts.xml");
|
||||||
vra.setNuOfIterations(10000);
|
vra.setMaxIterations(10000);
|
||||||
// vra.setPrematureAlgorithmTermination(new IterationWithoutImprovementTermination(500));
|
// vra.setPrematureAlgorithmTermination(new IterationWithoutImprovementTermination(500));
|
||||||
vra.addListener(new AlgorithmSearchProgressChartListener("output/progress.png"));
|
vra.addListener(new AlgorithmSearchProgressChartListener("output/progress.png"));
|
||||||
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
||||||
|
|
||||||
VehicleRoutingProblemSolution best = Solutions.bestOf(solutions);
|
VehicleRoutingProblemSolution best = Solutions.bestOf(solutions);
|
||||||
|
|
||||||
SolutionPrinter.print(vrp, best, Print.VERBOSE);
|
SolutionPrinter.print(vrp, best, SolutionPrinter.Print.VERBOSE);
|
||||||
|
|
||||||
|
|
||||||
Plotter plotter = new Plotter(vrp,best);
|
Plotter plotter = new Plotter(vrp,best);
|
||||||
|
|
|
||||||
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* 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.
|
* 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
|
*
|
||||||
|
* 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/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Stefan Schroeder - initial API and implementation
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package jsprit.examples;
|
package jsprit.examples;
|
||||||
|
|
||||||
import jsprit.analysis.toolbox.GraphStreamViewer;
|
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.VehicleRoutingAlgorithm;
|
||||||
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem;
|
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.VehicleImpl;
|
||||||
import jsprit.core.problem.vehicle.VehicleType;
|
import jsprit.core.problem.vehicle.VehicleType;
|
||||||
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
||||||
|
import jsprit.core.reporting.SolutionPrinter;
|
||||||
import jsprit.core.util.Coordinate;
|
import jsprit.core.util.Coordinate;
|
||||||
import jsprit.core.util.Solutions;
|
import jsprit.core.util.Solutions;
|
||||||
|
|
||||||
|
|
@ -126,7 +123,7 @@ public class HVRPExample {
|
||||||
|
|
||||||
VehicleRoutingProblemSolution best = Solutions.bestOf(solutions);
|
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();
|
new GraphStreamViewer(vrp, best).setRenderDelay(100).display();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* 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/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package jsprit.examples;
|
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.VehicleRoutingAlgorithm;
|
||||||
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
||||||
import jsprit.core.algorithm.listener.VehicleRoutingAlgorithmListeners.Priority;
|
import jsprit.core.algorithm.listener.VehicleRoutingAlgorithmListeners.Priority;
|
||||||
|
|
@ -26,6 +29,7 @@ import jsprit.core.problem.io.VrpXMLReader;
|
||||||
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||||
import jsprit.core.problem.vehicle.VehicleImpl;
|
import jsprit.core.problem.vehicle.VehicleImpl;
|
||||||
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
||||||
|
import jsprit.core.reporting.SolutionPrinter;
|
||||||
import jsprit.core.util.Coordinate;
|
import jsprit.core.util.Coordinate;
|
||||||
import jsprit.core.util.Solutions;
|
import jsprit.core.util.Solutions;
|
||||||
import jsprit.util.Examples;
|
import jsprit.util.Examples;
|
||||||
|
|
|
||||||
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* 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/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
@ -107,7 +107,7 @@ public class MultipleDepotExampleWithPenaltyVehicles {
|
||||||
* solve the problem
|
* solve the problem
|
||||||
*/
|
*/
|
||||||
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfig.xml");
|
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 StopWatch(),Priority.HIGH);
|
||||||
// vra.getAlgorithmListeners().addListener(new AlgorithmSearchProgressChartListener("output/progress.png"));
|
// vra.getAlgorithmListeners().addListener(new AlgorithmSearchProgressChartListener("output/progress.png"));
|
||||||
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
||||||
|
|
|
||||||
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* 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/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
@ -18,7 +18,6 @@ package jsprit.examples;
|
||||||
|
|
||||||
import jsprit.analysis.toolbox.Plotter;
|
import jsprit.analysis.toolbox.Plotter;
|
||||||
import jsprit.analysis.toolbox.Plotter.Label;
|
import jsprit.analysis.toolbox.Plotter.Label;
|
||||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
|
||||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||||
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem;
|
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.VehicleRoutingProblemSolution;
|
||||||
import jsprit.core.problem.solution.route.VehicleRoute;
|
import jsprit.core.problem.solution.route.VehicleRoute;
|
||||||
import jsprit.core.problem.vehicle.Vehicle;
|
import jsprit.core.problem.vehicle.Vehicle;
|
||||||
|
import jsprit.core.reporting.SolutionPrinter;
|
||||||
import jsprit.core.util.Solutions;
|
import jsprit.core.util.Solutions;
|
||||||
import jsprit.util.Examples;
|
import jsprit.util.Examples;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* 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/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package jsprit.examples;
|
package jsprit.examples;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import jsprit.analysis.toolbox.AlgorithmSearchProgressChartListener;
|
import jsprit.analysis.toolbox.AlgorithmSearchProgressChartListener;
|
||||||
import jsprit.analysis.toolbox.Plotter;
|
import jsprit.analysis.toolbox.Plotter;
|
||||||
import jsprit.analysis.toolbox.Plotter.Label;
|
import jsprit.analysis.toolbox.Plotter.Label;
|
||||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
|
||||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||||
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
||||||
import jsprit.core.algorithm.selector.SelectBest;
|
import jsprit.core.algorithm.selector.SelectBest;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem;
|
import jsprit.core.problem.VehicleRoutingProblem;
|
||||||
import jsprit.core.problem.io.VrpXMLReader;
|
import jsprit.core.problem.io.VrpXMLReader;
|
||||||
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||||
|
import jsprit.core.reporting.SolutionPrinter;
|
||||||
import jsprit.util.Examples;
|
import jsprit.util.Examples;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
|
||||||
public class PickupAndDeliveryExample {
|
public class PickupAndDeliveryExample {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* 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/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
@ -20,13 +20,13 @@ import jsprit.analysis.toolbox.AlgorithmSearchProgressChartListener;
|
||||||
import jsprit.analysis.toolbox.GraphStreamViewer;
|
import jsprit.analysis.toolbox.GraphStreamViewer;
|
||||||
import jsprit.analysis.toolbox.Plotter;
|
import jsprit.analysis.toolbox.Plotter;
|
||||||
import jsprit.analysis.toolbox.Plotter.Label;
|
import jsprit.analysis.toolbox.Plotter.Label;
|
||||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
|
||||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||||
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
||||||
import jsprit.core.algorithm.selector.SelectBest;
|
import jsprit.core.algorithm.selector.SelectBest;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem;
|
import jsprit.core.problem.VehicleRoutingProblem;
|
||||||
import jsprit.core.problem.io.VrpXMLReader;
|
import jsprit.core.problem.io.VrpXMLReader;
|
||||||
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||||
|
import jsprit.core.reporting.SolutionPrinter;
|
||||||
import jsprit.util.Examples;
|
import jsprit.util.Examples;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
|
||||||
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* 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/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package jsprit.examples;
|
package jsprit.examples;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import jsprit.analysis.toolbox.AlgorithmSearchProgressChartListener;
|
import jsprit.analysis.toolbox.AlgorithmSearchProgressChartListener;
|
||||||
import jsprit.analysis.toolbox.Plotter;
|
import jsprit.analysis.toolbox.Plotter;
|
||||||
import jsprit.analysis.toolbox.Plotter.Label;
|
import jsprit.analysis.toolbox.Plotter.Label;
|
||||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
|
||||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||||
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
||||||
import jsprit.core.algorithm.selector.SelectBest;
|
import jsprit.core.algorithm.selector.SelectBest;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem;
|
import jsprit.core.problem.VehicleRoutingProblem;
|
||||||
import jsprit.core.problem.io.VrpXMLReader;
|
import jsprit.core.problem.io.VrpXMLReader;
|
||||||
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||||
|
import jsprit.core.reporting.SolutionPrinter;
|
||||||
import jsprit.util.Examples;
|
import jsprit.util.Examples;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
|
||||||
public class PickupAndDeliveryOpenExample {
|
public class PickupAndDeliveryOpenExample {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* 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/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package jsprit.examples;
|
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.VehicleRoutingAlgorithm;
|
||||||
import jsprit.core.algorithm.box.GreedySchrimpfFactory;
|
import jsprit.core.algorithm.box.GreedySchrimpfFactory;
|
||||||
import jsprit.core.algorithm.termination.IterationWithoutImprovementTermination;
|
import jsprit.core.algorithm.termination.IterationWithoutImprovementTermination;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem;
|
import jsprit.core.problem.VehicleRoutingProblem;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem.FleetSize;
|
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.io.VrpXMLWriter;
|
||||||
import jsprit.core.problem.job.Service;
|
import jsprit.core.problem.job.Service;
|
||||||
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||||
import jsprit.core.problem.vehicle.Vehicle;
|
|
||||||
import jsprit.core.problem.vehicle.VehicleImpl;
|
import jsprit.core.problem.vehicle.VehicleImpl;
|
||||||
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
||||||
|
import jsprit.core.reporting.SolutionPrinter;
|
||||||
import jsprit.core.util.Solutions;
|
import jsprit.core.util.Solutions;
|
||||||
import jsprit.core.util.VehicleRoutingTransportCostsMatrix;
|
import jsprit.core.util.VehicleRoutingTransportCostsMatrix;
|
||||||
import jsprit.core.util.VehicleRoutingTransportCostsMatrix.Builder;
|
import jsprit.core.util.VehicleRoutingTransportCostsMatrix.Builder;
|
||||||
import jsprit.util.Examples;
|
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 class RelationKey {
|
||||||
|
|
||||||
static RelationKey newKey(String from, String to){
|
// static RelationKey newKey(String from, String to){
|
||||||
int fromInt = Integer.parseInt(from);
|
// int fromInt = Integer.parseInt(from);
|
||||||
int toInt = Integer.parseInt(to);
|
// int toInt = Integer.parseInt(to);
|
||||||
if(fromInt < toInt){
|
// if(fromInt < toInt){
|
||||||
return new RelationKey(from, to);
|
// return new RelationKey(from, to);
|
||||||
}
|
// }
|
||||||
else {
|
// else {
|
||||||
return new RelationKey(to, from);
|
// return new RelationKey(to, from);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
final String from;
|
final String from;
|
||||||
final String to;
|
final String to;
|
||||||
|
|
@ -114,43 +109,39 @@ public class RefuseCollectionExample {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class RoutingCosts implements VehicleRoutingTransportCosts {
|
// static class RoutingCosts implements VehicleRoutingTransportCosts {
|
||||||
|
//
|
||||||
|
// private Map<RelationKey,Integer> distances;
|
||||||
|
//
|
||||||
|
// public RoutingCosts(Map<RelationKey, Integer> 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<RelationKey,Integer> distances;
|
|
||||||
|
|
||||||
public RoutingCosts(Map<RelationKey, Integer> 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 {
|
public static void main(String[] args) throws IOException {
|
||||||
/*
|
/*
|
||||||
* some preparation - create output folder
|
* some preparation - create output folder
|
||||||
|
|
@ -167,7 +158,7 @@ public class RefuseCollectionExample {
|
||||||
VehicleImpl.Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
|
VehicleImpl.Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
|
||||||
vehicleBuilder.setStartLocationId("1");
|
vehicleBuilder.setStartLocationId("1");
|
||||||
vehicleBuilder.setType(bigType);
|
vehicleBuilder.setType(bigType);
|
||||||
Vehicle bigVehicle = vehicleBuilder.build();
|
VehicleImpl bigVehicle = vehicleBuilder.build();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* start building the problem
|
* 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")));
|
BufferedReader reader = new BufferedReader(new FileReader(new File("input/RefuseCollectionExample_Quantities")));
|
||||||
String line = null;
|
String line;
|
||||||
boolean firstLine = true;
|
boolean firstLine = true;
|
||||||
while((line = reader.readLine()) != null){
|
while((line = reader.readLine()) != null){
|
||||||
if(firstLine) {
|
if(firstLine) {
|
||||||
|
|
@ -227,7 +218,7 @@ public class RefuseCollectionExample {
|
||||||
|
|
||||||
private static void readDistances(Builder matrixBuilder) throws IOException {
|
private static void readDistances(Builder matrixBuilder) throws IOException {
|
||||||
BufferedReader reader = new BufferedReader(new FileReader(new File("input/RefuseCollectionExample_Distances")));
|
BufferedReader reader = new BufferedReader(new FileReader(new File("input/RefuseCollectionExample_Distances")));
|
||||||
String line = null;
|
String line;
|
||||||
boolean firstLine = true;
|
boolean firstLine = true;
|
||||||
while((line = reader.readLine()) != null){
|
while((line = reader.readLine()) != null){
|
||||||
if(firstLine) {
|
if(firstLine) {
|
||||||
|
|
|
||||||
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* 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/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package jsprit.examples;
|
package jsprit.examples;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import jsprit.analysis.toolbox.GraphStreamViewer;
|
import jsprit.analysis.toolbox.GraphStreamViewer;
|
||||||
import jsprit.analysis.toolbox.GraphStreamViewer.Label;
|
import jsprit.analysis.toolbox.GraphStreamViewer.Label;
|
||||||
import jsprit.analysis.toolbox.Plotter;
|
import jsprit.analysis.toolbox.Plotter;
|
||||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
|
||||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||||
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem;
|
import jsprit.core.problem.VehicleRoutingProblem;
|
||||||
import jsprit.core.problem.io.VrpXMLWriter;
|
import jsprit.core.problem.io.VrpXMLWriter;
|
||||||
import jsprit.core.problem.job.Service;
|
import jsprit.core.problem.job.Service;
|
||||||
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||||
import jsprit.core.problem.vehicle.Vehicle;
|
|
||||||
import jsprit.core.problem.vehicle.VehicleImpl;
|
import jsprit.core.problem.vehicle.VehicleImpl;
|
||||||
import jsprit.core.problem.vehicle.VehicleImpl.Builder;
|
import jsprit.core.problem.vehicle.VehicleImpl.Builder;
|
||||||
import jsprit.core.problem.vehicle.VehicleType;
|
import jsprit.core.problem.vehicle.VehicleType;
|
||||||
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
||||||
|
import jsprit.core.reporting.SolutionPrinter;
|
||||||
import jsprit.core.util.Coordinate;
|
import jsprit.core.util.Coordinate;
|
||||||
import jsprit.core.util.Solutions;
|
import jsprit.core.util.Solutions;
|
||||||
import jsprit.util.Examples;
|
import jsprit.util.Examples;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
|
||||||
public class ServicePickupsWithMultipleDepotsExample {
|
public class ServicePickupsWithMultipleDepotsExample {
|
||||||
|
|
||||||
|
|
@ -60,12 +59,12 @@ public class ServicePickupsWithMultipleDepotsExample {
|
||||||
Builder vehicleBuilder1 = VehicleImpl.Builder.newInstance("vehicles@[10,10]");
|
Builder vehicleBuilder1 = VehicleImpl.Builder.newInstance("vehicles@[10,10]");
|
||||||
vehicleBuilder1.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
|
vehicleBuilder1.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
|
||||||
vehicleBuilder1.setType(vehicleType);
|
vehicleBuilder1.setType(vehicleType);
|
||||||
Vehicle vehicle1 = vehicleBuilder1.build();
|
VehicleImpl vehicle1 = vehicleBuilder1.build();
|
||||||
|
|
||||||
Builder vehicleBuilder2 = VehicleImpl.Builder.newInstance("vehicles@[50,50]");
|
Builder vehicleBuilder2 = VehicleImpl.Builder.newInstance("vehicles@[50,50]");
|
||||||
vehicleBuilder2.setStartLocationCoordinate(Coordinate.newInstance(50, 50));
|
vehicleBuilder2.setStartLocationCoordinate(Coordinate.newInstance(50, 50));
|
||||||
vehicleBuilder2.setType(vehicleType);
|
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.
|
* get the algorithm out-of-the-box.
|
||||||
*/
|
*/
|
||||||
VehicleRoutingAlgorithm algorithm = VehicleRoutingAlgorithms.readAndCreateAlgorithm(problem, "input/algorithmConfig.xml");
|
VehicleRoutingAlgorithm algorithm = VehicleRoutingAlgorithms.readAndCreateAlgorithm(problem, "input/algorithmConfig.xml");
|
||||||
algorithm.setNuOfIterations(10);
|
algorithm.setMaxIterations(10);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* and search a solution
|
* and search a solution
|
||||||
|
|
|
||||||
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* 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/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package jsprit.examples;
|
package jsprit.examples;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import jsprit.analysis.toolbox.Plotter;
|
import jsprit.analysis.toolbox.Plotter;
|
||||||
import jsprit.analysis.toolbox.Plotter.Label;
|
import jsprit.analysis.toolbox.Plotter.Label;
|
||||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
|
||||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||||
import jsprit.core.algorithm.box.SchrimpfFactory;
|
import jsprit.core.algorithm.box.SchrimpfFactory;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem;
|
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.Delivery;
|
||||||
import jsprit.core.problem.job.Pickup;
|
import jsprit.core.problem.job.Pickup;
|
||||||
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||||
import jsprit.core.problem.vehicle.Vehicle;
|
|
||||||
import jsprit.core.problem.vehicle.VehicleImpl;
|
import jsprit.core.problem.vehicle.VehicleImpl;
|
||||||
import jsprit.core.problem.vehicle.VehicleImpl.Builder;
|
import jsprit.core.problem.vehicle.VehicleImpl.Builder;
|
||||||
import jsprit.core.problem.vehicle.VehicleType;
|
import jsprit.core.problem.vehicle.VehicleType;
|
||||||
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
||||||
|
import jsprit.core.reporting.SolutionPrinter;
|
||||||
import jsprit.core.util.Coordinate;
|
import jsprit.core.util.Coordinate;
|
||||||
import jsprit.core.util.Solutions;
|
import jsprit.core.util.Solutions;
|
||||||
import jsprit.util.Examples;
|
import jsprit.util.Examples;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
|
||||||
public class SimpleDepotBoundedPickupAndDeliveryExample {
|
public class SimpleDepotBoundedPickupAndDeliveryExample {
|
||||||
|
|
||||||
|
|
@ -58,7 +57,7 @@ public class SimpleDepotBoundedPickupAndDeliveryExample {
|
||||||
Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
|
Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
|
||||||
vehicleBuilder.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
|
vehicleBuilder.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
|
||||||
vehicleBuilder.setType(vehicleType);
|
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.
|
* build pickups and deliveries at the required locations, each with a capacity-demand of 1.
|
||||||
|
|
|
||||||
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* 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/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package jsprit.examples;
|
package jsprit.examples;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import jsprit.analysis.toolbox.GraphStreamViewer;
|
import jsprit.analysis.toolbox.GraphStreamViewer;
|
||||||
import jsprit.analysis.toolbox.Plotter;
|
import jsprit.analysis.toolbox.Plotter;
|
||||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
|
||||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||||
import jsprit.core.algorithm.box.SchrimpfFactory;
|
import jsprit.core.algorithm.box.SchrimpfFactory;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem;
|
import jsprit.core.problem.VehicleRoutingProblem;
|
||||||
import jsprit.core.problem.io.VrpXMLWriter;
|
import jsprit.core.problem.io.VrpXMLWriter;
|
||||||
import jsprit.core.problem.job.Shipment;
|
import jsprit.core.problem.job.Shipment;
|
||||||
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||||
import jsprit.core.problem.vehicle.Vehicle;
|
|
||||||
import jsprit.core.problem.vehicle.VehicleImpl;
|
import jsprit.core.problem.vehicle.VehicleImpl;
|
||||||
import jsprit.core.problem.vehicle.VehicleImpl.Builder;
|
import jsprit.core.problem.vehicle.VehicleImpl.Builder;
|
||||||
import jsprit.core.problem.vehicle.VehicleType;
|
import jsprit.core.problem.vehicle.VehicleType;
|
||||||
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
||||||
|
import jsprit.core.reporting.SolutionPrinter;
|
||||||
import jsprit.core.util.Coordinate;
|
import jsprit.core.util.Coordinate;
|
||||||
import jsprit.core.util.Solutions;
|
import jsprit.core.util.Solutions;
|
||||||
import jsprit.util.Examples;
|
import jsprit.util.Examples;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
|
||||||
public class SimpleEnRoutePickupAndDeliveryExample {
|
public class SimpleEnRoutePickupAndDeliveryExample {
|
||||||
|
|
||||||
|
|
@ -58,7 +57,7 @@ public class SimpleEnRoutePickupAndDeliveryExample {
|
||||||
Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
|
Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
|
||||||
vehicleBuilder.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
|
vehicleBuilder.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
|
||||||
vehicleBuilder.setType(vehicleType);
|
vehicleBuilder.setType(vehicleType);
|
||||||
Vehicle vehicle = vehicleBuilder.build();
|
VehicleImpl vehicle = vehicleBuilder.build();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* build shipments at the required locations, each with a capacity-demand of 1.
|
* build shipments at the required locations, each with a capacity-demand of 1.
|
||||||
|
|
|
||||||
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* 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/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package jsprit.examples;
|
package jsprit.examples;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import jsprit.analysis.toolbox.GraphStreamViewer;
|
import jsprit.analysis.toolbox.GraphStreamViewer;
|
||||||
import jsprit.analysis.toolbox.Plotter;
|
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.VehicleRoutingAlgorithm;
|
||||||
import jsprit.core.algorithm.box.SchrimpfFactory;
|
import jsprit.core.algorithm.box.SchrimpfFactory;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem;
|
import jsprit.core.problem.VehicleRoutingProblem;
|
||||||
import jsprit.core.problem.io.VrpXMLWriter;
|
import jsprit.core.problem.io.VrpXMLWriter;
|
||||||
import jsprit.core.problem.job.Shipment;
|
import jsprit.core.problem.job.Shipment;
|
||||||
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||||
import jsprit.core.problem.vehicle.Vehicle;
|
|
||||||
import jsprit.core.problem.vehicle.VehicleImpl;
|
import jsprit.core.problem.vehicle.VehicleImpl;
|
||||||
import jsprit.core.problem.vehicle.VehicleImpl.Builder;
|
import jsprit.core.problem.vehicle.VehicleImpl.Builder;
|
||||||
import jsprit.core.problem.vehicle.VehicleType;
|
import jsprit.core.problem.vehicle.VehicleType;
|
||||||
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
||||||
|
import jsprit.core.reporting.SolutionPrinter;
|
||||||
import jsprit.core.util.Coordinate;
|
import jsprit.core.util.Coordinate;
|
||||||
import jsprit.core.util.Solutions;
|
import jsprit.core.util.Solutions;
|
||||||
import jsprit.util.Examples;
|
import jsprit.util.Examples;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
|
||||||
public class SimpleEnRoutePickupAndDeliveryOpenRoutesExample {
|
public class SimpleEnRoutePickupAndDeliveryOpenRoutesExample {
|
||||||
|
|
||||||
|
|
@ -59,7 +57,7 @@ public class SimpleEnRoutePickupAndDeliveryOpenRoutesExample {
|
||||||
vehicleBuilder.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
|
vehicleBuilder.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
|
||||||
vehicleBuilder.setType(vehicleType);
|
vehicleBuilder.setType(vehicleType);
|
||||||
vehicleBuilder.setReturnToDepot(false);
|
vehicleBuilder.setReturnToDepot(false);
|
||||||
Vehicle vehicle = vehicleBuilder.build();
|
VehicleImpl vehicle = vehicleBuilder.build();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* build shipments at the required locations, each with a capacity-demand of 1.
|
* 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
|
* print nRoutes and totalCosts of bestSolution
|
||||||
*/
|
*/
|
||||||
SolutionPrinter.print(problem,bestSolution,Print.VERBOSE);
|
SolutionPrinter.print(problem, bestSolution, SolutionPrinter.Print.VERBOSE);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* plot problem without solution
|
* plot problem without solution
|
||||||
|
|
|
||||||
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* 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/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package jsprit.examples;
|
package jsprit.examples;
|
||||||
|
|
||||||
import jsprit.analysis.toolbox.Plotter;
|
import jsprit.analysis.toolbox.Plotter;
|
||||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
|
||||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||||
import jsprit.core.algorithm.VehicleRoutingAlgorithmBuilder;
|
import jsprit.core.algorithm.VehicleRoutingAlgorithmBuilder;
|
||||||
import jsprit.core.algorithm.state.StateManager;
|
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.Delivery;
|
||||||
import jsprit.core.problem.job.Shipment;
|
import jsprit.core.problem.job.Shipment;
|
||||||
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||||
import jsprit.core.problem.vehicle.Vehicle;
|
|
||||||
import jsprit.core.problem.vehicle.VehicleImpl;
|
import jsprit.core.problem.vehicle.VehicleImpl;
|
||||||
import jsprit.core.problem.vehicle.VehicleImpl.Builder;
|
import jsprit.core.problem.vehicle.VehicleImpl.Builder;
|
||||||
import jsprit.core.problem.vehicle.VehicleType;
|
import jsprit.core.problem.vehicle.VehicleType;
|
||||||
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
||||||
|
import jsprit.core.reporting.SolutionPrinter;
|
||||||
import jsprit.core.util.Coordinate;
|
import jsprit.core.util.Coordinate;
|
||||||
import jsprit.core.util.Solutions;
|
import jsprit.core.util.Solutions;
|
||||||
import jsprit.util.Examples;
|
import jsprit.util.Examples;
|
||||||
|
|
@ -60,7 +59,7 @@ public class SimpleEnRoutePickupAndDeliveryWithDepotBoundedDeliveriesExample {
|
||||||
Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
|
Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
|
||||||
vehicleBuilder.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
|
vehicleBuilder.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
|
||||||
vehicleBuilder.setType(vehicleType);
|
vehicleBuilder.setType(vehicleType);
|
||||||
Vehicle vehicle = vehicleBuilder.build();
|
VehicleImpl vehicle = vehicleBuilder.build();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* build shipments at the required locations, each with a capacity-demand of 1.
|
* build shipments at the required locations, each with a capacity-demand of 1.
|
||||||
|
|
|
||||||
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* 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/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
@ -18,19 +18,17 @@ package jsprit.examples;
|
||||||
|
|
||||||
import jsprit.analysis.toolbox.GraphStreamViewer;
|
import jsprit.analysis.toolbox.GraphStreamViewer;
|
||||||
import jsprit.analysis.toolbox.GraphStreamViewer.Label;
|
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.VehicleRoutingAlgorithm;
|
||||||
import jsprit.core.algorithm.box.SchrimpfFactory;
|
import jsprit.core.algorithm.box.SchrimpfFactory;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem;
|
import jsprit.core.problem.VehicleRoutingProblem;
|
||||||
import jsprit.core.problem.io.VrpXMLWriter;
|
import jsprit.core.problem.io.VrpXMLWriter;
|
||||||
import jsprit.core.problem.job.Service;
|
import jsprit.core.problem.job.Service;
|
||||||
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||||
import jsprit.core.problem.vehicle.Vehicle;
|
|
||||||
import jsprit.core.problem.vehicle.VehicleImpl;
|
import jsprit.core.problem.vehicle.VehicleImpl;
|
||||||
import jsprit.core.problem.vehicle.VehicleImpl.Builder;
|
import jsprit.core.problem.vehicle.VehicleImpl.Builder;
|
||||||
import jsprit.core.problem.vehicle.VehicleType;
|
import jsprit.core.problem.vehicle.VehicleType;
|
||||||
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
||||||
|
import jsprit.core.reporting.SolutionPrinter;
|
||||||
import jsprit.core.util.Coordinate;
|
import jsprit.core.util.Coordinate;
|
||||||
import jsprit.core.util.Solutions;
|
import jsprit.core.util.Solutions;
|
||||||
|
|
||||||
|
|
@ -67,7 +65,7 @@ public class SimpleExample {
|
||||||
Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
|
Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
|
||||||
vehicleBuilder.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
|
vehicleBuilder.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
|
||||||
vehicleBuilder.setType(vehicleType);
|
vehicleBuilder.setType(vehicleType);
|
||||||
Vehicle vehicle = vehicleBuilder.build();
|
VehicleImpl vehicle = vehicleBuilder.build();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* build services at the required locations, each with a capacity-demand of 1.
|
* 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");
|
new VrpXMLWriter(problem, solutions).write("output/problem-with-solution.xml");
|
||||||
|
|
||||||
SolutionPrinter.print(problem,bestSolution,Print.VERBOSE);
|
SolutionPrinter.print(problem, bestSolution, SolutionPrinter.Print.VERBOSE);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* plot
|
* plot
|
||||||
|
|
|
||||||
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* 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/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package jsprit.examples;
|
package jsprit.examples;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import jsprit.analysis.toolbox.Plotter;
|
import jsprit.analysis.toolbox.Plotter;
|
||||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
|
||||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||||
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem;
|
import jsprit.core.problem.VehicleRoutingProblem;
|
||||||
import jsprit.core.problem.io.VrpXMLWriter;
|
import jsprit.core.problem.io.VrpXMLWriter;
|
||||||
import jsprit.core.problem.job.Service;
|
import jsprit.core.problem.job.Service;
|
||||||
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||||
import jsprit.core.problem.vehicle.Vehicle;
|
|
||||||
import jsprit.core.problem.vehicle.VehicleImpl;
|
import jsprit.core.problem.vehicle.VehicleImpl;
|
||||||
import jsprit.core.problem.vehicle.VehicleImpl.Builder;
|
import jsprit.core.problem.vehicle.VehicleImpl.Builder;
|
||||||
import jsprit.core.problem.vehicle.VehicleType;
|
import jsprit.core.problem.vehicle.VehicleType;
|
||||||
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
||||||
|
import jsprit.core.reporting.SolutionPrinter;
|
||||||
import jsprit.core.util.Coordinate;
|
import jsprit.core.util.Coordinate;
|
||||||
import jsprit.core.util.Solutions;
|
import jsprit.core.util.Solutions;
|
||||||
import jsprit.util.Examples;
|
import jsprit.util.Examples;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
|
||||||
public class SimpleExampleOpenRoutes {
|
public class SimpleExampleOpenRoutes {
|
||||||
|
|
||||||
|
|
@ -59,7 +58,7 @@ public class SimpleExampleOpenRoutes {
|
||||||
vehicleBuilder.setType(vehicleType);
|
vehicleBuilder.setType(vehicleType);
|
||||||
vehicleBuilder.setReturnToDepot(false);
|
vehicleBuilder.setReturnToDepot(false);
|
||||||
|
|
||||||
Vehicle vehicle = vehicleBuilder.build();
|
VehicleImpl vehicle = vehicleBuilder.build();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* build services at the required locations, each with a capacity-demand of 1.
|
* build services at the required locations, each with a capacity-demand of 1.
|
||||||
|
|
|
||||||
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* 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/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
@ -18,8 +18,6 @@ package jsprit.examples;
|
||||||
|
|
||||||
import jsprit.analysis.toolbox.GraphStreamViewer;
|
import jsprit.analysis.toolbox.GraphStreamViewer;
|
||||||
import jsprit.analysis.toolbox.GraphStreamViewer.Label;
|
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.VehicleRoutingAlgorithm;
|
||||||
import jsprit.core.algorithm.VehicleRoutingAlgorithmBuilder;
|
import jsprit.core.algorithm.VehicleRoutingAlgorithmBuilder;
|
||||||
import jsprit.core.algorithm.state.StateManager;
|
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.VehicleImpl.Builder;
|
||||||
import jsprit.core.problem.vehicle.VehicleType;
|
import jsprit.core.problem.vehicle.VehicleType;
|
||||||
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
||||||
|
import jsprit.core.reporting.SolutionPrinter;
|
||||||
import jsprit.core.util.Coordinate;
|
import jsprit.core.util.Coordinate;
|
||||||
import jsprit.core.util.Solutions;
|
import jsprit.core.util.Solutions;
|
||||||
|
|
||||||
|
|
@ -123,7 +122,7 @@ public class SimpleExampleWithSkills {
|
||||||
|
|
||||||
new VrpXMLWriter(problem, solutions).write("output/problem-with-solution.xml");
|
new VrpXMLWriter(problem, solutions).write("output/problem-with-solution.xml");
|
||||||
|
|
||||||
SolutionPrinter.print(problem,bestSolution,Print.VERBOSE);
|
SolutionPrinter.print(problem, bestSolution, SolutionPrinter.Print.VERBOSE);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* plot
|
* plot
|
||||||
|
|
|
||||||
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* 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/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
@ -18,7 +18,6 @@ package jsprit.examples;
|
||||||
|
|
||||||
import jsprit.analysis.toolbox.Plotter;
|
import jsprit.analysis.toolbox.Plotter;
|
||||||
import jsprit.analysis.toolbox.Plotter.Label;
|
import jsprit.analysis.toolbox.Plotter.Label;
|
||||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
|
||||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||||
import jsprit.core.algorithm.VehicleRoutingAlgorithmBuilder;
|
import jsprit.core.algorithm.VehicleRoutingAlgorithmBuilder;
|
||||||
import jsprit.core.algorithm.state.StateManager;
|
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.Delivery;
|
||||||
import jsprit.core.problem.job.Pickup;
|
import jsprit.core.problem.job.Pickup;
|
||||||
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||||
import jsprit.core.problem.vehicle.Vehicle;
|
|
||||||
import jsprit.core.problem.vehicle.VehicleImpl;
|
import jsprit.core.problem.vehicle.VehicleImpl;
|
||||||
import jsprit.core.problem.vehicle.VehicleImpl.Builder;
|
import jsprit.core.problem.vehicle.VehicleImpl.Builder;
|
||||||
import jsprit.core.problem.vehicle.VehicleType;
|
import jsprit.core.problem.vehicle.VehicleType;
|
||||||
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
||||||
|
import jsprit.core.reporting.SolutionPrinter;
|
||||||
import jsprit.core.util.Coordinate;
|
import jsprit.core.util.Coordinate;
|
||||||
import jsprit.core.util.Solutions;
|
import jsprit.core.util.Solutions;
|
||||||
import jsprit.util.Examples;
|
import jsprit.util.Examples;
|
||||||
|
|
@ -61,7 +60,7 @@ public class SimpleVRPWithBackhaulsExample {
|
||||||
Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
|
Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
|
||||||
vehicleBuilder.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
|
vehicleBuilder.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
|
||||||
vehicleBuilder.setType(vehicleType);
|
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.
|
* build pickups and deliveries at the required locations, each with a capacity-demand of 1.
|
||||||
|
|
|
||||||
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* 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/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
@ -19,13 +19,12 @@ package jsprit.examples;
|
||||||
import jsprit.analysis.toolbox.GraphStreamViewer;
|
import jsprit.analysis.toolbox.GraphStreamViewer;
|
||||||
import jsprit.analysis.toolbox.GraphStreamViewer.Label;
|
import jsprit.analysis.toolbox.GraphStreamViewer.Label;
|
||||||
import jsprit.analysis.toolbox.Plotter;
|
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.VehicleRoutingAlgorithm;
|
||||||
import jsprit.core.algorithm.box.SchrimpfFactory;
|
import jsprit.core.algorithm.box.SchrimpfFactory;
|
||||||
import jsprit.core.algorithm.selector.SelectBest;
|
import jsprit.core.algorithm.selector.SelectBest;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem;
|
import jsprit.core.problem.VehicleRoutingProblem;
|
||||||
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||||
|
import jsprit.core.reporting.SolutionPrinter;
|
||||||
import jsprit.instance.reader.SolomonReader;
|
import jsprit.instance.reader.SolomonReader;
|
||||||
import jsprit.util.Examples;
|
import jsprit.util.Examples;
|
||||||
|
|
||||||
|
|
@ -83,7 +82,7 @@ public class SolomonExample {
|
||||||
/*
|
/*
|
||||||
* print solution
|
* print solution
|
||||||
*/
|
*/
|
||||||
SolutionPrinter.print(vrp,solution,Print.VERBOSE);
|
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Plot solution.
|
* Plot solution.
|
||||||
|
|
|
||||||
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* 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/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package jsprit.examples;
|
package jsprit.examples;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import jsprit.analysis.toolbox.AlgorithmSearchProgressChartListener;
|
import jsprit.analysis.toolbox.AlgorithmSearchProgressChartListener;
|
||||||
import jsprit.analysis.toolbox.GraphStreamViewer;
|
import jsprit.analysis.toolbox.GraphStreamViewer;
|
||||||
import jsprit.analysis.toolbox.GraphStreamViewer.Label;
|
import jsprit.analysis.toolbox.GraphStreamViewer.Label;
|
||||||
import jsprit.analysis.toolbox.Plotter;
|
import jsprit.analysis.toolbox.Plotter;
|
||||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
|
||||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||||
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
||||||
import jsprit.core.algorithm.selector.SelectBest;
|
import jsprit.core.algorithm.selector.SelectBest;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem;
|
import jsprit.core.problem.VehicleRoutingProblem;
|
||||||
import jsprit.core.problem.io.VrpXMLReader;
|
import jsprit.core.problem.io.VrpXMLReader;
|
||||||
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||||
|
import jsprit.core.reporting.SolutionPrinter;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
|
||||||
public class SolomonExampleWithSpecifiedVehicleEndLocations {
|
public class SolomonExampleWithSpecifiedVehicleEndLocations {
|
||||||
|
|
@ -73,7 +73,7 @@ public class SolomonExampleWithSpecifiedVehicleEndLocations {
|
||||||
*/
|
*/
|
||||||
// VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp);
|
// VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp);
|
||||||
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfig_fix.xml");
|
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfig_fix.xml");
|
||||||
vra.setNuOfIterations(20000);
|
vra.setMaxIterations(20000);
|
||||||
// vra.setPrematureBreak(100);
|
// vra.setPrematureBreak(100);
|
||||||
vra.getAlgorithmListeners().addListener(new AlgorithmSearchProgressChartListener("output/sol_progress.png"));
|
vra.getAlgorithmListeners().addListener(new AlgorithmSearchProgressChartListener("output/sol_progress.png"));
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* 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/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package jsprit.examples;
|
package jsprit.examples;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import jsprit.analysis.toolbox.GraphStreamViewer;
|
import jsprit.analysis.toolbox.GraphStreamViewer;
|
||||||
import jsprit.analysis.toolbox.GraphStreamViewer.Label;
|
import jsprit.analysis.toolbox.GraphStreamViewer.Label;
|
||||||
import jsprit.analysis.toolbox.Plotter;
|
import jsprit.analysis.toolbox.Plotter;
|
||||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
|
||||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||||
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
||||||
import jsprit.core.algorithm.selector.SelectBest;
|
import jsprit.core.algorithm.selector.SelectBest;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem;
|
import jsprit.core.problem.VehicleRoutingProblem;
|
||||||
import jsprit.core.problem.io.VrpXMLReader;
|
import jsprit.core.problem.io.VrpXMLReader;
|
||||||
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||||
|
import jsprit.core.reporting.SolutionPrinter;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
|
||||||
public class SolomonExampleWithSpecifiedVehicleEndLocationsWithoutTWs {
|
public class SolomonExampleWithSpecifiedVehicleEndLocationsWithoutTWs {
|
||||||
|
|
@ -73,7 +73,7 @@ public class SolomonExampleWithSpecifiedVehicleEndLocationsWithoutTWs {
|
||||||
*/
|
*/
|
||||||
// VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp);
|
// VehicleRoutingAlgorithm vra = new SchrimpfFactory().createAlgorithm(vrp);
|
||||||
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfigWithSchrimpfAcceptance.xml");
|
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfigWithSchrimpfAcceptance.xml");
|
||||||
vra.setNuOfIterations(20000);
|
vra.setMaxIterations(20000);
|
||||||
// vra.setPrematureBreak(100);
|
// vra.setPrematureBreak(100);
|
||||||
// vra.getAlgorithmListeners().addListener(new AlgorithmSearchProgressChartListener("output/sol_progress.png"));
|
// vra.getAlgorithmListeners().addListener(new AlgorithmSearchProgressChartListener("output/sol_progress.png"));
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* 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/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package jsprit.examples;
|
package jsprit.examples;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import jsprit.analysis.toolbox.GraphStreamViewer;
|
import jsprit.analysis.toolbox.GraphStreamViewer;
|
||||||
import jsprit.analysis.toolbox.GraphStreamViewer.Label;
|
import jsprit.analysis.toolbox.GraphStreamViewer.Label;
|
||||||
|
|
||||||
import jsprit.analysis.toolbox.Plotter;
|
import jsprit.analysis.toolbox.Plotter;
|
||||||
|
|
||||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
|
||||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||||
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
||||||
import jsprit.core.algorithm.selector.SelectBest;
|
import jsprit.core.algorithm.selector.SelectBest;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem;
|
import jsprit.core.problem.VehicleRoutingProblem;
|
||||||
import jsprit.core.problem.io.VrpXMLReader;
|
import jsprit.core.problem.io.VrpXMLReader;
|
||||||
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||||
|
import jsprit.core.reporting.SolutionPrinter;
|
||||||
import jsprit.util.Examples;
|
import jsprit.util.Examples;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
|
||||||
public class SolomonOpenExample {
|
public class SolomonOpenExample {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* 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/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package jsprit.examples;
|
package jsprit.examples;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import jsprit.analysis.toolbox.Plotter;
|
import jsprit.analysis.toolbox.Plotter;
|
||||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
|
||||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||||
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
import jsprit.core.algorithm.io.VehicleRoutingAlgorithms;
|
||||||
import jsprit.core.algorithm.selector.SelectBest;
|
import jsprit.core.algorithm.selector.SelectBest;
|
||||||
import jsprit.core.problem.VehicleRoutingProblem;
|
import jsprit.core.problem.VehicleRoutingProblem;
|
||||||
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||||
|
import jsprit.core.reporting.SolutionPrinter;
|
||||||
import jsprit.instance.reader.SolomonReader;
|
import jsprit.instance.reader.SolomonReader;
|
||||||
import jsprit.util.Examples;
|
import jsprit.util.Examples;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
|
||||||
public class SolomonR101Example {
|
public class SolomonR101Example {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
package jsprit.examples;
|
package jsprit.examples;
|
||||||
|
|
||||||
|
|
||||||
import jsprit.analysis.toolbox.Plotter;
|
import jsprit.analysis.toolbox.Plotter;
|
||||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
|
||||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||||
import jsprit.core.algorithm.VehicleRoutingAlgorithmBuilder;
|
import jsprit.core.algorithm.VehicleRoutingAlgorithmBuilder;
|
||||||
import jsprit.core.algorithm.state.StateManager;
|
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.Vehicle;
|
||||||
import jsprit.core.problem.vehicle.VehicleImpl;
|
import jsprit.core.problem.vehicle.VehicleImpl;
|
||||||
import jsprit.core.problem.vehicle.VehicleType;
|
import jsprit.core.problem.vehicle.VehicleType;
|
||||||
|
import jsprit.core.reporting.SolutionPrinter;
|
||||||
import jsprit.core.util.Solutions;
|
import jsprit.core.util.Solutions;
|
||||||
import jsprit.instance.reader.SolomonReader;
|
import jsprit.instance.reader.SolomonReader;
|
||||||
|
|
||||||
|
|
@ -60,7 +77,6 @@ public class SolomonWithSkillsExample {
|
||||||
}
|
}
|
||||||
skillProblemBuilder.addJob(skillServiceBuilder.build());
|
skillProblemBuilder.addJob(skillServiceBuilder.build());
|
||||||
}
|
}
|
||||||
skillProblemBuilder.addPenaltyVehicles(3.,100.);
|
|
||||||
skillProblemBuilder.setFleetSize(VehicleRoutingProblem.FleetSize.FINITE);
|
skillProblemBuilder.setFleetSize(VehicleRoutingProblem.FleetSize.FINITE);
|
||||||
VehicleRoutingProblem skillProblem = skillProblemBuilder.build();
|
VehicleRoutingProblem skillProblem = skillProblemBuilder.build();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* 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.
|
* 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
|
*
|
||||||
|
* 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/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* Stefan Schroeder - initial API and implementation
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package jsprit.examples;
|
package jsprit.examples;
|
||||||
|
|
||||||
import jsprit.analysis.toolbox.GraphStreamViewer;
|
import jsprit.analysis.toolbox.GraphStreamViewer;
|
||||||
import jsprit.analysis.toolbox.GraphStreamViewer.Label;
|
import jsprit.analysis.toolbox.GraphStreamViewer.Label;
|
||||||
import jsprit.analysis.toolbox.Plotter;
|
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.VehicleRoutingAlgorithm;
|
||||||
import jsprit.core.algorithm.VehicleRoutingAlgorithmBuilder;
|
import jsprit.core.algorithm.VehicleRoutingAlgorithmBuilder;
|
||||||
import jsprit.core.algorithm.state.StateManager;
|
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.job.Shipment;
|
||||||
import jsprit.core.problem.misc.JobInsertionContext;
|
import jsprit.core.problem.misc.JobInsertionContext;
|
||||||
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||||
import jsprit.core.problem.vehicle.Vehicle;
|
|
||||||
import jsprit.core.problem.vehicle.VehicleImpl;
|
import jsprit.core.problem.vehicle.VehicleImpl;
|
||||||
import jsprit.core.problem.vehicle.VehicleImpl.Builder;
|
import jsprit.core.problem.vehicle.VehicleImpl.Builder;
|
||||||
import jsprit.core.problem.vehicle.VehicleType;
|
import jsprit.core.problem.vehicle.VehicleType;
|
||||||
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
import jsprit.core.problem.vehicle.VehicleTypeImpl;
|
||||||
|
import jsprit.core.reporting.SolutionPrinter;
|
||||||
import jsprit.core.util.Coordinate;
|
import jsprit.core.util.Coordinate;
|
||||||
import jsprit.core.util.Solutions;
|
import jsprit.core.util.Solutions;
|
||||||
import jsprit.util.Examples;
|
import jsprit.util.Examples;
|
||||||
|
|
@ -80,22 +76,22 @@ public class TransportOfDisabledPeople {
|
||||||
Builder vehicleBuilder1 = VehicleImpl.Builder.newInstance("wheelchair_bus");
|
Builder vehicleBuilder1 = VehicleImpl.Builder.newInstance("wheelchair_bus");
|
||||||
vehicleBuilder1.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
|
vehicleBuilder1.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
|
||||||
vehicleBuilder1.setType(vehicleType_wheelchair);
|
vehicleBuilder1.setType(vehicleType_wheelchair);
|
||||||
Vehicle vehicle1 = vehicleBuilder1.build();
|
VehicleImpl vehicle1 = vehicleBuilder1.build();
|
||||||
|
|
||||||
Builder vehicleBuilder1_2 = VehicleImpl.Builder.newInstance("wheelchair_bus_2");
|
Builder vehicleBuilder1_2 = VehicleImpl.Builder.newInstance("wheelchair_bus_2");
|
||||||
vehicleBuilder1_2.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
|
vehicleBuilder1_2.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
|
||||||
vehicleBuilder1_2.setType(vehicleType_wheelchair);
|
vehicleBuilder1_2.setType(vehicleType_wheelchair);
|
||||||
Vehicle vehicle1_2 = vehicleBuilder1_2.build();
|
VehicleImpl vehicle1_2 = vehicleBuilder1_2.build();
|
||||||
|
|
||||||
Builder vehicleBuilder2 = VehicleImpl.Builder.newInstance("passenger_bus");
|
Builder vehicleBuilder2 = VehicleImpl.Builder.newInstance("passenger_bus");
|
||||||
vehicleBuilder2.setStartLocationCoordinate(Coordinate.newInstance(30, 30)).setEndLocationCoordinate(Coordinate.newInstance(30, 19));
|
vehicleBuilder2.setStartLocationCoordinate(Coordinate.newInstance(30, 30)).setEndLocationCoordinate(Coordinate.newInstance(30, 19));
|
||||||
vehicleBuilder2.setType(vehicleType_solelypassenger);
|
vehicleBuilder2.setType(vehicleType_solelypassenger);
|
||||||
Vehicle vehicle2 = vehicleBuilder2.build();
|
VehicleImpl vehicle2 = vehicleBuilder2.build();
|
||||||
|
|
||||||
Builder vehicleBuilder2_2 = VehicleImpl.Builder.newInstance("passenger_bus_2");
|
Builder vehicleBuilder2_2 = VehicleImpl.Builder.newInstance("passenger_bus_2");
|
||||||
vehicleBuilder2_2.setStartLocationCoordinate(Coordinate.newInstance(30, 30)).setEndLocationCoordinate(Coordinate.newInstance(30, 19));
|
vehicleBuilder2_2.setStartLocationCoordinate(Coordinate.newInstance(30, 30)).setEndLocationCoordinate(Coordinate.newInstance(30, 19));
|
||||||
vehicleBuilder2_2.setType(vehicleType_solelypassenger);
|
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
|
* print nRoutes and totalCosts of bestSolution
|
||||||
*/
|
*/
|
||||||
SolutionPrinter.print(problem,bestSolution,Print.VERBOSE);
|
SolutionPrinter.print(problem, bestSolution, SolutionPrinter.Print.VERBOSE);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* plot problem without solution
|
* plot problem without solution
|
||||||
|
|
|
||||||
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* 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/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
@ -18,8 +18,6 @@ package jsprit.examples;
|
||||||
|
|
||||||
import jsprit.analysis.toolbox.AlgorithmSearchProgressChartListener;
|
import jsprit.analysis.toolbox.AlgorithmSearchProgressChartListener;
|
||||||
import jsprit.analysis.toolbox.GraphStreamViewer;
|
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.VehicleRoutingAlgorithm;
|
||||||
import jsprit.core.algorithm.VehicleRoutingAlgorithmBuilder;
|
import jsprit.core.algorithm.VehicleRoutingAlgorithmBuilder;
|
||||||
import jsprit.core.algorithm.selector.SelectBest;
|
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.constraint.ServiceDeliveriesFirstConstraint;
|
||||||
import jsprit.core.problem.io.VrpXMLReader;
|
import jsprit.core.problem.io.VrpXMLReader;
|
||||||
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||||
|
import jsprit.core.reporting.SolutionPrinter;
|
||||||
import jsprit.util.Examples;
|
import jsprit.util.Examples;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
@ -92,7 +91,7 @@ public class VRPWithBackhaulsExample {
|
||||||
/*
|
/*
|
||||||
* print solution
|
* print solution
|
||||||
*/
|
*/
|
||||||
SolutionPrinter.print(vrp,solution,Print.VERBOSE);
|
SolutionPrinter.print(vrp, solution, SolutionPrinter.Print.VERBOSE);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Plot solution.
|
* Plot solution.
|
||||||
|
|
|
||||||
|
|
@ -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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* 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.
|
* 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* 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/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
@ -18,7 +18,6 @@ package jsprit.examples;
|
||||||
|
|
||||||
import jsprit.analysis.toolbox.Plotter;
|
import jsprit.analysis.toolbox.Plotter;
|
||||||
import jsprit.analysis.toolbox.Plotter.Label;
|
import jsprit.analysis.toolbox.Plotter.Label;
|
||||||
import jsprit.analysis.toolbox.SolutionPrinter;
|
|
||||||
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
import jsprit.core.algorithm.VehicleRoutingAlgorithm;
|
||||||
import jsprit.core.algorithm.VehicleRoutingAlgorithmBuilder;
|
import jsprit.core.algorithm.VehicleRoutingAlgorithmBuilder;
|
||||||
import jsprit.core.algorithm.selector.SelectBest;
|
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.constraint.ServiceDeliveriesFirstConstraint;
|
||||||
import jsprit.core.problem.io.VrpXMLReader;
|
import jsprit.core.problem.io.VrpXMLReader;
|
||||||
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
import jsprit.core.problem.solution.VehicleRoutingProblemSolution;
|
||||||
|
import jsprit.core.reporting.SolutionPrinter;
|
||||||
import jsprit.util.Examples;
|
import jsprit.util.Examples;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue