one way is to create your own Vehicle Routing Cost matrix. Have a look at the VehicleRoutingTransportCostsMatrix you should be able to easily adapt for your needs.
Hi Chris,
thanks for your reply,
thats interesting, but I think that does not help.
The Question is how to calculate the tour cost (profit-function) of one vehicle with many stops and the first (cost) time window (e.g. 5 hours) are over and the timedependent costs after this are getting higher, but not the cost for one long distance beween two stops.
It’s a long time ago. We used the SolutionCostCalculator and overriding getCosts and calculate manually every cost for every solution , e.g. like this.
SolutionCostCalculator solutionCostCalculator = new SolutionCostCalculator() {
@Override
public double getCosts(VehicleRoutingProblemSolution solution) {
double costs = 0.0;
for (VehicleRoute route : solution.getRoutes()) {
// add fixed cost of the vehicle
costs += route.getVehicle().getType().getVehicleCostParams().fix;
TourActivity prevAct = route.getStart();
for (TourActivity act : route.getActivities()) {
costs += problem.getTransportCosts().getTransportCost(prevAct.getLocation(), act.getLocation(),
prevAct.getEndTime(), route.getDriver(), route.getVehicle());
prevAct = act;
}
}
return costs;
}
};
But the truth is, that we dismissed this approach an build our own solver…
Kind regards.