cuopt-numerical-optimization-api

Model and solve LP, MILP, and QP problems using NVIDIA cuOpt's GPU-accelerated solver.

3.2k|370|Updated Feb 25, 2026
One-click install
npx skills add https://github.com/NVIDIA/skills --skill cuopt-numerical-optimization-api
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cuopt-numerical-optimization-api
Source: https://github.com/NVIDIA/skills/tree/main/skills/cuopt-numerical-optimization-api
Command: npx skills add https://github.com/NVIDIA/skills --skill cuopt-numerical-optimization-api

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires cuopt, and includes references (resource) and assets (resource) components.

What problem does it solve?

Formulating and solving linear programming (LP), mixed-integer linear programming (MILP), and quadratic programming (QP) problems with NVIDIA cuOpt requires knowing the correct API call sequences, variable typing rules, and solver restrictions across three different interfaces. This Skill guides an AI agent to produce correct cuOpt code in Python, C, or via the cuopt_cli command line, avoiding common silent failures like incorrect status string casing or unsupported QP maximization.

Core Features & Use Cases

  • Interface-specific guidance: Dedicated references for the Python API, C API, and cuopt_cli, including call sequences, parameter functions, and CSR matrix construction.
  • Problem-type decision rules: Clear criteria for choosing LP vs MILP vs QP based on objective form and variable types, plus integer-vs-continuous wording heuristics.
  • QP constraints and workarounds: Documents MINIMIZE-only restriction, continuous-variables-only rule, PSD requirements, and the negate-the-objective maximization workaround.
  • Runnable reference models: Ready-to-run Python, C, and MPS examples covering LP basics, duals, PDLP warmstart, production planning MILP, portfolio QP, least squares, and MPS file solving.
  • Use Case: A developer asks their agent to solve a facility-location problem. The Skill directs the agent to model binary open/close variables as INTEGER, set a MIP gap tolerance, and produce working cuOpt Python code with correct PascalCase status checks.

Quick Start

Ask your agent to solve a linear programming problem with cuOpt, for example to maximize profit subject to resource constraints using the cuOpt Python API.

Frequently Asked Questions about cuopt-numerical-optimization-api

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I solve a linear programming problem with the cuOpt Python API?

Create a Problem, add variables with addVariable, add constraints with addConstraint, set the objective with setObjective and a MINIMIZE or MAXIMIZE sense, then call problem.solve with SolverSettings. Check problem.Status.name for 'Optimal' or 'PrimalFeasible' before reading problem.ObjValue.

How do I choose between LP, MILP, and QP in cuOpt?

Use LP when the objective is linear and all variables are continuous, MILP when some variables are integer or binary, and QP when the objective contains squared or cross-product terms. Prefer LP when possible since it solves faster with stronger optimality guarantees.

Why does my cuOpt status check never match after a successful solve?

cuOpt status names use PascalCase, so 'OPTIMAL' never matches. Use problem.Status.name in ['Optimal', 'PrimalFeasible'] for LP and QP, or ['Optimal', 'FeasibleFound'] for MILP. This is a silent failure since no exception is raised.

Can cuOpt solve quadratic programs with maximization or integer variables?

No. cuOpt QP supports MINIMIZE only and continuous variables only; integer QP is not supported. To maximize a quadratic objective, negate all objective coefficients, minimize, then negate the reported objective value.

How do I solve an MPS file with cuOpt from the command line?

Run cuopt_cli followed by the MPS file path, for example cuopt_cli problem.mps --time-limit 60 --mip-relative-gap 0.01. The CLI ships with the cuopt Python package, and cuopt_cli --help lists all supported flags derived from solver parameters.

Does cuOpt provide dual values and reduced costs for all problem types?

Dual values and reduced costs are available for LP and QP only. MILP has no duals because integer optima are not continuous, and models with quadratic constraints return NaN for all dual values.