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

further refinements

This commit is contained in:
oblonski 2013-06-20 17:25:53 +02:00
parent 665b4a8970
commit 5eaa288735
5 changed files with 32 additions and 15 deletions

View file

@ -46,7 +46,7 @@
</module>
</modules>
<probability>0.5</probability>
<probability>0.3</probability>
</searchStrategy>
<searchStrategy name="radialRuinAndRecreate">
@ -61,7 +61,22 @@
</module>
</modules>
<probability>0.5</probability>
<probability>0.3</probability>
</searchStrategy>
<searchStrategy name="radialRuinAndRecreate">
<selector name="selectBest"/>
<acceptor name="schrimpfAcceptance"/>
<modules>
<module name="ruin_and_recreate">
<ruin name="radialRuin" id="1">
<share>0.1</share>
</ruin>
<insertion name="bestInsertion"/>
</module>
</modules>
<probability>0.4</probability>
</searchStrategy>
</searchStrategies>

View file

@ -56,7 +56,7 @@ public class ConcurrentMultipleDepotExampleWithPenaltyVehicles {
int depotCounter = 1;
for(Coordinate depotCoord : Arrays.asList(firstDepotCoord,second)){
for(int i=0;i<nuOfVehicles;i++){
VehicleType vehicleType = VehicleType.Builder.newInstance(depotCounter + "_" + (i+1) + "_type", capacity).setCostPerDistance(1.0).build();
VehicleType vehicleType = VehicleType.Builder.newInstance(depotCounter + "_type", capacity).setCostPerDistance(1.0).build();
String vehicleId = depotCounter + "_" + (i+1) + "_vehicle";
VehicleImpl.VehicleBuilder vehicleBuilder = VehicleImpl.VehicleBuilder.newInstance(vehicleId);
vehicleBuilder.setLocationCoord(depotCoord);
@ -65,16 +65,16 @@ public class ConcurrentMultipleDepotExampleWithPenaltyVehicles {
Vehicle vehicle = vehicleBuilder.build();
vrpBuilder.addVehicle(vehicle);
}
for(int i=0;i<nuOfPenaltyVehicles;i++){
VehicleType penaltyType = VehicleType.Builder.newInstance(depotCounter + "_" + (i+1) + "_penaltyType", capacity).setFixedCost(50).setCostPerDistance(3.0).build();
String vehicleId = depotCounter + "_" + (i+1) + "_penaltyVehicle";
// for(int i=0;i<nuOfPenaltyVehicles;i++){
VehicleType penaltyType = VehicleType.Builder.newInstance(depotCounter + "_type#penalty", capacity).setFixedCost(50).setCostPerDistance(3.0).build();
String vehicleId = depotCounter + "_vehicle#penalty";
VehicleImpl.VehicleBuilder vehicleBuilder = VehicleImpl.VehicleBuilder.newInstance(vehicleId);
vehicleBuilder.setLocationCoord(depotCoord);
vehicleBuilder.setType(penaltyType);
vehicleBuilder.setLatestArrival(maxDuration);
Vehicle penaltyVehicle = vehicleBuilder.build();
vrpBuilder.addVehicle(penaltyVehicle);
}
// }
depotCounter++;
}

View file

@ -53,7 +53,7 @@ public class MultipleDepotExample {
int depotCounter = 1;
for(Coordinate depotCoord : Arrays.asList(firstDepotCoord,second,third,fourth)){
for(int i=0;i<nuOfVehicles;i++){
VehicleType vehicleType = VehicleType.Builder.newInstance(depotCounter + "_" + (i+1) + "_type", capacity).setCostPerDistance(1.0).build();
VehicleType vehicleType = VehicleType.Builder.newInstance(depotCounter + "_type", capacity).setCostPerDistance(1.0).build();
Vehicle vehicle = VehicleImpl.VehicleBuilder.newInstance(depotCounter + "_" + (i+1) + "_vehicle").setLocationCoord(depotCoord).setType(vehicleType).build();
vrpBuilder.addVehicle(vehicle);
}
@ -81,7 +81,7 @@ public class MultipleDepotExample {
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfig.xml");
vra.setNuOfIterations(10000);
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();
SolutionPrinter.print(Solutions.getBest(solutions));

View file

@ -54,7 +54,7 @@ public class MultipleDepotExampleWithPenaltyVehicles {
int depotCounter = 1;
for(Coordinate depotCoord : Arrays.asList(firstDepotCoord,second)){
for(int i=0;i<nuOfVehicles;i++){
VehicleType vehicleType = VehicleType.Builder.newInstance(depotCounter + "_" + (i+1) + "_type", capacity).setCostPerDistance(1.0).build();
VehicleType vehicleType = VehicleType.Builder.newInstance(depotCounter + "_type", capacity).setCostPerDistance(1.0).build();
String vehicleId = depotCounter + "_" + (i+1) + "_vehicle";
VehicleImpl.VehicleBuilder vehicleBuilder = VehicleImpl.VehicleBuilder.newInstance(vehicleId);
vehicleBuilder.setLocationCoord(depotCoord);
@ -63,16 +63,16 @@ public class MultipleDepotExampleWithPenaltyVehicles {
Vehicle vehicle = vehicleBuilder.build();
vrpBuilder.addVehicle(vehicle);
}
for(int i=0;i<nuOfPenaltyVehicles;i++){
VehicleType penaltyType = VehicleType.Builder.newInstance(depotCounter + "_" + (i+1) + "_type#penalty", capacity).setFixedCost(50).setCostPerDistance(3.0).build();
String vehicleId = depotCounter + "_" + (i+1) + "_vehicle#penalty";
// for(int i=0;i<nuOfPenaltyVehicles;i++){
VehicleType penaltyType = VehicleType.Builder.newInstance(depotCounter + "_type#penalty", capacity).setFixedCost(50).setCostPerDistance(3.0).build();
String vehicleId = depotCounter + "_vehicle#penalty";
VehicleImpl.VehicleBuilder vehicleBuilder = VehicleImpl.VehicleBuilder.newInstance(vehicleId);
vehicleBuilder.setLocationCoord(depotCoord);
vehicleBuilder.setType(penaltyType);
vehicleBuilder.setLatestArrival(maxDuration);
Vehicle penaltyVehicle = vehicleBuilder.build();
vrpBuilder.addVehicle(penaltyVehicle);
}
// }
depotCounter++;
}
@ -91,7 +91,7 @@ public class MultipleDepotExampleWithPenaltyVehicles {
/*
* plot to see how the problem looks like
*/
SolutionPlotter.plotVrpAsPNG(vrp, "output/problem08.png", "p08");
// SolutionPlotter.plotVrpAsPNG(vrp, "output/problem08.png", "p08");
/*
* solve the problem