From 8904e35b3044d3d6be4a5281f5c0bd4fdfd54330 Mon Sep 17 00:00:00 2001 From: cafzal Date: Mon, 8 Jun 2026 15:53:16 -0700 Subject: [PATCH 1/3] Correct quadratic-constraint claims in formulation skill 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) Signed-off-by: cafzal --- skills/cuopt-numerical-optimization-formulation/SKILL.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/skills/cuopt-numerical-optimization-formulation/SKILL.md b/skills/cuopt-numerical-optimization-formulation/SKILL.md index 1b54e53ef..3fdd86a56 100644 --- a/skills/cuopt-numerical-optimization-formulation/SKILL.md +++ b/skills/cuopt-numerical-optimization-formulation/SKILL.md @@ -29,14 +29,14 @@ Concepts and workflow for going from a problem description to a clear formulatio | Property | LP | MILP | QP | |---|---|---|---| | Objective | Linear | Linear | Quadratic (xᵀQx + cᵀx) | -| Constraints | Linear | Linear | Linear (no quadratic constraints) | +| Constraints | Linear | Linear | Linear + convex quadratic (PSD, inequality) via second-order cones | | Variables | Continuous | Mixed: continuous + integer/binary | Continuous | | Sense | min or max | min or max | **minimize only** (negate to max) | | Duals / sensitivity | Shadow prices + reduced costs | **None** (integer optima) | Shadow prices + reduced costs | If the objective is purely linear, prefer LP/MILP — do not artificially introduce quadratic terms. If any variable is integer or binary, the problem is MILP regardless of the rest. -**Post-solve sensitivity (LP / QP only).** Continuous LP and QP solutions expose **dual values** (shadow prices — the marginal objective change per unit a binding constraint is relaxed: *where to invest to improve the outcome*) and **reduced costs** (for a variable the optimizer left at zero, how far it must improve to enter the solution: a *near-miss*). **MILP solutions have no duals** — integer optima are not continuous, so there are none to return. See the language-specific API skills for how to retrieve them after a solve. +**Post-solve sensitivity (LP / QP only).** Continuous LP and QP solutions expose **dual values** (shadow prices — the marginal objective change per unit a binding constraint is relaxed: *where to invest to improve the outcome*) and **reduced costs** (for a variable the optimizer left at zero, how far it must improve to enter the solution: a *near-miss*). **MILP solutions have no duals** — integer optima are not continuous, so there are none to return. Duals are also unavailable when the model includes quadratic constraints — the second-order cone path returns primal values only. See the language-specific API skills for how to retrieve them after a solve. ## Required formulation questions @@ -44,7 +44,7 @@ Ask these if not already clear: 1. **Decision variables** — What are they? Bounds? 2. **Objective** — Minimize or maximize? Linear or quadratic? For QP: any squared or cross terms (x², x·y)? If maximize a quadratic, the user must negate and minimize. -3. **Constraints** — Linear inequalities/equalities? (Quadratic constraints are not supported.) +3. **Constraints** — Linear inequalities/equalities? Convex quadratic constraints (PSD, inequality only) are also supported, handled as second-order cones; non-convex or equality quadratic constraints are not. 4. **Variable types** — All continuous (LP / QP) or some integer/binary (MILP)? 5. **Convexity (QP only)** — For minimization, the quadratic form (matrix Q) should be positive semi-definite for well-posed problems. From 0f440910c979ba8aa2e580fb24925a999729d061 Mon Sep 17 00:00:00 2001 From: cafzal Date: Tue, 9 Jun 2026 14:30:39 -0700 Subject: [PATCH 2/3] Address review: drop "PSD" from quadratic-constraint wording MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) Signed-off-by: cafzal --- skills/cuopt-numerical-optimization-formulation/SKILL.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/skills/cuopt-numerical-optimization-formulation/SKILL.md b/skills/cuopt-numerical-optimization-formulation/SKILL.md index 3fdd86a56..490f6bae3 100644 --- a/skills/cuopt-numerical-optimization-formulation/SKILL.md +++ b/skills/cuopt-numerical-optimization-formulation/SKILL.md @@ -29,7 +29,7 @@ Concepts and workflow for going from a problem description to a clear formulatio | Property | LP | MILP | QP | |---|---|---|---| | Objective | Linear | Linear | Quadratic (xᵀQx + cᵀx) | -| Constraints | Linear | Linear | Linear + convex quadratic (PSD, inequality) via second-order cones | +| Constraints | Linear | Linear | Linear + convex quadratic (inequality only) via second-order cones | | Variables | Continuous | Mixed: continuous + integer/binary | Continuous | | Sense | min or max | min or max | **minimize only** (negate to max) | | Duals / sensitivity | Shadow prices + reduced costs | **None** (integer optima) | Shadow prices + reduced costs | @@ -44,7 +44,7 @@ Ask these if not already clear: 1. **Decision variables** — What are they? Bounds? 2. **Objective** — Minimize or maximize? Linear or quadratic? For QP: any squared or cross terms (x², x·y)? If maximize a quadratic, the user must negate and minimize. -3. **Constraints** — Linear inequalities/equalities? Convex quadratic constraints (PSD, inequality only) are also supported, handled as second-order cones; non-convex or equality quadratic constraints are not. +3. **Constraints** — Linear inequalities/equalities? Convex quadratic constraints (inequality only) are also supported, handled as second-order cones; non-convex or equality quadratic constraints are not. 4. **Variable types** — All continuous (LP / QP) or some integer/binary (MILP)? 5. **Convexity (QP only)** — For minimization, the quadratic form (matrix Q) should be positive semi-definite for well-posed problems. From 10488808c3df3548f6da225eb5f05192d715a868 Mon Sep 17 00:00:00 2001 From: cafzal Date: Tue, 9 Jun 2026 14:36:26 -0700 Subject: [PATCH 3/3] Align dual wording with #1408 review: drop "shadow prices" 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 #1408. Co-Authored-By: Claude Opus 4.8 (1M context) Signed-off-by: cafzal --- skills/cuopt-numerical-optimization-formulation/SKILL.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/skills/cuopt-numerical-optimization-formulation/SKILL.md b/skills/cuopt-numerical-optimization-formulation/SKILL.md index 490f6bae3..718f719a2 100644 --- a/skills/cuopt-numerical-optimization-formulation/SKILL.md +++ b/skills/cuopt-numerical-optimization-formulation/SKILL.md @@ -32,11 +32,11 @@ Concepts and workflow for going from a problem description to a clear formulatio | Constraints | Linear | Linear | Linear + convex quadratic (inequality only) via second-order cones | | Variables | Continuous | Mixed: continuous + integer/binary | Continuous | | Sense | min or max | min or max | **minimize only** (negate to max) | -| Duals / sensitivity | Shadow prices + reduced costs | **None** (integer optima) | Shadow prices + reduced costs | +| Duals / sensitivity | Dual values + reduced costs | **None** (integer optima) | Dual values + reduced costs | If the objective is purely linear, prefer LP/MILP — do not artificially introduce quadratic terms. If any variable is integer or binary, the problem is MILP regardless of the rest. -**Post-solve sensitivity (LP / QP only).** Continuous LP and QP solutions expose **dual values** (shadow prices — the marginal objective change per unit a binding constraint is relaxed: *where to invest to improve the outcome*) and **reduced costs** (for a variable the optimizer left at zero, how far it must improve to enter the solution: a *near-miss*). **MILP solutions have no duals** — integer optima are not continuous, so there are none to return. Duals are also unavailable when the model includes quadratic constraints — the second-order cone path returns primal values only. See the language-specific API skills for how to retrieve them after a solve. +**Post-solve sensitivity (LP / QP only).** Continuous LP and QP solutions expose **dual values** (the marginal objective change per unit a binding constraint is relaxed: *where to invest to improve the outcome*) and **reduced costs** (for a variable the optimizer left at zero, how far it must improve to enter the solution: a *near-miss*). **MILP solutions have no duals** — integer optima are not continuous, so there are none to return. Duals are also unavailable when the model includes quadratic constraints — the second-order cone path returns primal values only. See the language-specific API skills for how to retrieve them after a solve. ## Required formulation questions