GraphHopper.com | Forum | GitHub | Maps | Blog

Non linear cost function


#1

Hi,
I try to build a cost functon of a vehicle with dynamic costs. Until now I use:

  • setFixedCost(double)
  • setCostPerDistance(double)
  • setCostPerTransportTime(double)

Problem: e.G. between 0-5 hours threre are costs of X, later after 5 additional costs of Y (extra charge by time).

Formula for a vehicle: fixCost + (TransportTime * dynCostPrice) + (additionalTime * extraChargePrice)

Is it possible to represent this? How?

Kind regards
Volker


#2

Hi Volker,

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.

Best
Chris


#3

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.

Regards
Volker