cuopt-numerical-optimization-api
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.
- License 许可
- Apache-2.0
- 最近更新
- 2026-10-08
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- cuopt-numerical-optimization-api
- license
- Apache-2.0
- version
- 26.08.00
- metadata
- { "tags": [ "cuopt", "linear-programming", "milp", "qp", "python", "c-api", "cli" ], "author": "NVIDIA cuOpt Team" }
- description
- 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.
02 资源文件 51
- 资产文件assets/c/lp_basic/lp_simple.c3.6 KB
- 资产文件assets/c/lp_basic/README.md466 B
- 资产文件assets/c/lp_duals/lp_duals.c4.0 KB
- 资产文件assets/c/lp_duals/README.md500 B
- 资产文件assets/c/lp_warmstart/README.md289 B
- 资产文件assets/c/milp_basic/milp_simple.c3.4 KB
- 资产文件assets/c/milp_basic/README.md405 B
- 资产文件assets/c/milp_production_planning/milp_production.c3.5 KB
- 资产文件assets/c/milp_production_planning/README.md459 B
- 资产文件assets/c/mps_solver/data/sample.mps490 B
- 资产文件assets/c/mps_solver/mps_solver.c3.4 KB
- 资产文件assets/c/mps_solver/README.md590 B
- 资产文件assets/c/README.md1.7 KB
- 资产文件assets/cli/lp_production/production.mps375 B
- 资产文件assets/cli/lp_production/README.md192 B
- 资产文件assets/cli/lp_simple/README.md191 B
- 资产文件assets/cli/lp_simple/sample.mps490 B
- 资产文件assets/cli/milp_facility/facility.mps694 B
- 资产文件assets/cli/milp_facility/README.md199 B
- 资产文件assets/cli/README.md856 B
- 脚本assets/python/least_squares/model.py831 B
- 资产文件assets/python/least_squares/README.md136 B
- 脚本assets/python/lp_basic/model.py1.1 KB
- 资产文件assets/python/lp_basic/README.md207 B
- 脚本assets/python/lp_duals/model.py1.2 KB
- 资产文件assets/python/lp_duals/README.md227 B
- 脚本assets/python/lp_warmstart/model.py1.8 KB
- 资产文件assets/python/lp_warmstart/README.md140 B
- 脚本assets/python/maximization_workaround/model.py736 B
- 资产文件assets/python/maximization_workaround/README.md152 B
- 脚本assets/python/milp_basic/incumbent_callback.py1.8 KB
- 脚本assets/python/milp_basic/model.py1.2 KB
- 资产文件assets/python/milp_basic/README.md433 B
- 脚本assets/python/milp_production_planning/model.py1.2 KB
- 资产文件assets/python/milp_production_planning/README.md165 B
- 资产文件assets/python/mps_solver/data/README.md2.0 KB
- 资产文件assets/python/mps_solver/data/sample.mps490 B
- 脚本assets/python/mps_solver/model.py8.2 KB
- 资产文件assets/python/mps_solver/README.md2.2 KB
- 资产文件assets/python/mps_solver/results.md2.5 KB
- 脚本assets/python/portfolio/model.py1.6 KB
- 资产文件assets/python/portfolio/README.md232 B
- 资产文件assets/python/README.md581 B
- 参考文档BENCHMARK.md3.8 KB
- 参考文档metadata.json375 B
- 参考文档references/c_api.md4.7 KB
- 参考文档references/cli_api.md5.5 KB
- 参考文档references/python_api.md4.7 KB
- 参考文档references/qp_examples.md5.7 KB
- 参考文档skill-card.md4.1 KB
- 参考文档verification.json9.4 KB
03 SKILL.md 正文
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:
| Interface | When to use | Reference |
|---|---|---|
| Python | User is writing Python code | references/python_api.md |
| C / C++ | User is embedding in a C/C++ application | references/c_api.md |
| CLI | User is solving from MPS files on the command line | references/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 continuous | LP |
| Linear | Some integer or binary | MILP |
Has squared (x*x) or cross (x*y) terms |
Continuous (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*xorx*yterms (portfolio optimization, least squares, regularized regression).
Integer vs Continuous from Wording
| Problem wording / concept | Variable type | Examples |
|---|---|---|
| Discrete entities (counts) | INTEGER | Workers, cars, trucks, machines, pilots, facilities, units to manufacture |
| Yes/no or on/off | INTEGER (binary, lb=0 ub=1) | Open a facility, run a machine, assign a person to a shift |
| Amounts that can be fractional | CONTINUOUS | Tonnes, litres, dollars, hours, kWh, proportion of capacity |
| Rates or fractions | CONTINUOUS | Utilization, 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)
| Problem | Likely cause | Fix |
|---|---|---|
| Infeasible | Conflicting constraints | Check constraint logic and bounds |
| Unbounded | Missing bounds | Add variable bounds |
| Slow solve | Large problem | Set time limit; increase gap tolerance |
| QP rejected with MAXIMIZE | QP only supports MINIMIZE | Negate the objective; negate the result |
| QP returns non-optimal | Q not PSD or badly scaled | Check Q is PSD; rescale variables |
Solver Settings (concepts)
| Setting | Purpose |
|---|---|
time_limit |
Stop after N seconds |
mip_relative_gap |
Stop MILP when within X% of optimal |
mip_absolute_tolerance |
Absolute MIP gap stop |
log_to_console |
Enable solver logging |
Syntax varies by interface — see the interface reference file.
04 同仓库更多 Skills
testing
For testing with Light Protocol programs and clients on localnet, devnet, and mainnet validation.
qedgen
Formally verify programs by writing Lean 4 proofs. Trigger this skill whenever the user wants to formally verify code, generate Lean 4 proofs, prove properties about algorithms or smart contracts, verify invariants, convert program logic into formal specifications, or anything involving Lean 4 and formal verification. Also trigger when the user mentions "qedgen", "lean proof", "formal proof", "verify my code", "prove correctness", "formal verification", or wants mathematical guarantees about their implementation.
solana-dev
Use when user asks to "build a Solana dapp", "write an Anchor program", "create a token", "debug Solana errors", "set up wallet connection", "test my Solana program", "deploy to devnet", or "explain Solana concepts" (rent, accounts, PDAs, CPIs, etc.). Also use for quick on-chain lookups via public RPC + curl — "what's the balance of <wallet>", "look up transaction <sig>", "token balance for <account>", "check this address on mainnet/devnet". End-to-end Solana development playbook covering wallet connection, Anchor/Pinocchio programs, Codama client generation, LiteSVM/Mollusk/Surfpool testing, security checklists, and JSON-RPC curl lookups against public clusters. Integrates with the Solana MCP server for live documentation search. Prefers framework-kit (@solana/client + @solana/react-hooks) for UI, wallet-standard-first connection (incl. ConnectorKit), @solana/kit for client/RPC code, and @solana/web3-compat for legacy boundaries.
solana-common-errors
Diagnose and fix common Solana development errors — GLIBC mismatches, Anchor version conflicts, cargo build-sbf / platform-tools failures, LiteSVM issues, edition2024 crate pins, RPC airdrops, and Anchor 0.29→0.32 migrations. Use when builds fail, Anchor CLI won't install, or CI breaks on Debian/Ubuntu.
skill-creator
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
phantom-wallet-mcp
Execute wallet operations through the Phantom MCP server. Use when the user wants to interact with their Phantom wallet directly — get addresses, transfer SOL or SPL tokens, buy/swap tokens, sign transactions, and sign messages across Solana, Ethereum, Bitcoin, and Sui. Requires the @phantom/mcp-server to be configured as an MCP server.