Generated banner for Cuopt Numerical Optimization API
Generated logo for Cuopt Numerical Optimization API

Cuopt Numerical Optimization API

NVIDIAOfficialCreated by NVIDIA cuOpt Team

  • Skill
  • Tool integration
  • Software development
  • Apache-2.0
  • Medium risk
  • Has scripts

From the author

LP, MILP, and QP (beta) with cuOpt — Python, C, and CLI. Use when the user is solving LP, MILP, or QP with any cuOpt interface.
— the description by NVIDIA cuOpt Team

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

The cuOpt Numerical Optimization API provides interfaces to model and solve Linear Programming (LP), Mixed-Integer Linear Programming (MILP), and Quadratic Programming (QP) problems. It supports integration through Python, C, and a command-line interface. The tool is designed to work as a standalone solver or as a backend for third-party modeling languages such as AMPL, GAMS, PuLP, JuMP, Pyomo, and CVXPY. It includes features for setting solver parameters like time limits and tolerances, and provides access to primal solutions, objective values, and dual solutions for supported problem types.

What it does

  • Solves LP, MILP, and QP problems using a GPU-accelerated solver.
  • Provides C and Python APIs for programmatic model definition and solving.
  • Offers a command-line interface for solving problems from MPS, QPS, and LP files.
  • Supports integration with third-party modeling tools like Pyomo, PuLP, and JuMP.
  • Allows configuration of solver settings including time limits and gap tolerances.
  • Retrieves primal solutions, objective values, and dual values for LP and QP models.

When to use it

  • When you need to solve linear or quadratic optimization problems.
  • When you are working with discrete entities or yes/no decisions requiring MILP.
  • When you have an existing model in a third-party tool and need a solver backend.
  • When you need to solve optimization problems from standard MPS or LP files via CLI.

Advantages

  • Supports multiple interfaces including Python, C, and CLI.
  • Compatible with common third-party modeling languages.
  • Provides granular control over solver parameters and settings.
  • Allows for programmatic export and import of standard optimization file formats.

Usage examples

“How do I solve a linear programming problem using the C API?”
The agent provides a code example using cuOptCreateRangedProblem and cuOptSolve, demonstrating how to define constraints and variables in C.
“Can I use cuOpt with Pyomo?”
The agent explains that cuOpt works as a solver backend for Pyomo and provides guidance on pointing the model's solver to cuOpt.
“How do I run a solver on an MPS file?”
The agent instructs the user to use the cuopt_cli command followed by the file path and any necessary flags for solver settings.
“What is the difference between LP and MILP in cuOpt?”
The agent clarifies that LP is for continuous variables while MILP is for discrete or binary variables, and explains the implications for dual values.

Install

  1. Download the skill as a ZIP:

    https://mp-staging.autogineer.com/agent-skills/nvidia/cuopt-numerical-optimization-api/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip cuopt-numerical-optimization-api.zip -d .agents/skills

Documentation by NVIDIA cuOpt Team

cuOpt Numerical Optimization API

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

Interface Selection

Choose the reference for the user's interface:

InterfaceWhen to useReference
PythonUser is writing Python codereferences/python_api.md
C / C++User is embedding in a C/C++ applicationreferences/c_api.md
CLIUser is solving from MPS files on the command linereferences/cli_api.md

If the interface is not yet clear, ask before writing any code.

