mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
modify solutionCostCalculation internally
This commit is contained in:
parent
432f2073d0
commit
fe0e0f54b0
3 changed files with 18 additions and 5 deletions
|
|
@ -212,7 +212,7 @@ class StateUpdates {
|
|||
|
||||
totalOperationCost += transportCost;
|
||||
totalOperationCost += actCost;
|
||||
totalOperationCost += getFixCosts();
|
||||
// totalOperationCost += getFixCosts();
|
||||
|
||||
states.putRouteState(vehicleRoute, StateTypes.COSTS, new StateImpl(totalOperationCost));
|
||||
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ import basics.algo.VehicleRoutingAlgorithmListeners.PrioritizedVRAListener;
|
|||
import basics.algo.VehicleRoutingAlgorithmListeners.Priority;
|
||||
import basics.io.AlgorithmConfig;
|
||||
import basics.io.AlgorithmConfigXmlReader;
|
||||
import basics.route.Vehicle;
|
||||
import basics.route.VehicleRoute;
|
||||
|
||||
|
||||
|
|
@ -536,10 +537,16 @@ public class VehicleRoutingAlgorithms {
|
|||
public void calculateCosts(VehicleRoutingProblemSolution solution) {
|
||||
double costs = 0.0;
|
||||
for(VehicleRoute route : solution.getRoutes()){
|
||||
costs += stateManager.getRouteState(route, StateTypes.COSTS).toDouble();
|
||||
costs += stateManager.getRouteState(route, StateTypes.COSTS).toDouble() + getFixedCosts(route.getVehicle());
|
||||
}
|
||||
solution.setCost(costs);
|
||||
}
|
||||
|
||||
private double getFixedCosts(Vehicle vehicle) {
|
||||
if(vehicle == null) return 0.0;
|
||||
if(vehicle.getType() == null) return 0.0;
|
||||
return vehicle.getType().getVehicleCostParams().fix;
|
||||
}
|
||||
};
|
||||
return calc;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue