Skip to content

Conversation

@mark-idleman
Copy link

@mark-idleman mark-idleman commented Aug 5, 2025

Background

In order to support the new "realtime closures" endpoint that utilizes query-time custom models to close particular links to the router via stable edge ID, we need a routing endpoint that

  1. works similarly to the existing street routing endpoint to return many route alternatives, if one wishes (ie, for the mode you pass in, it returns routes for all profiles prefixed by that mode)
  2. allows custom model JSON strings to be passed in as part of each routing request

At first, I made a branch modifying the current custom route endpoint (what we use in the router sandbox to support "live" custom model queries) to support item 1) above, the combining of routes from multiple mode-prefixed routing profiles to increase route diversity.

But then, I realized that both of the above items could be achieved by simply updating our standard street routing endpoint to accept custom model inputs, optionally. This would give us 1) and 2) above much more simply, and allows us to deprecate the custom route endpoint for a cleaner setup.

Update 8/13: Usage of this new endpoint is in https://github.com/replicahq/model/pull/9594, which introduces a new "realtime closure" endpoint to our python graphhopper client

Changes

  • Updated our pointer to idls to point to https://github.com/replicahq/idls/pull/116, which updates the StreetRouteRequest and ProfilesStreetRouteRequest endpoints to accept custom model JSON strings (and marks the existing CustomRouteRequest as deprecated)
  • Removes all code that supported the CustomRouteRequest endpoint; I'm leaving the endpoint "available" still for a safer transition, but any calls to the endpoint will now throw an error that mentions it was deprecated
  • Update the street routing endpoint to optionally accept custom model JSON strings. In the case where a custom model is present in a routing request, the model is parsed and contraction hierarchies are turned off for that request (ie, exactly what we had been doing in the custom routing endpoint). Routing then carries on as it had been (including combining of results from multiple mode-prefixed profiles, if applicable)
  • Update the endpoint called by the routing GUI when you open the Use Custom Model dialog box and type out a custom model to be used in your routing request - it now points to the street routing endpoint, vs. the now-deprecated custom route endpoint

Testing

  • FT passed off of this branch with 100% match rate for auto routing; ie, standard street routing endpoint behavior is unchanged
  • Manually-built MNC router using new router image tag from this branch allows you to send custom models via GUI, and routes are responsive to the models you've defined
    • Also, checking in chrome dev console, I can see routes returned from multiple auto profiles when custom models are used, so combining of routes from same-mode profiles is working when custom models are passed in
  • Built new router sandbox using router image tag from this branch, and it functions as expected

Other notes

I purposefully didn't discuss performance details here, along with a few other subtleties I learned about the custom model feature in graphhopper. More to come on these details in the forthcoming model repo PR where I utilize the change here to add a "realtime closure" endpoint to our graphhopper python client.

CC

@rregue

@mark-idleman mark-idleman changed the title Enable custom models to be passed to street route endpoint; deprecate custom route endpoint Enable custom models to be passed to street route endpoint Aug 5, 2025
@mark-idleman mark-idleman marked this pull request as ready for review August 5, 2025 23:28
Copy link

@sudatta-mohanty sudatta-mohanty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really cool to use the custom model inputs itself for achieving the new router behavior! Gives a lot of flexibility for choosing which router to use on a per query basis.

@mark-idleman mark-idleman merged commit 787f9bf into original-direction Aug 13, 2025
1 check passed
@mark-idleman mark-idleman deleted the realtime_closure_endpoint_take_2 branch August 13, 2025 23:45
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.

3 participants