reinterpretcat / vrp

A Vehicle Routing Problem solver
https://reinterpretcat.github.io/vrp/
Apache License 2.0
331 stars 68 forks source link

Option to provide custom costs matrix #132

Open ilibar-zpt opened 9 months ago

ilibar-zpt commented 9 months ago

Would be great to have an option to provide a custom costs matrix alongside travelTimes and distances.

As far as I understand using custom costs matrix is the only viable way to explicitly disincentivize taking frequent A->B routes without affecting either distances or times calculation.

In case such a matrix is provided then fleet.vehicles.costs.{distance,time} should be ignored/disallowed.

reinterpretcat commented 9 months ago

That's possible to do, however, technically, solver uses not only cost calculated as linear combination of time and distance, but additionally applies some penalties to guide search in proper direction (specified by local objectives which might be different from global ones).

Maybe you can give a bit more insights what kind of the problem you need to solve with custom costs.

ilibar-zpt commented 9 months ago
  1. Arbitrary business requirements like "we want to reduce amount of warehouse visits by same vehicle", where constructing less optimal set of tours is preferable than doing multiple pickup rounds by same vehicle
  2. Actually modelling toll roads effect on final route costs
reinterpretcat commented 9 months ago

I think the easiest and less surprising way would be to model these costs not like replacement of duration/distance, but rather add it on top. This could be done relatively easily I guess.

ilibar-zpt commented 9 months ago

Yeah, that should do