1
0
Fork 0
mirror of https://github.com/graphhopper/jsprit.git synced 2020-01-24 07:45:05 +01:00
This commit is contained in:
oblonski 2014-02-10 18:01:23 +01:00
parent 330fa937a0
commit 97fa2a7639
2 changed files with 9 additions and 8 deletions

View file

@ -8,6 +8,7 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import jsprit.analysis.toolbox.AlgorithmSearchProgressChartListener;
import jsprit.analysis.toolbox.GraphStreamViewer;
import jsprit.analysis.toolbox.GraphStreamViewer.Label;
import jsprit.analysis.toolbox.Plotter;
@ -226,7 +227,7 @@ public class BicycleMessenger {
problemBuilder.addConstraint(new ThreeTimesLessThanBestDirectRouteConstraint(nearestMessengers, routingCosts, stateManager));
problemBuilder.addConstraint(new IgnoreMessengerThatCanNeverMeetTimeRequirements(nearestMessengers, routingCosts));
problemBuilder.addPenaltyVehicles(10.0,50000);
problemBuilder.addPenaltyVehicles(20.0,50000);
//finally build the problem
VehicleRoutingProblem bicycleMessengerProblem = problemBuilder.build();
@ -238,8 +239,8 @@ public class BicycleMessenger {
VehicleRoutingAlgorithm algorithm = VehicleRoutingAlgorithms.readAndCreateAlgorithm(bicycleMessengerProblem,"input/algorithmConfig_open.xml", stateManager);
//if you want, terminate it after 1000 iterations with no change
// algorithm.setPrematureAlgorithmTermination(new IterationWithoutImprovementTermination(1000));
// algorithm.addListener(new AlgorithmSearchProgressChartListener("output/progress.png"));
algorithm.setNuOfIterations(2000);
algorithm.addListener(new AlgorithmSearchProgressChartListener("output/progress.png"));
// algorithm.setNuOfIterations(2000);
Collection<VehicleRoutingProblemSolution> solutions = algorithm.searchSolutions();
//this is just to ensure that solution meet the above constraints