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:
Stefan Schroeder 2014-01-10 15:17:37 +01:00
parent 5593671e7a
commit 050de45d8e
3 changed files with 15 additions and 7 deletions

View file

@ -99,6 +99,13 @@ public class SchrimpfAcceptance implements SolutionAcceptor, IterationStartsList
} }
/**
* @param initialThreshold the initialThreshold to set
*/
public void setInitialThreshold(double initialThreshold) {
this.initialThreshold = initialThreshold;
}
@Override @Override
public void informAlgorithmStarts(VehicleRoutingProblem problem, VehicleRoutingAlgorithm algorithm, Collection<VehicleRoutingProblemSolution> solutions) { public void informAlgorithmStarts(VehicleRoutingProblem problem, VehicleRoutingAlgorithm algorithm, Collection<VehicleRoutingProblemSolution> solutions) {
reset(); reset();

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>10000</iterations> <iterations>1000</iterations>
<construction> <construction>
<insertion name="bestInsertion"> <insertion name="bestInsertion">
<allowVehicleSwitch>false</allowVehicleSwitch>
</insertion> </insertion>
</construction> </construction>
@ -42,7 +42,7 @@
<modules> <modules>
<module name="ruin_and_recreate"> <module name="ruin_and_recreate">
<ruin name="randomRuin"> <ruin name="randomRuin">
<share>0.4</share> <share>0.5</share>
</ruin> </ruin>
<insertion name="bestInsertion"/> <insertion name="bestInsertion"/>
</module> </module>

View file

@ -8,7 +8,8 @@ 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.Label;
import jsprit.analysis.toolbox.Plotter; import jsprit.analysis.toolbox.Plotter;
import jsprit.analysis.toolbox.SolutionPrinter; import jsprit.analysis.toolbox.SolutionPrinter;
import jsprit.analysis.toolbox.SolutionPrinter.Print; import jsprit.analysis.toolbox.SolutionPrinter.Print;
@ -237,8 +238,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(1000); algorithm.setNuOfIterations(200);
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
@ -265,7 +266,7 @@ public class BicycleMessenger {
// new GraphStreamViewer(bicycleMessengerProblem).labelWith(Label.ID).setRenderShipments(true).setRenderDelay(150).display(); // new GraphStreamViewer(bicycleMessengerProblem).labelWith(Label.ID).setRenderShipments(true).setRenderDelay(150).display();
// //
// new GraphStreamViewer(bicycleMessengerProblem, Solutions.bestOf(solutions)).setGraphStreamFrameScalingFactor(1.5).setCameraView(12500, 55000, 0.25).labelWith(Label.ACTIVITY).setRenderShipments(true).setRenderDelay(150).display(); new GraphStreamViewer(bicycleMessengerProblem, Solutions.bestOf(solutions)).setGraphStreamFrameScalingFactor(1.5).setCameraView(12500, 55000, 0.25).labelWith(Label.ACTIVITY).setRenderShipments(true).setRenderDelay(150).display();
} }