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
|
|
@ -65,6 +65,8 @@ public class SolutionPrinter {
|
||||||
*
|
*
|
||||||
* @param solution
|
* @param solution
|
||||||
* @param level
|
* @param level
|
||||||
|
*
|
||||||
|
* @deprecated is not going to work anymore
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void print(VehicleRoutingProblemSolution solution, Print level){
|
public static void print(VehicleRoutingProblemSolution solution, Print level){
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@
|
||||||
<groupId>xerces</groupId>
|
<groupId>xerces</groupId>
|
||||||
<artifactId>xerces</artifactId>
|
<artifactId>xerces</artifactId>
|
||||||
<version>2.4.0</version>
|
<version>2.4.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -189,8 +189,8 @@ class StateUpdates {
|
||||||
double transportCost = this.transportCost.getTransportCost(prevAct.getLocationId(), act.getLocationId(), startTimeAtPrevAct, vehicleRoute.getDriver(), vehicleRoute.getVehicle());
|
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());
|
double actCost = activityCost.getActivityCost(act, timeTracker.getActArrTime(), vehicleRoute.getDriver(), vehicleRoute.getVehicle());
|
||||||
|
|
||||||
// vehicleRoute.getVehicleRouteCostCalculator().addTransportCost(transportCost);
|
vehicleRoute.getVehicleRouteCostCalculator().addTransportCost(transportCost);
|
||||||
// vehicleRoute.getVehicleRouteCostCalculator().addActivityCost(actCost);
|
vehicleRoute.getVehicleRouteCostCalculator().addActivityCost(actCost);
|
||||||
|
|
||||||
totalOperationCost += transportCost;
|
totalOperationCost += transportCost;
|
||||||
totalOperationCost += actCost;
|
totalOperationCost += actCost;
|
||||||
|
|
@ -207,8 +207,8 @@ class StateUpdates {
|
||||||
double transportCost = this.transportCost.getTransportCost(prevAct.getLocationId(), vehicleRoute.getEnd().getLocationId(), startTimeAtPrevAct, vehicleRoute.getDriver(), vehicleRoute.getVehicle());
|
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());
|
double actCost = activityCost.getActivityCost(vehicleRoute.getEnd(), timeTracker.getActEndTime(), vehicleRoute.getDriver(), vehicleRoute.getVehicle());
|
||||||
|
|
||||||
// vehicleRoute.getVehicleRouteCostCalculator().addTransportCost(transportCost);
|
vehicleRoute.getVehicleRouteCostCalculator().addTransportCost(transportCost);
|
||||||
// vehicleRoute.getVehicleRouteCostCalculator().addActivityCost(actCost);
|
vehicleRoute.getVehicleRouteCostCalculator().addActivityCost(actCost);
|
||||||
|
|
||||||
totalOperationCost += transportCost;
|
totalOperationCost += transportCost;
|
||||||
totalOperationCost += actCost;
|
totalOperationCost += actCost;
|
||||||
|
|
@ -217,9 +217,9 @@ class StateUpdates {
|
||||||
states.putRouteState(vehicleRoute, StateTypes.COSTS, new StateImpl(totalOperationCost));
|
states.putRouteState(vehicleRoute, StateTypes.COSTS, new StateImpl(totalOperationCost));
|
||||||
|
|
||||||
// this is rather strange and likely to change
|
// this is rather strange and likely to change
|
||||||
// vehicleRoute.getVehicleRouteCostCalculator().price(vehicleRoute.getDriver());
|
vehicleRoute.getVehicleRouteCostCalculator().price(vehicleRoute.getDriver());
|
||||||
// vehicleRoute.getVehicleRouteCostCalculator().price(vehicleRoute.getVehicle());
|
vehicleRoute.getVehicleRouteCostCalculator().price(vehicleRoute.getVehicle());
|
||||||
// vehicleRoute.getVehicleRouteCostCalculator().finish();
|
vehicleRoute.getVehicleRouteCostCalculator().finish();
|
||||||
|
|
||||||
startTimeAtPrevAct = 0.0;
|
startTimeAtPrevAct = 0.0;
|
||||||
prevAct = null;
|
prevAct = null;
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import basics.VehicleRoutingProblemSolution;
|
||||||
public interface SolutionCostCalculator {
|
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>
|
* <code>solution.setCost(costs);</code>
|
||||||
* @param solution
|
* @param solution
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -84,8 +84,10 @@ public class VehicleRoute {
|
||||||
|
|
||||||
private End end;
|
private End end;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
private VehicleRouteCostCalculator costCalculator = new DefaultVehicleRouteCostCalculator();
|
private VehicleRouteCostCalculator costCalculator = new DefaultVehicleRouteCostCalculator();
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public VehicleRouteCostCalculator getVehicleRouteCostCalculator(){
|
public VehicleRouteCostCalculator getVehicleRouteCostCalculator(){
|
||||||
return costCalculator;
|
return costCalculator;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue