mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
introduce SolutionCostCalculator
This commit is contained in:
parent
2ac272ba79
commit
b37064ec17
5 changed files with 14 additions and 9 deletions
|
|
@ -189,8 +189,8 @@ class StateUpdates {
|
|||
double transportCost = this.transportCost.getTransportCost(prevAct.getLocationId(), act.getLocationId(), startTimeAtPrevAct, vehicleRoute.getDriver(), vehicleRoute.getVehicle());
|
||||
double actCost = activityCost.getActivityCost(act, timeTracker.getActArrTime(), vehicleRoute.getDriver(), vehicleRoute.getVehicle());
|
||||
|
||||
// vehicleRoute.getVehicleRouteCostCalculator().addTransportCost(transportCost);
|
||||
// vehicleRoute.getVehicleRouteCostCalculator().addActivityCost(actCost);
|
||||
vehicleRoute.getVehicleRouteCostCalculator().addTransportCost(transportCost);
|
||||
vehicleRoute.getVehicleRouteCostCalculator().addActivityCost(actCost);
|
||||
|
||||
totalOperationCost += transportCost;
|
||||
totalOperationCost += actCost;
|
||||
|
|
@ -207,8 +207,8 @@ class StateUpdates {
|
|||
double transportCost = this.transportCost.getTransportCost(prevAct.getLocationId(), vehicleRoute.getEnd().getLocationId(), startTimeAtPrevAct, vehicleRoute.getDriver(), vehicleRoute.getVehicle());
|
||||
double actCost = activityCost.getActivityCost(vehicleRoute.getEnd(), timeTracker.getActEndTime(), vehicleRoute.getDriver(), vehicleRoute.getVehicle());
|
||||
|
||||
// vehicleRoute.getVehicleRouteCostCalculator().addTransportCost(transportCost);
|
||||
// vehicleRoute.getVehicleRouteCostCalculator().addActivityCost(actCost);
|
||||
vehicleRoute.getVehicleRouteCostCalculator().addTransportCost(transportCost);
|
||||
vehicleRoute.getVehicleRouteCostCalculator().addActivityCost(actCost);
|
||||
|
||||
totalOperationCost += transportCost;
|
||||
totalOperationCost += actCost;
|
||||
|
|
@ -216,10 +216,10 @@ class StateUpdates {
|
|||
|
||||
states.putRouteState(vehicleRoute, StateTypes.COSTS, new StateImpl(totalOperationCost));
|
||||
|
||||
//this is rather strange and likely to change
|
||||
// vehicleRoute.getVehicleRouteCostCalculator().price(vehicleRoute.getDriver());
|
||||
// vehicleRoute.getVehicleRouteCostCalculator().price(vehicleRoute.getVehicle());
|
||||
// vehicleRoute.getVehicleRouteCostCalculator().finish();
|
||||
// this is rather strange and likely to change
|
||||
vehicleRoute.getVehicleRouteCostCalculator().price(vehicleRoute.getDriver());
|
||||
vehicleRoute.getVehicleRouteCostCalculator().price(vehicleRoute.getVehicle());
|
||||
vehicleRoute.getVehicleRouteCostCalculator().finish();
|
||||
|
||||
startTimeAtPrevAct = 0.0;
|
||||
prevAct = null;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import basics.VehicleRoutingProblemSolution;
|
|||
public interface SolutionCostCalculator {
|
||||
|
||||
/**
|
||||
* This modifies the solution by setting its costs <br>
|
||||
* This assumes that the solution is modified by setting its costs <br>
|
||||
* <code>solution.setCost(costs);</code>
|
||||
* @param solution
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -84,8 +84,10 @@ public class VehicleRoute {
|
|||
|
||||
private End end;
|
||||
|
||||
@Deprecated
|
||||
private VehicleRouteCostCalculator costCalculator = new DefaultVehicleRouteCostCalculator();
|
||||
|
||||
@Deprecated
|
||||
public VehicleRouteCostCalculator getVehicleRouteCostCalculator(){
|
||||
return costCalculator;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue