Skip to content

Adjust basis repair for super basic variables. Repeat root solve if cuts make it infeasible#831

Merged
rapids-bot[bot] merged 6 commits intoNVIDIA:release/26.02from
chris-maes:basis_repair_superbasic
Feb 6, 2026
Merged

Adjust basis repair for super basic variables. Repeat root solve if cuts make it infeasible#831
rapids-bot[bot] merged 6 commits intoNVIDIA:release/26.02from
chris-maes:basis_repair_superbasic

Conversation

@chris-maes
Copy link
Copy Markdown
Contributor

@chris-maes chris-maes commented Feb 5, 2026

Fixes an issue on neos-4413714-turia where basis repair was called during dual push, and the slack needed was superbasic.

Fixes an issue where cbs-cta was incorrectly classified as infeasible after cuts were added.

@chris-maes chris-maes requested a review from a team as a code owner February 5, 2026 17:51
@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot bot commented Feb 5, 2026

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.

@chris-maes chris-maes self-assigned this Feb 5, 2026
@chris-maes chris-maes added bug Something isn't working non-breaking Introduces a non-breaking change labels Feb 5, 2026
@chris-maes chris-maes added this to the 26.02 milestone Feb 5, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 5, 2026

📝 Walkthrough

Walkthrough

Extended basis repair to track superbasic variables, added superbasic classification and propagation across crossover/primal/dual flows, updated basis repair/update call sites to accept a superbasic_list, and adjusted branch-and-bound root recovery and iteration/objective accounting.

Changes

Cohort / File(s) Summary
Basis repair API & impl
cpp/src/dual_simplex/basis_solves.hpp, cpp/src/dual_simplex/basis_solves.cpp
basis_repair signature now accepts std::vector<i_t>& superbasic_list. Implementation builds a superbasic_map, handles replacements into nonbasic or superbasic lists, updates swapped variable statuses (NONBASIC/SUPERBASIC), marks replaced column BASIC, and adjusts assertions to include superbasic counts.
Basis update & repair call sites
cpp/src/dual_simplex/basis_updates.cpp, cpp/src/dual_simplex/primal.cpp
Introduced a local superbasic_list and updated calls to basis_repair to pass the new parameter (e.g., on initial factorization failure and in primal_phase2).
Crossover & superbasic management
cpp/src/dual_simplex/crossover.cpp
Added find_primal_superbasic_variables(...) to classify and produce superbasic_list. Recomputed and propagated superbasic_list at multiple points (after repairs/updates and in push routines) and replaced ad-hoc superbasic removals with explicit recomputation/maintenance.
Branch-and-bound root recovery
cpp/src/dual_simplex/branch_and_bound.cpp
Reordered updates to total_lp_iters and root_objective_. Added a recovery path that attempts a scratch re-solve with an advanced-basis solver when root cut status is non-OPTIMAL; updates status, iteration counts, and objective on successful recovery.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the two main changes: handling superbasic variables in basis repair and repeating root solve when cuts cause infeasibility issues.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
cpp/src/dual_simplex/basis_solves.cpp (1)

627-628: ⚠️ Potential issue | 🟡 Minor

Assertion may fail when superbasic variables exist.

The assertion assert(nonbasic_list.size() == n - m) assumes all non-basic variables are in nonbasic_list. However, with the introduction of superbasic support, when superbasic_list is non-empty, this invariant breaks since nonbasic_list.size() + superbasic_list.size() == n - m.

🐛 Proposed fix
 const i_t m = A.m;
 const i_t n = A.n;
 assert(basis_list.size() == m);
-assert(nonbasic_list.size() == n - m);
+assert(nonbasic_list.size() + superbasic_list.size() == n - m);

@chris-maes
Copy link
Copy Markdown
Contributor Author

/ok to test a3740e0

Copy link
Copy Markdown
Contributor

@aliceb-nv aliceb-nv left a comment

Choose a reason for hiding this comment

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

Thank you so much Chris!

@chris-maes
Copy link
Copy Markdown
Contributor Author

/ok to test 65af246

@chris-maes chris-maes changed the title Adjust basis repair to take into account super basic variables Adjust basis repair for super basic variables; repeat root solve if cuts infeasible Feb 5, 2026
@chris-maes chris-maes changed the title Adjust basis repair for super basic variables; repeat root solve if cuts infeasible Adjust basis repair for super basic variables. Repeat root solve if cuts make it infeasible Feb 5, 2026
@chris-maes
Copy link
Copy Markdown
Contributor Author

/ok to test d19b30f

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@cpp/src/dual_simplex/branch_and_bound.cpp`:
- Around line 2006-2025: When the recovery solve in
solve_linear_program_with_advanced_basis succeeds, update the cached root
objective and iteration counts: after detecting scratch_status ==
lp_status_t::OPTIMAL (inside the block that sets cut_status =
convert_lp_status_to_dual_status(scratch_status)), recompute root_objective_
from the recovered root_relax_soln_ (so local_lower_bounds_.assign(...,
root_objective_) uses the fresh value) and add the iterations performed by the
recovery solve to exploration_stats_.total_lp_iters; ensure any other derived
quantities depending on the root solution (e.g., gap calculations reported
later) are consistent with the new root_objective_.

Comment thread cpp/src/dual_simplex/branch_and_bound.cpp
@chris-maes
Copy link
Copy Markdown
Contributor Author

/ok to test 48b9e88

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@cpp/src/dual_simplex/branch_and_bound.cpp`:
- Around line 1994-1996: The iteration count is coming from the out-parameter
iter returned by dual_phase2_with_advanced_basis, not from
root_relax_soln_.iterations, so replace uses of root_relax_soln_.iterations for
accounting with iter and then store iter into root_relax_soln_.iterations;
specifically update exploration_stats_.total_lp_iters to add iter instead of
root_relax_soln_.iterations and set root_relax_soln_.iterations = iter after
calling dual_phase2_with_advanced_basis so future code sees the populated value.

Comment thread cpp/src/dual_simplex/branch_and_bound.cpp Outdated
@chris-maes
Copy link
Copy Markdown
Contributor Author

/ok to test 4e1d35c

@chris-maes
Copy link
Copy Markdown
Contributor Author

/merge

@rapids-bot rapids-bot bot merged commit 9c3c727 into NVIDIA:release/26.02 Feb 6, 2026
194 of 197 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working non-breaking Introduces a non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants