Skip to content

Main merge release/26.02 3#826

Merged
rgsl888prabhu merged 2 commits intoNVIDIA:mainfrom
rgsl888prabhu:main-merge-release/26.02_3
Feb 4, 2026
Merged

Main merge release/26.02 3#826
rgsl888prabhu merged 2 commits intoNVIDIA:mainfrom
rgsl888prabhu:main-merge-release/26.02_3

Conversation

@rgsl888prabhu
Copy link
Collaborator

@rgsl888prabhu rgsl888prabhu commented Feb 4, 2026

For #825

Summary by CodeRabbit

  • New Features

    • Added support for passing user data context through MIP solution callbacks.
    • Exposed solution bounds in incumbent solution callbacks and server API responses.
    • Enhanced MIP callback mechanisms to enable better integration with external solution providers.
  • Improvements

    • Improved presolve variable mapping and solution recovery.
    • Better stream synchronization for GPU memory operations.

akifcorduk and others added 2 commits February 4, 2026 15:11
This PR adds callbacks to C API. Users can now use C API to implement get_solution and set_solution callbacks.

This PR is a breaking PR that changes callback input/output pointers from device memory to host memory. We are also adding a user_data pointer for user to be more flexible inside the callbacks as well as dual bound for the B&B tree.

Previously callbacks were not enabled when third party presolved was enabled. Now we are able to handle uncrushing of solutions when third party presolve is enabled on get_solution callbacks. Registering a set_solution callback disables presolve as there is no way of crushing a solution in original space to reduced space when using third party presolve.

The examples and tests are modified to reflect the change.


## Summary by CodeRabbit

* **New Features**
  * MIP incumbent get/set callbacks with optional user_data and registration; server/client flag to enable set-callback behavior.

* **Behavior**
  * Incumbent records now include bound and user_data; solution-bound handling made thread-safe. Registering a set-solution callback may disable presolve and enables host-side incumbent injection.

* **Tests**
  * Added tests for get-only and get-and-set flows, user_data propagation, bound reporting, and presolve interactions.

* **Documentation**
  * Examples and docs updated to show callbacks, user_data, bound reporting, and set-callback usage.

