Skip to content

Conversation

@adityasinghz
Copy link

@adityasinghz adityasinghz commented Nov 24, 2025

Description

Added an explicit log message "Optimal solution found during presolve" that is displayed when the problem is fully reduced during presolve (i.e., when the problem is reduced to 0 constraints, 0 variables, and 0 nonzeros). This provides clear feedback to users that the optimal solution was discovered during presolve rather than through the main solving process.

Changes Made:

  • cpp/src/mip/solve.cu: Added log message when problem.empty is true before running the MIP solver
  • cpp/src/mip/solver.cu: Added log message in two locations:
    • When context.problem_ptr->empty is true before running presolve
    • When context.problem_ptr->empty becomes true after running presolve

Example Output:
Before this change, when the optimal solution was found during presolve, users would see:

Presolve status: reduced the problem
Presolve removed: 100 constraints, 200 variables, 560 nonzeros
Presolved problem: 0 constraints, 0 variables, 0 nonzeros
Best feasible: 37.000000

After this change, users will now see:

Presolve status: reduced the problem
Presolve removed: 100 constraints, 200 variables, 560 nonzeros
Presolved problem: 0 constraints, 0 variables, 0 nonzeros
Optimal solution found during presolve
Problem fully reduced in presolve
Best feasible: 37.000000

Issue #524

Checklist

  • I am familiar with the Contributing Guidelines.

  • Testing

    • New or existing tests cover these changes
    • Added tests
    • Created an issue to follow-up
    • NA
  • Documentation

    • The documentation is up to date with these changes
    • Added new documentation
    • NA

Summary by CodeRabbit

  • Bug Fixes
    • Improved presolve reporting: when preprocessing fully eliminates a problem (no rows or columns remain), the solver now clearly notifies that an optimal solution was found during presolve.

✏️ Tip: You can customize this high-level summary in your review settings.

@adityasinghz adityasinghz requested a review from a team as a code owner November 24, 2025 08:04
@copy-pr-bot
Copy link

copy-pr-bot bot commented Nov 24, 2025

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.

Copy link
Contributor

@rg20 rg20 left a comment

Choose a reason for hiding this comment

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

Move the logic of checking if presolver found solution to presolve caller or presolve function itself.

Move the 'Optimal solution found during presolve' message to the
presolve function itself (third_party_presolve.cpp) where we can
accurately detect when presolve finds the optimal solution. This
ensures the message only appears when presolve actually found the
solution, not when the problem is empty for other reasons.

Removed the message from generic empty problem checks in:
- cpp/src/mip/solve.cu (run_mip function)
- cpp/src/mip/solver.cu (run_solver function - both locations)
@adityasinghz adityasinghz requested a review from rg20 November 24, 2025 14:35
@rg20 rg20 added improvement Improves an existing functionality non-breaking Introduces a non-breaking change labels Nov 24, 2025
@rg20 rg20 modified the milestone: 25.12 Nov 24, 2025
@rg20
Copy link
Contributor

rg20 commented Nov 24, 2025

/ok to test 527cd60

@rgsl888prabhu
Copy link
Collaborator

@adityasinghz Is this meant for 25.12 release or 26.02.

If it is meant for 25.12, may I request you to close this PR and use branch release/25.12 branch as your base and create a PR? And also choose merge branch to be 25.12.

@adityasinghz
Copy link
Author

Hi @rgsl888prabhu,

Thank you for the question. This is a user experience improvement (adding a log message when optimal solution is found during presolve), so I'm flexible on which release it targets.

Option 1: If this should go into 25.12:
I can rebase this onto release/25.12 and create a new PR targeting that branch. Should I proceed with this?

Option 2: If this can wait for 26.02:
I can keep the current PR targeting main (which will be part of 26.02).
Could you please let me know which release you'd prefer? I'm happy to adjust accordingly.

Thanks!

@rgsl888prabhu
Copy link
Collaborator

Lets move it to 26.2 since 25.12 is close to code freeze.

@coderabbitai
Copy link

coderabbitai bot commented Dec 3, 2025

📝 Walkthrough

Walkthrough

A conditional check was added in the presolve routine to detect when presolve reduces the problem to zero rows and zero columns and to log "Optimal solution found during presolve" in that case.

Changes

Cohort / File(s) Summary
Presolve logging enhancement
cpp/src/mip/presolve/third_party_presolve.cpp
Added a check in third_party_presolve_t<i_t,f_t>::apply to detect complete problem reduction (0 rows and 0 columns) and log "Optimal solution found during presolve" after existing presolve reduction logging.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Confirm the condition is placed after existing presolve logging and does not alter control flow.
  • Verify the log message is accurate and appropriately triggered only when both row and column counts are zero.

Pre-merge checks and finishing touches

❌ 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%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ 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 accurately describes the main change: adding a log message when presolve fully reduces the problem to indicate an optimal solution was found during presolve.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a6e3d6a and e8fbcf7.

📒 Files selected for processing (1)
  • cpp/src/mip/presolve/third_party_presolve.cpp (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • cpp/src/mip/presolve/third_party_presolve.cpp

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.

@adityasinghz
Copy link
Author

Hi @rgsl888prabhu
Thank you for asking. Since 25.12 is close to code freeze, I'd prefer to target this for the 26.02 release, so it can wait for the next release cycle.

I'll keep the current PR targeting main (which will be part of 26.02).

Thanks!

@github-actions
Copy link

🔔 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.

1 similar comment
@github-actions
Copy link

🔔 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.

@adityasinghz
Copy link
Author

Hi @rg20 @rgsl888prabhu , I have one additional request. If there is any task you would like to assign to me, please feel free to do so. I reviewed the issues section, but I am not certain whether the listed issues pertain to the current version or to upcoming releases.

Thank You!

@rgsl888prabhu
Copy link
Collaborator

rgsl888prabhu commented Dec 22, 2025

Hi @rg20 @rgsl888prabhu , I have one additional request. If there is any task you would like to assign to me, please feel free to do so. I reviewed the issues section, but I am not certain whether the listed issues pertain to the current version or to upcoming releases.

Thank You!

That would be awesome @adityasinghz, which part of library are you interested in? Please check the milestones in issues, normally they should highlight if they are slated for this release, and you can also ping if you are interested in any new issues/features or want to work on a other issues not meant for this release. We can always discuss and accommodate if feasible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Improves an existing functionality non-breaking Introduces a non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants