mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
relax api
This commit is contained in:
parent
b0d0736c22
commit
2c26e0041f
2 changed files with 11 additions and 9 deletions
|
|
@ -6,7 +6,7 @@ import basics.route.TourActivity;
|
|||
import basics.route.Vehicle;
|
||||
import basics.route.VehicleRoute;
|
||||
|
||||
class ActivityTimeTracker implements ActivityVisitor{
|
||||
public class ActivityTimeTracker implements ActivityVisitor{
|
||||
|
||||
private ForwardTransportTime transportTime;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package algorithms;
|
||||
|
||||
import basics.VehicleRoutingProblem;
|
||||
import basics.VehicleRoutingProblem.FleetSize;
|
||||
|
||||
public class BestInsertionBuilder implements InsertionStrategyBuilder{
|
||||
|
||||
|
|
@ -15,6 +14,10 @@ public class BestInsertionBuilder implements InsertionStrategyBuilder{
|
|||
|
||||
private VehicleFleetManager fleetManager;
|
||||
|
||||
private double weightOfFixedCosts;
|
||||
|
||||
private boolean considerFixedCosts = false;
|
||||
|
||||
public BestInsertionBuilder(VehicleRoutingProblem vrp, StateManager stateManager) {
|
||||
super();
|
||||
this.vrp = vrp;
|
||||
|
|
@ -36,6 +39,11 @@ public class BestInsertionBuilder implements InsertionStrategyBuilder{
|
|||
local = true;
|
||||
};
|
||||
|
||||
public void considerFixedCosts(double weightOfFixedCosts){
|
||||
this.weightOfFixedCosts = weightOfFixedCosts;
|
||||
this.considerFixedCosts = true;
|
||||
}
|
||||
|
||||
public void setFleetManager(VehicleFleetManager fleetManager){
|
||||
this.fleetManager = fleetManager;
|
||||
}
|
||||
|
|
@ -52,15 +60,9 @@ public class BestInsertionBuilder implements InsertionStrategyBuilder{
|
|||
calcBuilder.setStates(stateManager);
|
||||
calcBuilder.setVehicleRoutingProblem(vrp);
|
||||
calcBuilder.setVehicleFleetManager(fleetManager);
|
||||
if(considerFixedCosts) calcBuilder.considerFixedCosts(weightOfFixedCosts);
|
||||
JobInsertionCalculator jobInsertions = calcBuilder.build();
|
||||
return new BestInsertion(jobInsertions);
|
||||
}
|
||||
|
||||
private VehicleFleetManager createFleetManager(VehicleRoutingProblem vrp) {
|
||||
if(vrp.getFleetSize().equals(FleetSize.INFINITE)){
|
||||
return new InfiniteVehicles(vrp.getVehicles());
|
||||
}
|
||||
else return new VehicleFleetManagerImpl(vrp.getVehicles());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue