Skip to content

feat: Use "natural" stop sequences to condense GL derived limits #1271

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jzimbel-mbta
Copy link
Member

Summary of changes

Asana Ticket: 🏹 Improve limits derivation for complex GL disruptions

Summary of change

The overall idea is to compare stops visited by exported service against "natural" stop sequences, instead of canonical stop sequences.

For example, a disruption extending from Babcock to North Station is not possible to describe against one GL route's stop sequence because Green-B turns around at Gov Ctr. The old logic would produce 2 (or more) limits for this--Babcock to Gov Ctr, and Gov Ctr to North Station.

The new logic uses @arkadyan's unrooted_polytree data structure to convert a set of canonical stop sequences for a line to a set of "natural" stop sequences that represent the longest possible runs from one end of the line to the other, ignoring how many intra-line transfers you'd need to make.

Then, we compare exported service against these and do some additional steps to condense the resulting limits into a minimal number of maximally-long segments.

Example

Here's how this improves limits derivation for 2025-spring-GLBabcockNorthStation-v2.zip -- see associated asana ticket

Left is output of the existing logic in main branch, right is output of the new logic.
image

TO DO

  • Update ExportUploadTest.build_gtfs/1 to add platform <-> parent station relations for all inserted stops, since these are required by the new logic.

Reviewer Checklist

  • Meets ticket's acceptance criteria
  • Any new or changed functions have typespecs
  • Tests were added for any new functionality (don't just rely on Codecov)
  • This branch was deployed to the staging environment and is currently running with no unexpected increase in warnings, and no errors or crashes.

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