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
|
|
@ -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