Skip to content

Integrate cuopt QP and SOCP - #3983

Open
Iroy30 wants to merge 6 commits into
Pyomo:mainfrom
Iroy30:integrate_cuopt_qp_socp
Open

Integrate cuopt QP and SOCP#3983
Iroy30 wants to merge 6 commits into
Pyomo:mainfrom
Iroy30:integrate_cuopt_qp_socp

Conversation

@Iroy30

@Iroy30 Iroy30 commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Fixes # .

Summary/Motivation:

The cuOpt direct solver plugin (cuopt_direct.py) previously supported linear and MIP models only. cuOpt 26.06 exposes APIs for quadratic objectives and second-order cone constraints expressed as quadratic inequalities. This PR extends the Pyomo cuOpt interface so users can solve QP/SOCP models through SolverFactory('cuopt').

Changes proposed in this PR:

  • cuopt_direct.py: Add quadratic objective support (_set_objective, _build_quadratic_objective_csr); add quadratic constraint support (_add_cuopt_quadratic_constraint, COO helpers)
  • test_cuopt_direct.py: Add tests for quadratic objective matrix layout, SOC constraint build + solve
  • test_qp.py: Add cuOpt to the cross-solver QP regression suite (test_qp_objective_cuopt_model
  • solvers.py: Register quadratic_objective and conditional quadratic_constraint in the cuOpt test case capabilities.

AI-Use Disclosure

  • AI tools were NOT used during the preparation of this PR

or

  • AI tools contributed to the development of this PR

    • AI tools generated documentation (including the PR description/comments, code comments, and/or Sphinx documentation)
    • AI tools generated tests (baselines, examples, and/or code)
    • AI tools generated code (apart from tests)

    Review process (select ONE):

    • Rewritten: All AI-generated content was rewritten by me before being committed.
    • Reviewed/verified: I retained AI-generated content and verified it before committing. Verification included (as applicable):
      • Ran the code and fixed issues
      • Added and ran tests
      • Checked correctness/logic of code and tests
      • Checked for alignment with the contribution guide
      • Considered security implications
    • As-is: AI-generated content was commited directly to the repository

Notes for reviewers (optional):

Legal Acknowledgement

By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the BSD license.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

@Iroy30 Iroy30 changed the title Integrate cuopt qp socp Integrate cuopt QP and SOCP Jun 22, 2026
@Iroy30

Iroy30 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

We might need to update CI cuopt to 26.06

@Iroy30

Iroy30 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

I was informed that cuOpt only gets tested through Jenkins - the GHA runners don't have GPUs, so the cuOpt tests are all skipped there. The Jenkins logs aren't published.
It'd be great if the logs can be pasted here incase they fail.

@mrmundt

mrmundt commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

I was informed that cuOpt only gets tested through Jenkins - the GHA runners don't have GPUs, so the cuOpt tests are all skipped there. The Jenkins logs aren't published. It'd be great if the logs can be pasted here incase they fail.

We will inform you if there are failures. We need to update our machines, however, to have the newer version (hence why we haven't kicked off those tests yet).

@jsiirola

Copy link
Copy Markdown
Member

FYI: we are seeing test failures:

  • with cuopt-cu12 26.8.0:
    FAILED pyomo/pyomo/solvers/tests/checks/test_pickle.py::Test_MIQP_simple::test_cuopt_python_nonsymbolic_labels - ValueError: cuOpt does not support mixed-integer problems with quadratic or second-order cone constraints.
    FAILED pyomo/pyomo/solvers/tests/checks/test_pickle.py::Test_MIQP_simple::test_cuopt_python_symbolic_labels - ValueError: cuOpt does not support mixed-integer problems with quadratic or second-order cone constraints.
    FAILED pyomo/pyomo/solvers/tests/checks/test_pickle.py::Test_MIQP_simple_kernel::test_cuopt_python_nonsymbolic_labels - ValueError: cuOpt does not support mixed-integer problems with quadratic or second-order cone constraints.
    FAILED pyomo/pyomo/solvers/tests/checks/test_pickle.py::Test_MIQP_simple_kernel::test_cuopt_python_symbolic_labels - ValueError: cuOpt does not support mixed-integer problems with quadratic or second-order cone constraints.
    FAILED pyomo/pyomo/solvers/tests/checks/test_writers.py::Test_MIQP_simple::test_cuopt_python_nonsymbolic_labels - ValueError: cuOpt does not support mixed-integer problems with quadratic or second-order cone constraints.
    FAILED pyomo/pyomo/solvers/tests/checks/test_writers.py::Test_MIQP_simple::test_cuopt_python_symbolic_labels - ValueError: cuOpt does not support mixed-integer problems with quadratic or second-order cone constraints.
    FAILED pyomo/pyomo/solvers/tests/checks/test_writers.py::Test_MIQP_simple_kernel::test_cuopt_python_nonsymbolic_labels - ValueError: cuOpt does not support mixed-integer problems with quadratic or second-order cone constraints.
    FAILED pyomo/pyomo/solvers/tests/checks/test_writers.py::Test_MIQP_simple_kernel::test_cuopt_python_symbolic_labels - ValueError: cuOpt does not support mixed-integer problems with quadratic or second-order cone constraints.
    FAILED pyomo/pyomo/solvers/tests/checks/test_writers.py::Test_QP_simple::test_cuopt_python_nonsymbolic_labels - AssertionError: Solution mismatch for plugin test_cuopt_python_nonsymbolic_labels, python interface and problem type QP_simple
    Difference in solution for c1.dual:
    	Baseline - 11.9999999999
    	Current - none defined
    Gap: None
    Status: optimal
    Message: None
    Objective:
      obj:
        Value: 13.000000011012864
    Variable:
      x:
        Value: 3.000000000681999
      y:
        Value: 1.0000000011534784
    Constraint: No values
    FAILED pyomo/pyomo/solvers/tests/checks/test_writers.py::Test_QP_simple::test_cuopt_python_symbolic_labels - AssertionError: Solution mismatch for plugin test_cuopt_python_symbolic_labels, python interface and problem type QP_simple
    Difference in solution for c1.dual:
    	Baseline - 11.9999999999
    	Current - none defined
    Gap: None
    Status: optimal
    Message: None
    Objective:
      obj:
        Value: 13.000000011012864
    Variable:
      x:
        Value: 3.000000000681999
      y:
        Value: 1.0000000011534784
    Constraint: No values
    FAILED pyomo/pyomo/solvers/tests/checks/test_writers.py::Test_QP_simple_kernel::test_cuopt_python_nonsymbolic_labels - AssertionError: Solution mismatch for plugin test_cuopt_python_nonsymbolic_labels, python interface and problem type QP_simple
    Difference in solution for c1.dual:
    	Baseline - 11.9999999999
    	Current - none defined
    Status: optimal
    Objective: No values
    Variable:
      x1:
        Value: 3.000000000681999
      x2:
        Value: 1.0000000011534784
    Constraint: No values
    Symbol map: <pyomo.core.expr.symbol_map.SymbolMap object at 0x7ef9f9b16850>
    Default variable value: None
    FAILED pyomo/pyomo/solvers/tests/checks/test_writers.py::Test_QP_simple_kernel::test_cuopt_python_symbolic_labels - AssertionError: Solution mismatch for plugin test_cuopt_python_symbolic_labels, python interface and problem type QP_simple
    Difference in solution for c1.dual:
    	Baseline - 11.9999999999
    	Current - none defined
    Status: optimal
    Objective: No values
    Variable:
      x:
        Value: 3.000000000681999
      y:
        Value: 1.0000000011534784
    Constraint: No values
    Symbol map: <pyomo.core.expr.symbol_map.SymbolMap object at 0x7ef9f9bb2f90>
    Default variable value: None
    ======== 12 failed, 148 passed, 27 skipped, 20125 deselected in 51.81s =========
    
  • with cuopt-cu12 25.10.0:
    FAILED pyomo/pyomo/solvers/tests/checks/test_cuopt_direct.py::CUOPTTests::test_quadratic_objective_matrix - AttributeError: 'DataModel' object has no attribute 'set_quadratic_objective_matrix'
    FAILED pyomo/pyomo/solvers/tests/checks/test_pickle.py::Test_MIQP_simple::test_cuopt_python_nonsymbolic_labels - AttributeError: 'DataModel' object has no attribute 'set_quadratic_objective_matrix'
    FAILED pyomo/pyomo/solvers/tests/checks/test_pickle.py::Test_MIQP_simple::test_cuopt_python_symbolic_labels - AttributeError: 'DataModel' object has no attribute 'set_quadratic_objective_matrix'
    FAILED pyomo/pyomo/solvers/tests/checks/test_pickle.py::Test_MIQP_simple_kernel::test_cuopt_python_nonsymbolic_labels - AttributeError: 'DataModel' object has no attribute 'set_quadratic_objective_matrix'
    FAILED pyomo/pyomo/solvers/tests/checks/test_pickle.py::Test_MIQP_simple_kernel::test_cuopt_python_symbolic_labels - AttributeError: 'DataModel' object has no attribute 'set_quadratic_objective_matrix'
    FAILED pyomo/pyomo/solvers/tests/checks/test_pickle.py::Test_QP_simple::test_cuopt_python_nonsymbolic_labels - AttributeError: 'DataModel' object has no attribute 'set_quadratic_objective_matrix'
    FAILED pyomo/pyomo/solvers/tests/checks/test_pickle.py::Test_QP_simple::test_cuopt_python_symbolic_labels - AttributeError: 'DataModel' object has no attribute 'set_quadratic_objective_matrix'
    FAILED pyomo/pyomo/solvers/tests/checks/test_pickle.py::Test_QP_simple_kernel::test_cuopt_python_nonsymbolic_labels - AttributeError: 'DataModel' object has no attribute 'set_quadratic_objective_matrix'
    FAILED pyomo/pyomo/solvers/tests/checks/test_pickle.py::Test_QP_simple_kernel::test_cuopt_python_symbolic_labels - AttributeError: 'DataModel' object has no attribute 'set_quadratic_objective_matrix'
    FAILED pyomo/pyomo/solvers/tests/checks/test_writers.py::Test_MIQP_simple::test_cuopt_python_nonsymbolic_labels - AttributeError: 'DataModel' object has no attribute 'set_quadratic_objective_matrix'
    FAILED pyomo/pyomo/solvers/tests/checks/test_writers.py::Test_MIQP_simple::test_cuopt_python_symbolic_labels - AttributeError: 'DataModel' object has no attribute 'set_quadratic_objective_matrix'
    FAILED pyomo/pyomo/solvers/tests/checks/test_writers.py::Test_MIQP_simple_kernel::test_cuopt_python_nonsymbolic_labels - AttributeError: 'DataModel' object has no attribute 'set_quadratic_objective_matrix'
    FAILED pyomo/pyomo/solvers/tests/checks/test_writers.py::Test_MIQP_simple_kernel::test_cuopt_python_symbolic_labels - AttributeError: 'DataModel' object has no attribute 'set_quadratic_objective_matrix'
    FAILED pyomo/pyomo/solvers/tests/checks/test_writers.py::Test_QP_simple::test_cuopt_python_nonsymbolic_labels - AttributeError: 'DataModel' object has no attribute 'set_quadratic_objective_matrix'
    FAILED pyomo/pyomo/solvers/tests/checks/test_writers.py::Test_QP_simple::test_cuopt_python_symbolic_labels - AttributeError: 'DataModel' object has no attribute 'set_quadratic_objective_matrix'
    FAILED pyomo/pyomo/solvers/tests/checks/test_writers.py::Test_QP_simple_nosuffixes::test_cuopt_python_nonsymbolic_labels - AttributeError: 'DataModel' object has no attribute 'set_quadratic_objective_matrix'
    FAILED pyomo/pyomo/solvers/tests/checks/test_writers.py::Test_QP_simple_nosuffixes::test_cuopt_python_symbolic_labels - AttributeError: 'DataModel' object has no attribute 'set_quadratic_objective_matrix'
    FAILED pyomo/pyomo/solvers/tests/checks/test_writers.py::Test_QP_simple_kernel::test_cuopt_python_nonsymbolic_labels - AttributeError: 'DataModel' object has no attribute 'set_quadratic_objective_matrix'
    FAILED pyomo/pyomo/solvers/tests/checks/test_writers.py::Test_QP_simple_kernel::test_cuopt_python_symbolic_labels - AttributeError: 'DataModel' object has no attribute 'set_quadratic_objective_matrix'
    FAILED pyomo/pyomo/solvers/tests/checks/test_writers.py::Test_QP_simple_nosuffixes_kernel::test_cuopt_python_nonsymbolic_labels - AttributeError: 'DataModel' object has no attribute 'set_quadratic_objective_matrix'
    FAILED pyomo/pyomo/solvers/tests/checks/test_writers.py::Test_QP_simple_nosuffixes_kernel::test_cuopt_python_symbolic_labels - AttributeError: 'DataModel' object has no attribute 'set_quadratic_objective_matrix'
    ======== 21 failed, 136 passed, 30 skipped, 20125 deselected in 51.20s =========
    

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.

5 participants