Skip to content

fix(routing): respect vehicle breaks edge-cases - #1197

Draft
np96 wants to merge 1 commit into
NVIDIA:mainfrom
np96:fix/unreachable-break-infeasibility
Draft

np96 wants to merge 1 commit into
NVIDIA:mainfrom
np96:fix/unreachable-break-infeasibility

Conversation

@np96

@np96 np96 commented May 11, 2026 •

Copy link
Copy Markdown
Contributor

Description

Restore required breaks after route construction, initial-solution loading, and route changes. Skip time and distance breaks when the actual route finishes at or before their deadline, recheck skipped dimensions when another break extends the route, and remove unnecessary breaks when routes shrink.

Fixes both cases in #1195: the unreachable required break returns INFEASIBLE, and the late-break example returns cost 20 with no break stop. Configured break windows must still be compatible with the vehicle shift.

Validation: 129 local Python routing tests and 28 C++ tests passed. The two tests that grow and shrink routes with existing breaks also passed CUDA synchronization checking with zero errors. Regression coverage includes distance breaks, generated and injected routes, exact deadlines, waiting and return travel, dependent dimensions, mixed break types, and unchanged rejection of breaks outside the configured shift.

Checklist

  • I am familiar with the Contributing Guidelines.
  • Testing
    • New or existing tests cover these changes
    • Added tests
  • Documentation
    • Documentation changes are excluded from this PR

@np96
np96 requested review from a team as code owners May 11, 2026 18:39
@np96
np96 requested review from Kh4ster, rg20 and tmckayus May 11, 2026 18:39
@copy-pr-bot

copy-pr-bot Bot commented May 11, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented May 11, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds logic in route cost computation to penalize missing required breaks when both BREAK and TIME dimensions are enabled, and adds a unit test that asserts a routing instance with an unreachable required break is infeasible.

Changes

Required Break Infeasibility Penalty

Layer / File(s) Summary
Break Cost Penalty Logic
cpp/src/routing/route/route.cuh
When both BREAK and TIME dimensions are active, compute_cost estimates depot arrival, counts required breaks whose break_latest ≤ arrival, reads route-present breaks (breaks_forward[*n_nodes]), and adds positive shortfall to infeasibility_cost[0][dim_t::BREAK].
Test Validation
python/cuopt/cuopt/tests/routing/test_vehicle_properties.py
Adds test_required_break_unreachable_is_infeasible, which builds a 3-node scenario with a required break in an infeasible time window, solves, and asserts the solver returns infeasible status.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies a routing fix for vehicle-break edge cases. It is concise and related to the changeset.
Description check ✅ Passed The description directly explains the required-break handling, route changes, infeasibility behavior, and validation results covered by the changeset.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@np96
np96 force-pushed the fix/unreachable-break-infeasibility branch from a146585 to 2a4500a Compare May 12, 2026 06:30
@Kh4ster
Kh4ster removed their request for review May 18, 2026 08:01
@anandhkb anandhkb added this to the 26.08 milestone May 19, 2026
@ramakrishnap-nv
ramakrishnap-nv changed the base branch from main to release/26.06 May 20, 2026 17:32
@rg20

rg20 commented May 26, 2026

Copy link
Copy Markdown
Contributor

@np96

In the current form, I intentionally don't treat missing breaks as a violation as initial solutions are generated without breaks first and then breaks are inserted. Breaks should not be missed, I think there is some other bug in the code.

@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown

🔔 Hi @anandhkb, this pull request has had no activity for 7 days. Please update or let us know if it can be closed. Thank you!

If this is an "epic" issue, then please add the "epic" label to this issue.
If it is a PR and not ready for review, then please convert this to draft.
If you just want to switch off this notification, then use the "skip inactivity reminder" label.

@np96
np96 marked this pull request as draft June 10, 2026 16:05
@np96
np96 force-pushed the fix/unreachable-break-infeasibility branch from 49831a5 to 424ed35 Compare June 11, 2026 16:10
@chris-maes chris-maes modified the milestones: 26.08, 26.10 Jul 21, 2026
@np96
np96 force-pushed the fix/unreachable-break-infeasibility branch from 424ed35 to 378b061 Compare September 11, 2026 11:45
@np96 np96 changed the title fix(routing): penalize missing required breaks in route cost fix(routing): honor break deadlines on short routes Sep 11, 2026
@np96
np96 changed the base branch from release/26.06 to main September 11, 2026 11:45
Signed-off-by: Nikolai Poperechnyi <n.poperechnyi@gmail.com>
@np96
np96 force-pushed the fix/unreachable-break-infeasibility branch from 378b061 to 144041c Compare September 11, 2026 12:15
@np96 np96 changed the title fix(routing): honor break deadlines on short routes fix(routing): respect vehicle breaks edge-cases Sep 11, 2026
@np96

np96 commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

Hi @rg20

Do you have a chance to check this draft? Looks like there was a lack of squeeze_breaks in certain places. this fixes both cases. Most of the PR are the tests.

@rg20

rg20 commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Hi @rg20

Do you have a chance to check this draft? Looks like there was a lack of squeeze_breaks in certain places. this fixes both cases. Most of the PR are the tests.

Hi @np96,

I will have to spend sometime on rethinking the logic. Thanks for the PR.

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.

4 participants