Skip to content

Correct quadratic-constraint claims in formulation skill#1407

Open
cafzal wants to merge 3 commits into
NVIDIA:mainfrom
cafzal:claude/focused-wiles-892533
Open

Correct quadratic-constraint claims in formulation skill#1407
cafzal wants to merge 3 commits into
NVIDIA:mainfrom
cafzal:claude/focused-wiles-892533

Conversation

@cafzal

@cafzal cafzal commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Description

Corrects a stale claim in the concepts-only cuopt-numerical-optimization-formulation skill: it stated quadratic constraints are unsupported, but cuOpt supports convex quadratic constraints (PSD, inequality) via second-order cones, with non-convex and equality forms still unsupported. Three concepts-level edits (no API symbols): the LP/MILP/QP constraints row, the constraints formulation question, and one line noting duals aren't returned when the model has quadratic constraints.

Verified in source (tests/socp/test_socp.py, barrier/translate_soc.hpp). Follows #1393; companion to #1408 (API dual scope). validate_skills.sh passes; generated artifacts regenerate via NVSkills-Eval.

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

The concepts-only formulation skill claimed QP supports only linear
constraints and that quadratic constraints are unsupported. cuOpt does
support convex quadratic constraints (PSD, inequality only), which it
converts to second-order cones and solves with the barrier method;
non-convex or equality quadratic constraints remain unsupported. Fixes
the LP/MILP/QP table Constraints row and the formulation-questions note.

Also adds a boundary to the post-solve sensitivity note: dual values are
not returned when the model includes quadratic constraints, so users do
not expect a dual off a second-order cone constraint.

