matsim-libs icon indicating copy to clipboard operation
matsim-libs copied to clipboard

error-prone pre-processed data caching in path calculator factories

Open michalmac opened this issue 4 years ago • 0 comments

Maybe this is known and already reported somewhere. Many LeastCostPathCalculators do some pre-processing inside the createPathCalculator(Network , TravelDisutility, TravelTime) method and store the outcome for later reuse during subsequent calls to that method.

The main problem with this setup is that the pre-processed data D is stored in a Map<Network, D> while at the same time the pre-processing depends not only on the network, but also on travel disutility (and potentially on travel time - unless we use the time-independent minimum disutility). So if we call the method again with the same network but with a different disutility functions, we will (incorrectly) reuse the data computed with the original disutility function.

Before trying to fix that issue (not sure if there is an easy/obvious fix though), I wonder if the whole caching of pre-processed data is worth the effort.

michalmac avatar Sep 17 '21 14:09 michalmac