1
0
Fork 0
mirror of https://github.com/graphhopper/jsprit.git synced 2020-01-24 07:45:05 +01:00

Merge branch 'master' into relaxAPI

Conflicts:
	jsprit-core/src/main/java/algorithms/StateUpdates.java
	jsprit-core/src/main/java/algorithms/VehicleRoutingAlgorithms.java
	jsprit-core/src/test/java/algorithms/GendreauPostOptTest.java
This commit is contained in:
Stefan Schroeder 2013-10-10 15:03:58 +02:00
commit b0d0736c22
4 changed files with 294 additions and 4 deletions

View file

@ -187,7 +187,9 @@ public class GendreauPostOptTest {
// routes.add(new VehicleRoute(getEmptyTour(),getDriver(),getNoVehicle()));
// routes.add(new VehicleRoute(getEmptyTour(),getDriver(),getNoVehicle()));
VehicleRoutingProblemSolution sol = new VehicleRoutingProblemSolution(routes, states.getRouteState(route, StateIdFactory.COSTS).toDouble());
VehicleRoutingProblemSolution sol = new VehicleRoutingProblemSolution(routes, states.getRouteState(route, StateIdFactory.COSTS).toDouble() + getFixedCosts(routes));
assertEquals(110.0, sol.getCost(), 0.5);
@ -209,10 +211,18 @@ public class GendreauPostOptTest {
assertEquals(80.0,newSolution.getCost(),0.5);
}
private double getFixedCosts(Collection<VehicleRoute> routes) {
double c = 0.0;
for(VehicleRoute r : routes){ c += r.getVehicle().getType().getVehicleCostParams().fix; }
return c;
}
private double getCosts(VehicleRoutingProblemSolution newSolution, StateManagerImpl states) {
double c = 0.0;
for(VehicleRoute r : newSolution.getRoutes()){
c += states.getRouteState(r, StateIdFactory.COSTS).toDouble();
c += states.getRouteState(r, StateIdFactory.COSTS).toDouble() + r.getVehicle().getType().getVehicleCostParams().fix;
}
return c;
}