Skip to content

Conversation

@mtanneau
Copy link

@mtanneau mtanneau commented Jan 10, 2026

Description

Fixes #757 by removing extra argument when creating QP problem instance.

Note that since the QP problem constructor does not accept variable types, one can remove the definition of variable types which are unused. Happy to do that if preferable :)

Issue

closes #757

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

Release Notes

  • New Features

    • Added Quadratic Programming (QP) solver support alongside existing LP and MILP capabilities.
    • Expanded branch-and-bound solver with multiple diving heuristic strategies for improved optimization.
  • Improvements

    • Enhanced solver performance and stability through GPU memory optimizations and improved stream handling.
    • Simplified solver configuration by removing deprecated tolerance and mode parameters.
  • Documentation

    • Updated documentation to reflect QP solver availability across C, Python, and server APIs.

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

@mtanneau mtanneau requested a review from a team as a code owner January 10, 2026 04:13
@mtanneau mtanneau requested a review from Iroy30 January 10, 2026 04:13
@copy-pr-bot
Copy link

copy-pr-bot bot commented Jan 10, 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.

@coderabbitai
Copy link

coderabbitai bot commented Jan 10, 2026

Caution

Review failed

Failed to post review comments

📝 Walkthrough

Walkthrough

This PR introduces new diving heuristics for branch-and-bound solving, refactors the dual simplex solver to use device-resident data, adds Quadratic Programming support to documentation, upgrades GitHub Actions workflows, updates Python APIs by removing deprecated parameters, and adds S3-based dataset downloads.

Changes

Cohort / File(s) Summary
GitHub Actions Workflow Updates
.github/workflows/build.yaml, build_images.yaml, pr.yaml, test.yaml, trigger-breaking-change-alert.yaml
Replaced CUDA-specific version tags with main branch reference; added CUOPT S3 dataset secrets to test jobs; updated copyright years and added COMMIT_TIME handling in docker image build.
Dual Simplex Core Solver Refactoring
cpp/src/dual_simplex/barrier.cu, barrier.hpp, branch_and_bound.cpp, branch_and_bound.hpp, iterative_refinement.hpp
Migrated barrier solver to device-resident augmented matrices; replaced CPU-focused methods with GPU-centric implementations; refactored branch-and-bound with new diving strategies (pseudocost, line-search, guided, coefficient); replaced mip_exploration_status_t with bnb_worker_type_t enum; introduced bnb_stats_t for thread-safe statistics.
Diving Heuristics Implementation
cpp/src/dual_simplex/diving_heuristics.cpp, diving_heuristics.hpp
New module implementing five diving strategies via template functions; introduced branch_variable_t struct; includes pseudocost, line-search, guided, and coefficient-based variable selection with logging.
Node Queue and Queue Management
cpp/src/dual_simplex/node_queue.hpp, diving_queue.hpp
Removed old diving_queue.hpp; introduced new node_queue_t<i_t, f_t> with dual heaps (best-first and diving) and mutex-protected operations; added generic heap_t<T, Comp> template.
Basis Repair and Updates
cpp/src/dual_simplex/basis_solves.cpp, basis_solves.hpp, basis_updates.cpp, basis_updates.hpp, crossover.cpp, phase2.cpp, primal.cpp
Extended basis_repair and refactor_basis signatures with lower and upper bound parameters to support bound-aware nonbasic variable status selection.
Pseudo-Costs and Diving Settings
cpp/src/dual_simplex/pseudo_costs.cpp, pseudo_costs.hpp, simplex_solver_settings.hpp
Added obj_estimate() method to pseudo_costs_t; introduced diving_heuristics_settings_t struct with diving configuration; renamed num_bfs_threads to num_bfs_workers.
Stream and Device Code Updates
cpp/src/linear_programming/pdhg.cu, pdlp.cu, initial_scaling.cu, termination_strategy/*.cu, cython_solve.cu, cusparse_view.cu
Replaced stream_view_ with stream_view_.value() for raw CUDA stream handles; added runtime cuSPARSE version checking; reset stream contexts for result buffers.
Iterative Refinement Device Migration
cpp/src/dual_simplex/iterative_refinement.hpp
Rewrote iterative refinement functions to use rmm::device_uvector instead of host vectors; introduced device-side functors for vector operations; changed return types to f_t for residual values.
Quadratic Objective and Problem Setup
cpp/src/linear_programming/optimization_problem.cu, cpp/src/mip/problem/problem.cu, problem.cuh, problem_helpers.cuh
Added set_quadratic_objective_matrix two-phase CSR construction with deduplication; introduced substitute_variables, update_variable_bounds, and sort_rows_by_variables public methods; added substitution_t struct to presolve data.
Presolve and Probing Cache Refactoring
cpp/src/mip/presolve/probing_cache.cu, probing_cache.cuh, trivial_presolve.cuh, trivial_presolve_helpers.cuh
Changed compute_probing_cache return type from void to bool; introduced multi-threaded probing with per-thread work queues; added substitution propagation and graph sanitization; added remap_cache_ids parameter.
Diversity and Local Search
cpp/src/mip/diversity/diversity_manager.cu, cpp/src/mip/diversity/lns/rins.cu, recombiners/sub_mip.cuh
Updated thread configuration to use num_bfs_workers and diving_settings; refactored probing cache integration with time budgeting; changed solution callback to include objective parameter.
Python API Deprecation Cleanup
python/cuopt_self_hosted/cuopt_sh_client/cuopt_self_host_client.py, python/cuopt_server/cuopt_server/utils/linear_programming/data_definition.py, solver.py, test_lp.py
Removed request_excess_timeout parameter from client; deleted deprecated tolerance fields (absolute_primal, relative_dual, etc.); removed solver_mode and heuristics_only fields; updated tests with new tolerance naming.
Documentation—QP Support
README.md, docs/cuopt/source/**/*.rst, docs/cuopt/source/cuopt-c/lp-qp-milp/*, docs/cuopt/source/cuopt-python/lp-qp-milp/*
Expanded all references from "LP/MILP" to "LP/QP/MILP"; reorganized documentation structure from lp-milp/ to lp-qp-milp/ folders; updated API reference titles and examples.
Conda and Python Dependencies
conda/environments/*.yaml, python/cuopt/pyproject.toml, dependencies.yaml
Added pyyaml>=6.0.0 as runtime dependency across conda environments and Python package specs.
Docker and Dataset Handling
ci/docker/Dockerfile, ci/docker/test_image.sh, datasets/get_test_data.sh, datasets/linear_programming/download_pdlp_test_dataset.sh, datasets/mip/download_miplib_test_dataset.sh
Added CUDA headers stage in Dockerfile; added S3 download functions with AWS credentials support; updated test harness with pytest/pexpect; added COMMIT_TIME tracking.
Utilities and Configuration
cpp/src/utilities/cuda_helpers.cuh, omp_helpers.hpp, cpp/src/mip/utilities/work_unit_ordered_queue.cuh, cpp/src/mip/diversity/diversity_config.hpp
Added thread-safe dynamic shared memory caching; made omp_atomic_t::load() const; introduced work_unit_ordered_queue_t for timestamp-ordered work; increased probing cache time budgets.
Benchmarks and Configuration
benchmarks/linear_programming/cuopt/run_mip.cpp, benchmarks/linear_programming/utils/get_datasets.py, datasets/cuopt_service_data/lpmip_configs.json
Added mip_gap and is_optimal metrics to benchmark output; enabled netlib dataset processing; removed deprecated tolerance configuration keys.
C API Examples
docs/cuopt/source/cuopt-c/lp-qp-milp/examples/simple_qp_example.c, docs/cuopt/source/cuopt-python/lp-qp-milp/examples/simple_qp_example.py
Removed variable_types argument from QP example call; added linear constraint to Python QP example.
Routing Multi-GPU Setup
cpp/src/routing/utilities/cython.cu
Added per-thread CUDA device context setup in batch routing loops.
QP Unit Tests
cpp/tests/qp/CMakeLists.txt, cpp/tests/qp/unit_tests/no_constraints.cu
Added unconstrained QP test case covering diagonal quadratic objective solving.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • Diving Improvements #697: Implements dual-heap node queue and diving heuristics infrastructure that this PR depends on; both modify branch-and-bound solver, diving strategy selection, and basis repair call sites in similar ways.

Suggested labels

improvement

Suggested reviewers

  • akifcorduk
🚥 Pre-merge checks | ✅ 3 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR contains extensive changes far beyond the scope of fixing issue #757, including diving heuristics, branch-and-bound refactoring, QP feature documentation, and numerous unrelated modifications. Separate the typo fix for the QP example (the stated objective) from the large-scale architectural changes to branch-and-bound, diving heuristics, documentation updates, and other features.
Docstring Coverage ⚠️ Warning Docstring coverage is 3.31% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title is clear, specific, and directly describes the primary change: removing an extra argument from QP problem instantiation in a C example.
Linked Issues check ✅ Passed The PR fixes issue #757 by removing the extra variable_types argument from cuOptCreateQuadraticProblem call in the C example, resolving the compilation error.

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

✨ Finishing touches
  • 📝 Generate docstrings

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.

Signed-off-by: mtanneau <mathieu.tanneau@gmail.com>
@rgsl888prabhu rgsl888prabhu added bug Something isn't working non-breaking Introduces a non-breaking change labels Jan 12, 2026
@rgsl888prabhu
Copy link
Collaborator

Thank you @mtanneau for the PR. Will get back to you on your suggestion on variable types.

@rgsl888prabhu
Copy link
Collaborator

/ok to test f8d0336

@rgsl888prabhu
Copy link
Collaborator

Thank you @mtanneau for the PR, will ping engine team regarding your suggestion on removing.

@rgsl888prabhu
Copy link
Collaborator

/ok to test f8d0336

@rgsl888prabhu
Copy link
Collaborator

/ok to test 740b221

Copy link

@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

🧹 Nitpick comments (1)
docs/cuopt/source/cuopt-c/lp-milp/examples/simple_qp_example.c (1)

105-108: Remove unused variable_types definition.

The variable_types array is now dead code since it's no longer passed to cuOptCreateQuadraticProblem. As the PR author noted, this should be removed to avoid confusing users who might wonder why the variable exists but isn't used.

♻️ Suggested fix
-  // Variable types (continuous)
-  // From the constraints:
-  // x1, x2 >= 0
-  char variable_types[] = {CUOPT_CONTINUOUS, CUOPT_CONTINUOUS};
-
   cuopt_int_t status;
📜 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 923bdf1 and 740b221.

📒 Files selected for processing (1)
  • docs/cuopt/source/cuopt-c/lp-milp/examples/simple_qp_example.c
🧰 Additional context used
📓 Path-based instructions (1)
docs/**/*

⚙️ CodeRabbit configuration file

docs/**/*: For documentation changes, focus on:

  • Accuracy: Verify code examples compile and run correctly
  • Completeness: Check if API changes (parameters, return values, errors) are documented
  • Clarity: Flag confusing explanations, missing prerequisites, or unclear examples
  • Consistency: Version numbers, parameter types, and terminology match code
  • Examples: Suggest adding examples for complex features or new APIs
  • Missing docs: If PR changes public APIs without updating docs, flag as HIGH priority

When code changes affect docs:

  • Suggest specific doc files that need updates (e.g., docs/cuopt/api.rst)
  • Identify outdated information contradicting the code changes
  • Recommend documenting performance characteristics, GPU requirements, or numerical tolerances

Files:

  • docs/cuopt/source/cuopt-c/lp-milp/examples/simple_qp_example.c
🧠 Learnings (13)
📓 Common learnings
Learnt from: chris-maes
Repo: NVIDIA/cuopt PR: 500
File: cpp/tests/linear_programming/c_api_tests/c_api_test.c:1033-1048
Timestamp: 2025-12-06T00:22:48.638Z
Learning: In cuOPT's quadratic programming API, when a user provides a quadratic objective matrix Q via set_quadratic_objective_matrix or the C API functions cuOptCreateQuadraticProblem/cuOptCreateQuadraticRangedProblem, the API internally computes Q_symmetric = Q + Q^T and the barrier solver uses 0.5 * x^T * Q_symmetric * x. From the user's perspective, the convention is x^T Q x. For a diagonal Q with values [q1, q2, ...], the resulting quadratic terms are q1*x1^2 + q2*x2^2 + ...
Learnt from: CR
Repo: NVIDIA/cuopt PR: 0
File: .github/.coderabbit_review_guide.md:0-0
Timestamp: 2025-11-25T10:20:49.822Z
Learning: Applies to **/*.{cu,cuh,cpp,hpp,h} : Ensure variables and constraints are accessed from the correct problem context (original vs presolve vs folded vs postsolve); verify index mapping consistency across problem transformations
Learnt from: aliceb-nv
Repo: NVIDIA/cuopt PR: 527
File: cpp/src/mip/diversity/lns/rins.cu:167-175
Timestamp: 2025-10-22T14:25:22.899Z
Learning: In MIP (Mixed Integer Programming) problems in the cuOPT codebase, `n_integer_vars == 0` is impossible by definition—MIP problems must have at least one integer variable. If there are no integer variables, it would be a pure Linear Programming (LP) problem, not a MIP problem.
📚 Learning: 2025-12-06T00:22:48.638Z
Learnt from: chris-maes
Repo: NVIDIA/cuopt PR: 500
File: cpp/tests/linear_programming/c_api_tests/c_api_test.c:1033-1048
Timestamp: 2025-12-06T00:22:48.638Z
Learning: In cuOPT's quadratic programming API, when a user provides a quadratic objective matrix Q via set_quadratic_objective_matrix or the C API functions cuOptCreateQuadraticProblem/cuOptCreateQuadraticRangedProblem, the API internally computes Q_symmetric = Q + Q^T and the barrier solver uses 0.5 * x^T * Q_symmetric * x. From the user's perspective, the convention is x^T Q x. For a diagonal Q with values [q1, q2, ...], the resulting quadratic terms are q1*x1^2 + q2*x2^2 + ...

Applied to files:

  • docs/cuopt/source/cuopt-c/lp-milp/examples/simple_qp_example.c
📚 Learning: 2025-11-25T10:20:49.822Z
Learnt from: CR
Repo: NVIDIA/cuopt PR: 0
File: .github/.coderabbit_review_guide.md:0-0
Timestamp: 2025-11-25T10:20:49.822Z
Learning: Applies to **/*.{cu,cuh,cpp,hpp,h} : Track GPU device memory allocations and deallocations to prevent memory leaks; ensure cudaMalloc/cudaFree balance and cleanup of streams/events

Applied to files:

  • docs/cuopt/source/cuopt-c/lp-milp/examples/simple_qp_example.c
📚 Learning: 2025-11-25T10:20:49.822Z
Learnt from: CR
Repo: NVIDIA/cuopt PR: 0
File: .github/.coderabbit_review_guide.md:0-0
Timestamp: 2025-11-25T10:20:49.822Z
Learning: Applies to **/*.{cu,cuh,cpp,hpp,h} : Check that hard-coded GPU device IDs and resource limits are made configurable; abstract multi-backend support for different CUDA versions

Applied to files:

  • docs/cuopt/source/cuopt-c/lp-milp/examples/simple_qp_example.c
📚 Learning: 2025-11-25T10:20:49.822Z
Learnt from: CR
Repo: NVIDIA/cuopt PR: 0
File: .github/.coderabbit_review_guide.md:0-0
Timestamp: 2025-11-25T10:20:49.822Z
Learning: Applies to **/*.{cu,cuh,cpp,hpp,h} : Ensure race conditions are absent in multi-GPU code and multi-threaded server implementations; verify proper synchronization of shared state

Applied to files:

  • docs/cuopt/source/cuopt-c/lp-milp/examples/simple_qp_example.c
📚 Learning: 2025-11-25T10:20:49.822Z
Learnt from: CR
Repo: NVIDIA/cuopt PR: 0
File: .github/.coderabbit_review_guide.md:0-0
Timestamp: 2025-11-25T10:20:49.822Z
Learning: Applies to **/*.{cu,cpp,hpp,h} : Avoid inappropriate use of exceptions in performance-critical GPU operation paths; prefer error codes or CUDA error checking for latency-sensitive code

Applied to files:

  • docs/cuopt/source/cuopt-c/lp-milp/examples/simple_qp_example.c
📚 Learning: 2025-11-25T10:20:49.822Z
Learnt from: CR
Repo: NVIDIA/cuopt PR: 0
File: .github/.coderabbit_review_guide.md:0-0
Timestamp: 2025-11-25T10:20:49.822Z
Learning: Applies to **/*.{cu,cuh,cpp,hpp,h} : Verify error propagation from CUDA to user-facing APIs is complete; ensure CUDA errors are caught and mapped to meaningful user error codes

Applied to files:

  • docs/cuopt/source/cuopt-c/lp-milp/examples/simple_qp_example.c
📚 Learning: 2025-11-25T10:20:49.822Z
Learnt from: CR
Repo: NVIDIA/cuopt PR: 0
File: .github/.coderabbit_review_guide.md:0-0
Timestamp: 2025-11-25T10:20:49.822Z
Learning: Applies to **/*.{cu,cuh,cpp,hpp,h} : Eliminate unnecessary host-device synchronization (cudaDeviceSynchronize) in hot paths that blocks GPU pipeline; use streams and events for async execution

Applied to files:

  • docs/cuopt/source/cuopt-c/lp-milp/examples/simple_qp_example.c
📚 Learning: 2025-11-25T10:20:49.822Z
Learnt from: CR
Repo: NVIDIA/cuopt PR: 0
File: .github/.coderabbit_review_guide.md:0-0
Timestamp: 2025-11-25T10:20:49.822Z
Learning: Applies to **/*.{cu,cuh,cpp,hpp,h} : Verify correct problem size checks before expensive GPU/CPU operations; prevent resource exhaustion on oversized problems

Applied to files:

  • docs/cuopt/source/cuopt-c/lp-milp/examples/simple_qp_example.c
📚 Learning: 2025-11-25T10:20:49.822Z
Learnt from: CR
Repo: NVIDIA/cuopt PR: 0
File: .github/.coderabbit_review_guide.md:0-0
Timestamp: 2025-11-25T10:20:49.822Z
Learning: Applies to **/*.{cu,cuh,cpp,hpp,h} : Refactor code duplication in solver components (3+ occurrences) into shared utilities; for GPU kernels, use templated device functions to avoid duplication

Applied to files:

  • docs/cuopt/source/cuopt-c/lp-milp/examples/simple_qp_example.c
📚 Learning: 2025-11-25T10:20:49.822Z
Learnt from: CR
Repo: NVIDIA/cuopt PR: 0
File: .github/.coderabbit_review_guide.md:0-0
Timestamp: 2025-11-25T10:20:49.822Z
Learning: Applies to **/*.cu : Verify race conditions and correctness of GPU kernel shared memory, atomics, and warp-level operations

Applied to files:

  • docs/cuopt/source/cuopt-c/lp-milp/examples/simple_qp_example.c
📚 Learning: 2025-11-25T10:20:49.822Z
Learnt from: CR
Repo: NVIDIA/cuopt PR: 0
File: .github/.coderabbit_review_guide.md:0-0
Timestamp: 2025-11-25T10:20:49.822Z
Learning: Applies to **/*.{cu,cuh,cpp,hpp,h} : For concurrent CUDA operations (barriers, async operations), explicitly create and manage dedicated streams instead of reusing the default stream; document stream lifecycle

Applied to files:

  • docs/cuopt/source/cuopt-c/lp-milp/examples/simple_qp_example.c
📚 Learning: 2025-11-25T10:20:49.822Z
Learnt from: CR
Repo: NVIDIA/cuopt PR: 0
File: .github/.coderabbit_review_guide.md:0-0
Timestamp: 2025-11-25T10:20:49.822Z
Learning: Applies to **/*.{cu,cuh,cpp,hpp,h} : Ensure variables and constraints are accessed from the correct problem context (original vs presolve vs folded vs postsolve); verify index mapping consistency across problem transformations

Applied to files:

  • docs/cuopt/source/cuopt-c/lp-milp/examples/simple_qp_example.c
🔇 Additional comments (2)
docs/cuopt/source/cuopt-c/lp-milp/examples/simple_qp_example.c (2)

2-2: LGTM!

Copyright year update is appropriate.


118-133: LGTM!

The fix correctly removes the variable_types argument from the cuOptCreateQuadraticProblem call, which resolves the compilation error reported in issue #757. The function signature now matches the API that doesn't accept variable types for QP problems.

@rgsl888prabhu rgsl888prabhu requested review from a team as code owners January 16, 2026 16:31
@rgsl888prabhu rgsl888prabhu changed the base branch from main to release/25.12 January 16, 2026 16:32
@rgsl888prabhu rgsl888prabhu changed the base branch from release/25.12 to main January 16, 2026 16:32
@rgsl888prabhu rgsl888prabhu removed request for a team January 16, 2026 16:32
@rgsl888prabhu
Copy link
Collaborator

/ok to test 1a0747c

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.

[BUG] Simple QP example in C not compiling

3 participants