mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
add bad job list
This commit is contained in:
parent
632a889c4b
commit
62331ccfd9
15 changed files with 167 additions and 117 deletions
|
|
@ -245,7 +245,7 @@ public class BicycleMessenger {
|
|||
VehicleRoutingTransportCosts routingCosts = new CrowFlyCosts(problemBuilder.getLocations()); //which is the default VehicleRoutingTransportCosts in builder above
|
||||
problemBuilder.setRoutingCost(routingCosts);
|
||||
//finally build the problem
|
||||
problemBuilder.addPenaltyVehicles(20.0,50000);
|
||||
// problemBuilder.addPenaltyVehicles(20.0,50000);
|
||||
VehicleRoutingProblem bicycleMessengerProblem = problemBuilder.build();
|
||||
|
||||
/*
|
||||
|
|
@ -272,10 +272,10 @@ public class BicycleMessenger {
|
|||
vraBuilder.addDefaultCostCalculators();
|
||||
vraBuilder.setStateAndConstraintManager(stateManager, constraintManager);
|
||||
VehicleRoutingAlgorithm algorithm = vraBuilder.build();
|
||||
algorithm.setNuOfIterations(2000);
|
||||
algorithm.setMaxIterations(2000);
|
||||
VariationCoefficientTermination prematureAlgorithmTermination = new VariationCoefficientTermination(200, 0.001);
|
||||
algorithm.setPrematureAlgorithmTermination(prematureAlgorithmTermination);
|
||||
algorithm.addListener(prematureAlgorithmTermination);
|
||||
// algorithm.setPrematureAlgorithmTermination(prematureAlgorithmTermination);
|
||||
// algorithm.addListener(prematureAlgorithmTermination);
|
||||
// algorithm.addListener(new AlgorithmSearchProgressChartListener("output/progress.png"));
|
||||
|
||||
//search
|
||||
|
|
@ -294,7 +294,8 @@ public class BicycleMessenger {
|
|||
|
||||
//and the problem as well as the solution
|
||||
Plotter plotter1 = new Plotter(bicycleMessengerProblem, Solutions.bestOf(solutions));
|
||||
plotter1.plotShipments(false);
|
||||
plotter1.setLabel(Plotter.Label.ID);
|
||||
plotter1.plotShipments(false);
|
||||
// plotter1.setBoundingBox(5000, 45500, 25000, 66500);
|
||||
plotter1.plot("output/bicycleMessengerSolution.png", "bicycleMessenger");
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ public class MultipleDepotExampleWithPenaltyVehicles {
|
|||
*
|
||||
* each with 14 vehicles each with a capacity of 500 and a maximum duration of 310
|
||||
*/
|
||||
int nuOfVehicles = 14;
|
||||
int nuOfVehicles = 13;
|
||||
int capacity = 500;
|
||||
double maxDuration = 310;
|
||||
Coordinate firstDepotCoord = Coordinate.newInstance(-33, 33);
|
||||
|
|
@ -68,7 +68,8 @@ public class MultipleDepotExampleWithPenaltyVehicles {
|
|||
int depotCounter = 1;
|
||||
for(Coordinate depotCoord : Arrays.asList(firstDepotCoord,second)){
|
||||
for(int i=0;i<nuOfVehicles;i++){
|
||||
VehicleType vehicleType = VehicleTypeImpl.Builder.newInstance(depotCounter + "_type").addCapacityDimension(0, capacity).setCostPerDistance(1.0).build();
|
||||
VehicleType vehicleType = VehicleTypeImpl.Builder.newInstance(depotCounter + "_type")
|
||||
.addCapacityDimension(0, capacity).setFixedCost(100.).setCostPerDistance(1.0).build();
|
||||
String vehicleId = depotCounter + "_" + (i+1) + "_vehicle";
|
||||
VehicleImpl.Builder vehicleBuilder = VehicleImpl.Builder.newInstance(vehicleId);
|
||||
vehicleBuilder.setStartLocationCoordinate(depotCoord);
|
||||
|
|
@ -83,7 +84,7 @@ public class MultipleDepotExampleWithPenaltyVehicles {
|
|||
/*
|
||||
* define penalty-type with the same id, but other higher fixed and variable costs
|
||||
*/
|
||||
vrpBuilder.addPenaltyVehicles(3, 50);
|
||||
// vrpBuilder.addPenaltyVehicles(3, 50);
|
||||
|
||||
/*
|
||||
* define problem with finite fleet
|
||||
|
|
@ -104,7 +105,7 @@ public class MultipleDepotExampleWithPenaltyVehicles {
|
|||
* solve the problem
|
||||
*/
|
||||
VehicleRoutingAlgorithm vra = VehicleRoutingAlgorithms.readAndCreateAlgorithm(vrp, "input/algorithmConfig.xml");
|
||||
vra.setNuOfIterations(5000);
|
||||
vra.setMaxIterations(2000);
|
||||
vra.getAlgorithmListeners().addListener(new StopWatch(),Priority.HIGH);
|
||||
vra.getAlgorithmListeners().addListener(new AlgorithmSearchProgressChartListener("output/progress.png"));
|
||||
Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue