vrp icon indicating copy to clipboard operation
vrp copied to clipboard

Option to provide custom costs matrix

Open ilibar-zpt opened this issue 2 years ago • 4 comments

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.

ilibar-zpt avatar Sep 26 '23 12:09 ilibar-zpt

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.

reinterpretcat avatar Sep 26 '23 21:09 reinterpretcat

  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

ilibar-zpt avatar Sep 26 '23 21:09 ilibar-zpt

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.

reinterpretcat avatar Sep 27 '23 07:09 reinterpretcat

Yeah, that should do

ilibar-zpt avatar Sep 27 '23 09:09 ilibar-zpt