Already using a modeling language? cuOpt also works as a solver backend for third-party modeling tools — AMPL, GAMS / GAMSPy, PuLP, JuMP, Pyomo, and CVXPY — with near-zero code changes (point the model's solver at cuOpt). CVXPY additionally covers convex QP and, in beta, QCQP / SOCP. Prefer this when the user already has a model in one of these tools rather than porting it to the cuOpt API. See Third-Party Modeling Languages.

Choosing LP vs MILP vs QP

Decide from the objective and variables:

If the objective is...And variables are...Use
Linear (sum of c_i * x_i)All continuousLP
LinearSome integer or binaryMILP
Has squared (x*x) or cross (x*y) termsContinuous (integer QP not supported)QP (beta)

Prefer LP when the problem allows it. LP solves faster and has stronger optimality guarantees. Use MILP only when the problem logically requires whole numbers or yes/no decisions. Use QP only when the objective is genuinely quadratic (variance, squared error, kinetic energy).

  • Use LP when every quantity can meaningfully be fractional: flows, proportions, rates, dollars, hours, tonnes of material, etc.

  • Use MILP when the problem mentions counts of discrete entities, yes/no choices, or either/or decisions (e.g. open a facility or not, assign a person to a shift, number of trucks).

  • Use QP when the objective minimizes variance, squared error, or any expression with x*x or x*y terms (portfolio optimization, least squares, regularized regression).

Integer vs Continuous from Wording

Problem wording / conceptVariable typeExamples
Discrete entities (counts)INTEGERWorkers, cars, trucks, machines, pilots, facilities, units to manufacture
Yes/no or on/offINTEGER (binary, lb=0 ub=1)Open a facility, run a machine, assign a person to a shift
Amounts that can be fractionalCONTINUOUSTonnes, litres, dollars, hours, kWh, proportion of capacity
Rates or fractionsCONTINUOUSUtilization, percentage, share of budget

Rule of thumb: "How many things" → INTEGER. "How much" → CONTINUOUS.

QP Rules (all interfaces)

  • MINIMIZE only — the solver rejects MAXIMIZE for quadratic objectives. To maximize f(x), minimize -f(x) and negate the reported objective value.

  • Continuous variables only — integer QP is not supported.

  • Q should be positive semi-definite for a convex, well-posed problem.

  • Beta — API may evolve; treat as production-capable for typical convex QP.

Dual Values

Duals and reduced costs are available for LP and QP only:

  • MILP — no duals (integer optima are not continuous).

  • Quadratic constraints — duals unavailable even for LP/QP; all values return NaN.

  • PDLP warmstart — LP only; MILP solves do not accept a PDLP warmstart.

Common Issues (all interfaces)

ProblemLikely causeFix
InfeasibleConflicting constraintsCheck constraint logic and bounds
UnboundedMissing boundsAdd variable bounds
Slow solveLarge problemSet time limit; increase gap tolerance
QP rejected with MAXIMIZEQP only supports MINIMIZENegate the objective; negate the result
QP returns non-optimalQ not PSD or badly scaledCheck Q is PSD; rescale variables

Solver Settings (concepts)

SettingPurpose
time_limitStop after N seconds
mip_relative_gapStop MILP when within X% of optimal
mip_absolute_toleranceAbsolute MIP gap stop
log_to_consoleEnable solver logging

Syntax varies by interface — see the interface reference file.

Files

references/cli_api.md

cuOpt Numerical Optimization — CLI

Solve LP, MILP, and QP problems from MPS or LP files via cuopt_cli. The same command and options apply across all three; QP is supported in both MPS (QPS) and LP files.

Confirm problem type and formulation (variables, objective, constraints, variable types) before coding.

The CLI is included with the cuopt Python package — install via pip or conda, then verify with cuopt_cli --help.

Basic Usage

cuopt_cli <problem-file> [options]

The first positional argument is the input file. The format is chosen automatically from the extension — MPS, QPS, and LP files are all accepted (including .gz / .bz2 compressed variants); run cuopt_cli --help for the exact list of supported extensions.

Options

cuopt_cli --help is the authoritative list — don't work from a hard-coded subset. The CLI exposes every solver setting as a flag, generated from the parameter list at runtime: take any parameter documented in the cuOpt settings reference and replace underscores with hyphens (time_limit → --time-limit, mip_relative_gap → --mip-relative-gap). So if a parameter is documented, the flag exists; --help and the solver-settings docs are the sources of truth for names, meanings, and defaults.

A few options are CLI-specific (not solver parameters) and worth knowing because you wouldn't derive them from a parameter name:

  • --params-file <file> — supply many parameters from a key = value config file instead of repeating flags.

  • --relaxation — solve the continuous relaxation of a MILP (drop integrality).

  • --initial-solution <file> — warm-start from a solution file.

Run cuopt_cli --help for the complete, current set.

Authoring input files

MPS, QPS, and LP are precise, externally-specified file formats. Don't hand-author them from memory or from a partial recollection of the layout — column-position rules, marker conventions, the quadratic-objective encoding, and sign/scaling conventions are easy to get subtly wrong, and a malformed file either fails to parse or silently encodes a different model than intended.

If you're building a model from data (rather than solving a file you already have), define the problem through the cuOpt Python API or your preferred modeling interface — don't generate an MPS or LP file by hand to feed the CLI. These interfaces take coefficients, bounds, and variable types as native data structures, so there's no text format to get wrong. The cuOpt Python API solves and returns the solution in the same program (see python_api.md); a separate modeling library (e.g. PuLP, Pyomo, JuMP) can export a valid file for the CLI or call its own solver. Reach for cuopt_cli when you already have a model file — e.g. a benchmark instance or a file exported by one of these tools.

When a file is genuinely the right artifact, still generate it programmatically rather than by hand:

  • From cuOpt's Python API — build the model, then export it with model.writeMPS("problem.mps") (emits a valid MPS file, including the quadratic objective for QP) and solve with cuopt_cli problem.mps.

  • From another modeling tool — most LP/MILP modeling libraries and solvers can export standard MPS or LP files; pass the exported file straight to cuopt_cli.

If you must read or write these formats by hand anyway, work from the format's full specification (and the cuOpt repo docs at docs/cuopt/source/cuopt-cli/ for cuOpt-specific conventions such as the quadratic-objective encoding) — not from an example alone.

Either way, validate before trusting the result: cuopt_cli logs Read file ... on a successful parse, and reports the variable/constraint counts and objective — sanity-check those against your intended model.

MPS Format (required sections, in order)

  1. NAME — problem name

  2. ROWS — N (objective), L/G/E (constraints)

  3. COLUMNS — variable names, row names, coefficients

  4. RHS — right-hand side values

  5. BOUNDS (optional) — LO, UP, FX, BV, LI, UI

  6. ENDATA

Integer variables: wrap columns with 'MARKER' 'INTORG' before and 'MARKER' 'INTEND' after.

QP via CLI (beta)

Quadratic objectives are MINIMIZE only (for maximization, negate the objective, including the quadratic terms) and require continuous variables only (no integer variables mixed with a quadratic objective). Quadratic objectives use the standard MPS quadratic-objective (QPS) extension and are also supported in LP files. Check cuopt_cli --help for QP-specific flags; see docs/cuopt/source/cuopt-cli/ for the format.

Troubleshooting

  • Parsing input file failed — Confirm the extension matches the format (.lp vs .mps/.qps); an unrecognized extension is rejected before parsing. The parser error names the offending line — fix it against the format spec, or (more reliably) regenerate the file from a modeling tool rather than patching it by hand. Also check ENDATA, section order, and integer markers.

  • Infeasible — Re-check the model against your intended formulation: constraint directions (L/G/E), right-hand sides, and variable bounds.

Reference Models

ModelTypeLocation
Minimal LPLPassets/cli/lp_simple/
Production planningLPassets/cli/lp_production/
Facility locationMILPassets/cli/milp_facility/

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Needs Python

Security

What our scanner noticed· Medium risk

  • Large base64-encoded blobs
  • Scripts that your agent may run

This skill includes scripts that your agent may run. Read them before you use it.

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Created by
NVIDIA cuOpt Team
Publisher
NVIDIA (Official)
Source
NVIDIA/skills · skills/cuopt-numerical-optimization-api · commit fce3cca
Licence
Apache License 2.0 (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE-APACHE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by NVIDIA cuOpt Team or NVIDIA.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download cuopt-numerical-optimization-api.zip