Fixed lower bound in single thread mode - #1111
Conversation
…ngle thread. Signed-off-by: Nicolas L. Guidotti <nguidotti@nvidia.com>
|
Any tests worth adding? Maybe the instance that triggered the issue? |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughLower-bound computation now takes the minimum of three sources (atomic ceiling, heap, worker pool). Single-threaded solve was refactored to use the worker pool (retrieve idle worker pointer) instead of a stack-allocated worker. A single-threaded MIP test and a new MPS dataset (dominating_set) were added. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 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 |
|
Good idea. @chris-maes I can use the instance that you send? |
chris-maes
left a comment
There was a problem hiding this comment.
Thanks for the quick fix @nguidotti
Yes. I think it's fine to use. It's a sample problem from page 12 of: https://coral.ise.lehigh.edu/~pubs/files/ostrowski_phd_thesis.pdf |
Signed-off-by: Nicolas L. Guidotti <nguidotti@nvidia.com>
Signed-off-by: Nicolas L. Guidotti <nguidotti@nvidia.com>
|
/ok to test 70bdbf4 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
cpp/tests/mip/miplib_test.cu (2)
73-73: Nit: stray empty comment.Line 73 is a lone
//with no content — drop it.Proposed cleanup
-// TEST(mip_solve, low_thread_count_test)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@cpp/tests/mip/miplib_test.cu` at line 73, Remove the stray empty comment (`//`) found in the test file (the lone comment line in miplib_test.cu) — delete that line so the file has no empty comment, ensure no leftover trailing whitespace on that line, and run the repository formatter/linter to confirm no style violations remain.
88-89: VerifyEXPECT_DOUBLE_EQis appropriate here.
dominating_set.mpswith optimum 3 should yield an exact integer objective, so bitwise equality is typically safe. However, if the solver reports the objective through any floating-point accumulation (e.g., summingc_j * x_jover the LP relaxation/reconstruction), tiny rounding could cause flakes. ConsiderEXPECT_NEAR(..., 3.0, 1e-9)to be robust without weakening the test, consistent with the epsilon-comparison guideline for floating-point equality checks.As per coding guidelines: "use epsilon comparisons for floating-point equality checks".
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@cpp/tests/mip/miplib_test.cu` around lines 88 - 89, Replace the exact floating-point equality check EXPECT_DOUBLE_EQ(solution.get_objective_value(), 3.0) with an epsilon comparison to avoid flakiness from tiny rounding; use EXPECT_NEAR(solution.get_objective_value(), 3.0, 1e-9) (leave the existing termination check EXPECT_EQ(solution.get_termination_status(), mip_termination_status_t::Optimal) unchanged).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@cpp/tests/mip/miplib_test.cu`:
- Around line 76-78: The test currently hardcodes settings.time_limit = 30 which
can be too short under ASSERT_MODE; update the code that constructs
mip_solver_settings_t<int,double> settings (variable settings) to conditionally
set settings.time_limit to 60 when ASSERT_MODE is enabled (same pattern used
earlier in test_miplib_file), so debug/assert builds use a 60s time_limit and
release builds keep 30s.
---
Nitpick comments:
In `@cpp/tests/mip/miplib_test.cu`:
- Line 73: Remove the stray empty comment (`//`) found in the test file (the
lone comment line in miplib_test.cu) — delete that line so the file has no empty
comment, ensure no leftover trailing whitespace on that line, and run the
repository formatter/linter to confirm no style violations remain.
- Around line 88-89: Replace the exact floating-point equality check
EXPECT_DOUBLE_EQ(solution.get_objective_value(), 3.0) with an epsilon comparison
to avoid flakiness from tiny rounding; use
EXPECT_NEAR(solution.get_objective_value(), 3.0, 1e-9) (leave the existing
termination check EXPECT_EQ(solution.get_termination_status(),
mip_termination_status_t::Optimal) unchanged).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 0e00f81d-0713-44f1-b4f9-e5d023176062
📒 Files selected for processing (2)
cpp/tests/mip/miplib_test.cudatasets/mip/dominating_set.mps
✅ Files skipped from review due to trivial changes (1)
- datasets/mip/dominating_set.mps
|
/merge |
This PR fixes the incorrect computation of the lower bound when running with just a single thread. In the
single_threaded_solve, we were creating a separated worker instance from the pool, such that its lower bounds was never consider when computing the global lower bound. This PR simply change the routine to use a worker from the pool.Checklist