feat(dvrp): cached free-speed matrices #3567
Merged
+236
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When working with large scenarios, calculating the dvrp global and mode-specific free-speed matrices takes a lot of time, especially when parametric studies are run in which this has to happen at every simulation start-up.
This PR introduces the possibility to cache the calculated free-speed matrices using the
cachePath
parameter in the respectiveDvrpTravelTimeMatrixParams
. If the file does not exist, the matrix calculation is performed as usual and saved. If the file exists already, the matrix is read from the file. This way, when setting a global path, the calculation will be performed once in the parametric simulation series and then only read for all subsequent runs. There are various verifications included in the reading code to make sure that the travel times contained in the source file correspond to the present network and zoning system. The matrices are saved in a condensed custom binary format. Unit tests are provided.