Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: customizable distance calculators for drt constraints #2971

Merged
merged 1 commit into from
Nov 30, 2023

Conversation

sebhoerl
Copy link
Contributor

@sebhoerl sebhoerl commented Nov 29, 2023

This PR makes it easy to further experiment with the distance objective and range constraint that comes with drt-extensions/insertion. It is now possible to flexibly configure the distance calculator with a custom logic. Furthermore, the distance approximator can be defined. While the calculator is used in the distance objective, both of them are used in the range constraint: If an approximator is defined (but it is optional), the range constraint is first evaluated with the approximator, which should be pessimistic. Only if a violation of the constraint is detected using this pessmistic (i.e. overestimating) setting, the more exact calculator is used that will perform a direct network routing by default. Both elements can now be configured by:

DrtInsertionModule insertionModule = new DrtInsertionModule(drtConfig) //
  .withVehicleRange(100.0 * 1e3) //
  .withDistanceCalculator(distanceCalculator) //
  .withDistanceApproximator(distanceApproximator);

The values passed can either be an instance of DistanceCalculator and DistanceApproximator, or they can be a class name, then a modal binding needs to be provided somewhere (see example in the unit tests).

@sebhoerl sebhoerl changed the title feat: customizable distance calculatorsfor drt constraints feat: customizable distance calculators for drt constraints Nov 30, 2023
@sebhoerl sebhoerl merged commit 38ad994 into master Nov 30, 2023
48 checks passed
@sebhoerl sebhoerl deleted the feat/drt-custom-insertion-distances branch November 30, 2023 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant