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

@ -22,11 +22,11 @@
<algorithm xmlns="http://www.w3schools.com" <algorithm xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3schools.com algorithm_schema.xsd"> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3schools.com algorithm_schema.xsd">
<iterations>1000</iterations> <iterations>20000</iterations>
<construction> <construction>
<insertion name="bestInsertion"> <insertion name="bestInsertion">
<allowVehicleSwitch>false</allowVehicleSwitch> <allowVehicleSwitch>true</allowVehicleSwitch>
</insertion> </insertion>
</construction> </construction>
@ -36,8 +36,8 @@
<searchStrategy name="radialRuinAndRecreate"> <searchStrategy name="radialRuinAndRecreate">
<selector name="selectBest"/> <selector name="selectBest"/>
<acceptor name="schrimpfAcceptance"> <acceptor name="schrimpfAcceptance">
<alpha>0.1</alpha> <alpha>0.05</alpha>
<warmup>40</warmup> <warmup>20</warmup>
</acceptor> </acceptor>
<modules> <modules>
<module name="ruin_and_recreate"> <module name="ruin_and_recreate">
@ -56,7 +56,7 @@
<acceptor name="schrimpfAcceptance"/> <acceptor name="schrimpfAcceptance"/>
<modules> <modules>
<module name="ruin_and_recreate"> <module name="ruin_and_recreate">
<ruin id="1" name="radialRuin"> <ruin name="radialRuin">
<share>0.3</share> <share>0.3</share>
</ruin> </ruin>
<insertion name="bestInsertion"/> <insertion name="bestInsertion"/>

View file

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