Authors:
  - Akif ÇÖRDÜK (https://github.com/akifcorduk)
  - Alice Boucher (https://github.com/aliceb-nv)

Approvers:
  - Ramakrishnap (https://github.com/rgsl888prabhu)
  - Nicolas L. Guidotti (https://github.com/nguidotti)

URL: NVIDIA#779
@rgsl888prabhu rgsl888prabhu requested review from a team as code owners February 4, 2026 15:45
@rgsl888prabhu rgsl888prabhu merged commit 44d4779 into NVIDIA:main Feb 4, 2026
9 of 11 checks passed
@coderabbitai
Copy link

coderabbitai bot commented Feb 4, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Introduces MIP solution callbacks with user_data support, including C/C++ API extensions, atomic solution bound tracking, Papilo presolve integration via presolve_data_t, and corresponding Python/server updates affecting callback signatures, problem construction, and solver state management.

Changes

Cohort / File(s) Summary
Build & CI Configuration
ci/run_cuopt_*.sh, conda/recipes/libcuopt/recipe.yaml, cpp/src/mip/CMakeLists.txt
Updated copyright years, added -s flag to pytest invocations, and added presolve_data.cu to MIP_LP_NECESSARY_FILES build list.
C API Callbacks
cpp/include/cuopt/linear_programming/cuopt_c.h, cpp/src/linear_programming/cuopt_c.cpp
Introduced new callback typedefs (cuOptMIPGetSolutionCallback, cuOptMIPSetSolutionCallback), public API functions for registering callbacks, and internal solver_settings_handle_t for callback lifetime management.
C++ Callback Infrastructure
cpp/include/cuopt/linear_programming/utilities/internals.hpp, cpp/include/cuopt/linear_programming/utilities/callbacks_implems.hpp
Extended callback interface signatures to include solution_bound and user_data parameters; added user_data storage and accessors to base_solution_callback_t; updated callback implementations to handle additional parameters.
Solver Settings
cpp/include/cuopt/linear_programming/.../solver_settings.hpp, cpp/src/.../solver_settings.cu, cpp/src/mip/solver_settings.cu
Updated set_mip_callback to accept user_data parameter; changed default mip_scaling from true to false; added user_data propagation to callback storage.
Solution Bound Tracking
cpp/include/cuopt/linear_programming/mip/solver_stats.hpp, cpp/src/mip/solution/solution.cu, cpp/src/mip/solver_solution.cu
Converted solution_bound to std::atomic<f_t> with default/copy constructors, assignment operator, and explicit getter/setter methods using relaxed memory ordering.
Presolve Data Management
cpp/src/mip/presolve/third_party_presolve.hpp, cpp/src/mip/presolve/third_party_presolve.cpp, cpp/src/mip/problem/presolve_data.cuh, cpp/src/mip/problem/presolve_data.cu
Introduced presolve_data_t class with pre/post-process assignment methods, Papilo integration, and variable mapping support; added accessors and mappings to third_party_presolve_result_t.
Problem Construction
cpp/src/mip/problem/problem.cuh, cpp/src/mip/problem/problem.cu, cpp/src/mip/relaxed_lp/lp_state.cuh
Added new constructor overload accepting external raft::handle_t; delegated presolve operations to presolve_data; added setters for Papilo presolve data and uncrushing methods.
Solver Core Integration
cpp/src/mip/solve.cu, cpp/src/mip/solver.cu, cpp/src/mip/solver_context.cuh
Integrated presolve result handling, added diversity_manager support for callbacks, implemented GET_SOLUTION callback invocation paths, added user-bound callback mechanism, and propagated diversity_manager through solver context.
Population & Diversity
cpp/src/mip/diversity/population.cuh, cpp/src/mip/diversity/population.cu, cpp/src/mip/diversity/diversity_manager.cu
Added invoke_get_solution_callback helper, updated solution callback invocation logic to handle solution_bound and user_data, replaced direct assignment with setter for solution_bound.
Branch & Bound
cpp/src/dual_simplex/branch_and_bound.hpp, cpp/src/dual_simplex/branch_and_bound.cpp
Added set_user_bound_callback and update_user_bound methods to propagate lower bound information via user callback during branch-and-bound execution.
Feasibility Methods
cpp/src/mip/local_search/feasibility_pump.cu, cpp/src/mip/local_search/local_search.cu, cpp/src/mip/feasibility_jump/feasibility_jump.cu, cpp/src/mip/diversity/lns/rins.cu
Added diversity_manager preemption checks, updated problem initialization to use handle-based construction, and added periodic solution incorporation via diversity_manager.
C API Tests
cpp/tests/linear_programming/c_api_tests/c_api_test.c, cpp/tests/linear_programming/c_api_tests/c_api_tests.cpp, cpp/tests/linear_programming/c_api_tests/c_api_tests.h
Introduced MIP callback testing framework with mip_callback_context_t, implemented test callbacks with user_data verification, and added test wrapper functions.
MIP Tests
cpp/tests/mip/incumbent_callback_test.cu, cpp/tests/mip/mip_utils.cuh
Updated callback signatures to accept solution_bound and user_data; replaced device vectors with host vectors for callback data; added new test overloads for host-based solution verification.
Test Utilities
cpp/tests/linear_programming/utilities/pdlp_test_utilities.cuh
Added new overload of test_objective_sanity accepting std::vector for host-side objective validation.
Python Bindings
python/cuopt/cuopt/linear_programming/internals/internals.pyx, python/cuopt/cuopt/linear_programming/solver/solver.pxd, python/cuopt/cuopt/linear_programming/solver/solver_wrapper.pyx, python/cuopt/cuopt/linear_programming/solver_settings/solver_settings.py
Extended callback signatures in Cython; added PyCallback._user_data field with getter/setter; updated memory access to use ctypes; propagated user_data through MIP callback registration.
Python Tests
python/cuopt/cuopt/tests/linear_programming/test_incumbent_callbacks.py, python/cuopt/cuopt/tests/linear_programming/test_python_API.py
Reworked callback tests to accept solution_bound and user_data; added parameterized test variants with/without set-solution callback; updated assertions and storage to reflect new callback signatures.
Server Data Models & Utilities
python/cuopt_server/cuopt_server/utils/linear_programming/data_definition.py, python/cuopt_server/cuopt_server/utils/linear_programming/solver.py, python/cuopt_server/cuopt_server/utils/job_queue.py, python/cuopt_server/cuopt_server/utils/solver.py
Added bound field to IncumbentSolution; introduced CustomSetSolutionCallback; extended solve signatures with incumbent_set_solutions parameter; propagated bound through intermediate responses.
Server Web API
python/cuopt_server/cuopt_server/webserver.py
Added incumbent_set_solutions query parameter to postrequest; updated incumbent solution response schema to include bound field; propagated flag through job constructors.
Server Tests
python/cuopt_server/cuopt_server/tests/test_incumbents.py
Updated test helper to accept include_set_callback; expanded test problem to 3 variables; added assertions for bound field; created parameterized test entry points.
Client & Examples
python/cuopt_self_hosted/cuopt_sh_client/cuopt_self_host_client.py, docs/cuopt/source/cuopt-python/.../incumbent_solutions_example.py, docs/cuopt/source/cuopt-server/.../incumbent_callback_example.py
Added post-polling incumbent fetch; updated example callbacks to receive and propagate solution_bound and user_data; modified callback function signatures and documentation.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

breaking, improvement, mip

Suggested reviewers

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

Important

Action Needed: IP Allowlist Update

If your organization protects your Git platform with IP whitelisting, please add the new CodeRabbit IP address to your allowlist:

  • 136.113.208.247/32 (new)
  • 34.170.211.100/32
  • 35.222.179.152/32

Reviews will stop working after February 8, 2026 if the new IP is not added to your allowlist.


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.

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.

2 participants

Comments