Verified against python/cuopt/cuopt/tests/socp/test_socp.py (quadratic
constraints solved with SolverMethod.Barrier) and
docs/cuopt/source/cuopt-c/convex/convex-examples.rst ("dual variables
are not currently returned for problems with quadratic constraints").
Phrasing aligned with the sibling cuopt-multi-objective-exploration
skill for consistency.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: cafzal <cameron.afzal@gmail.com>
@copy-pr-bot

copy-pr-bot Bot commented Jun 8, 2026

Copy link
Copy Markdown

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.

cafzal added a commit to cafzal/cuopt that referenced this pull request Jun 8, 2026
…vior

cpp/src/pdlp/solve.cu (has_quadratic_constraints -> thrust::fill the entire
dual_solution + reduced_cost with quiet_NaN) shows a single quadratic
constraint suppresses duals for the *whole* solve, not just that constraint's
row. Reword "no dual for a quadratic constraint" -> "any quadratic constraint
makes cuOpt return no duals for the whole solve" in Step 3 and the QP eval, for
consistency with PRs NVIDIA#1407 (formulation) and NVIDIA#1408 (api skills, "NaN-filled").

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: cafzal <cameron.afzal@gmail.com>
@cafzal cafzal marked this pull request as ready for review June 9, 2026 17:00
@cafzal cafzal requested a review from a team as a code owner June 9, 2026 17:00
@cafzal cafzal requested a review from Iroy30 June 9, 2026 17:00
@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: b0e8c1aa-a9b1-4bd4-849a-96be4a7287d7

📥 Commits

Reviewing files that changed from the base of the PR and between 0f44091 and 1048880.

📒 Files selected for processing (1)
  • skills/cuopt-numerical-optimization-formulation/SKILL.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • skills/cuopt-numerical-optimization-formulation/SKILL.md

📝 Walkthrough

Walkthrough

Clarifies that QP supports linear plus convex quadratic (inequality-only) constraints via second-order cones, updates post-solve sensitivity guidance to state duals are unavailable when quadratic constraints exist, and expands the constraints checklist to exclude non-convex and equality quadratic constraints.

Changes

QP Constraint Capabilities and Post-Solve Guidance Documentation

Layer / File(s) Summary
QP constraints via second-order cones and dual availability
skills/cuopt-numerical-optimization-formulation/SKILL.md
LP/MILP/QP comparison updated to "linear + convex quadratic (inequality only) via second-order cones"; post-solve sensitivity wording changed to note duals available for continuous LP/QP but unavailable when quadratic constraints exist (SOCP returns primal only); "Required formulation questions → Constraints" expanded to document convex quadratic inequality (SOCP) support and exclude non-convex/equality quadratic constraints.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • NVIDIA/cuopt#1393: Both PRs update skills/cuopt-numerical-optimization-formulation/SKILL.md to clarify LP/MILP/QP dual/sensitivity support—especially the QP/dual availability and post-solve sensitivity wording.
  • NVIDIA/cuopt#1339: Both PRs update cuOpt documentation on how quadratic constraints are treated via SOCP (supported convex QP constraint types and related behavior like dual/sensitivity availability), directly connected at the QP/SOCP guidance level.

Suggested labels

doc, non-breaking

Suggested reviewers

  • tmckayus
  • rgsl888prabhu
  • Iroy30
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Correct quadratic-constraint claims in formulation skill' directly and clearly reflects the main change: correcting stale/incorrect claims about quadratic constraint support in the skill documentation.
Description check ✅ Passed The description clearly relates to the changeset, explaining what claims were corrected (quadratic constraints are now supported in convex form), why (verification from source), and what locations were modified.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@skills/cuopt-numerical-optimization-formulation/SKILL.md`:
- Line 32: Update the table entry text "Linear + convex quadratic (PSD,
inequality) via second-order cones" to explicitly state the convexity condition
for both inequality directions: specify that quadratic forms with "≤" require a
positive semidefinite (PSD) Hessian, while quadratic forms with "≥" require a
negative semidefinite (NSD) Hessian (i.e., −H is PSD); apply this same
clarification to the other occurrence of the phrase at the second location
referenced.
🪄 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: Enterprise

Run ID: 04fa816c-d234-4d6a-a54f-f145a60bff1c

📥 Commits

Reviewing files that changed from the base of the PR and between 2384454 and 8904e35.

📒 Files selected for processing (1)
  • skills/cuopt-numerical-optimization-formulation/SKILL.md

Comment thread skills/cuopt-numerical-optimization-formulation/SKILL.md Outdated
cafzal and others added 2 commits June 9, 2026 14:30
Per review feedback: "PSD, inequality" is incomplete — a `<=` quadratic
constraint needs a PSD Hessian while a `>=` needs NSD. Drop the linear-algebra
detail and say just "convex quadratic constraints (inequality only)", which is
correct for both directions; the existing "non-convex ... not" clause carries
the rest.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: cafzal <cameron.afzal@gmail.com>
Replace "shadow prices" with "dual values" in the LP/MILP/QP sensitivity row
and the post-solve note, keeping the decision meaning ("where to invest").
Consistent with the api-* skill trim in NVIDIA#1408.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: cafzal <cameron.afzal@gmail.com>
rapids-bot Bot pushed a commit that referenced this pull request Jun 10, 2026
#1408)

Corrects the dual-value scope in the `cuopt-numerical-optimization-api-python` and `-api-c` skills from "LP only" to **LP/QP**: cuOpt's barrier solver is primal-dual, so a QP with linear constraints returns shadow prices and reduced costs (the "LP only" wording predates the 26.06 QP/barrier work). Documents the boundary — problems with quadratic constraints return no duals (`NaN`-filled), so the constraints you read duals from must be linear — and adds a short QP-duals example to the Python references.

Verified in source (`cuopt_c.h`, `pdlp/solve.cu`) and empirically on a 26.08 nightly (`budget` dual ≈ 6.667; quadratic constraint → `NaN`). Follows #1393; companion to #1407 (formulation). Existing `lp_duals` assets unchanged; `validate_skills.sh` passes.

Authors:
  - Cameron Afzal (https://github.com/cafzal)

Approvers:
  - Ramakrishnap (https://github.com/rgsl888prabhu)
  - Miles Lubin (https://github.com/mlubin)

URL: #1408
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.

1 participant