Fix accidentally quadratic add_slacks_to_basis in crossover - #1268
Conversation
Signed-off-by: Nicolas L. Guidotti <nguidotti@nvidia.com>
📝 WalkthroughWalkthroughadd_slacks_to_basis now precomputes a row->singleton-slack-column map and uses it to mark BASIC slack variables for dependent rows. After calling it when rank < m, crossover verifies num_basic + rank == m and returns NUMERICAL_ISSUES if the basis is not full-rank. ChangesSlack insertion and basis validation
🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
How much time can this take for millions of variables? It seems like a simple loop to me unless I'm misreading the code. |
It is a |
|
@mlubin @nguidotti It's O ( n * | dependent rows | ). Let me fix it so that it is O(m + | dependent rows |) = O(m). |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 2672aefd-da6c-4e35-a248-05094ea273b0
📒 Files selected for processing (1)
cpp/src/dual_simplex/crossover.cpp
|
/ok to test d59146c |
|
/merge |
When the problem is very large and the basis is extremely rank deficient, the crossover needs to add millions of slack variables to compensate.
This process can take a long time and may violate the time limit set by the user.
This PR fixes the accidentally quadratic
add_slacks_to_basisin crossover that was causing the large amount of time.