cuopt-lp-milp-api-c
cuOpt LP/MILP — C API
Confirm problem type and formulation (variables, objective, constraints, variable types) before coding.
This skill is C only.
Quick Reference: C API
#include <cuopt/linear_programming/cuopt_c.h>
// CSR format for constraints
cuopt_int_t row_offsets[] = {0, 2, 4};
cuopt_int_t col_indices[] = {0, 1, 0, 1};
cuopt_float_t values[] = {2.0, 3.0, 4.0, 2.0};
char var_types[] = {CUOPT_CONTINUOUS, CUOPT_INTEGER};
cuOptCreateRangedProblem(
num_constraints, num_variables, CUOPT_MINIMIZE,
0.0, objective_coefficients,
row_offsets, col_indices, values,
constraint_lower, constraint_upper,
var_lower, var_upper, var_types,
&problem
);
cuOptSolve(problem, settings, &solution);
cuOptGetObjectiveValue(solution, &obj_value);
Debugging (MPS / C)
MPS parsing: Required sections in order: NAME, ROWS, COLUMNS, RHS, (optional) BOUNDS, ENDATA. Integer markers: 'MARKER', 'INTORG', 'INTEND'.
OOM or slow: Check problem size (variables, constraints); use sparse matrix; set time limit and gap tolerance.
Examples
- examples.md — LP/MILP with build instructions
- assets/README.md — Build commands for all reference code below
- lp_basic — Simple LP: create problem, solve, get solution
- lp_duals — Dual values and reduced costs
- lp_warmstart — PDLP warmstart (see README)
- milp_basic — Simple MILP with integer variable
- milp_production_planning — Production planning with resource constraints
- mps_solver — Solve from MPS file via
cuOptReadProblem
For CLI (MPS files), use cuopt_cli and product docs.
Escalate
If the problem is quadratic (squared or cross terms in the objective), use QP. For contribution or build-from-source, use product or repo documentation.
More from nvidia/cuopt
cuopt-lp-milp-api-cli
LP and MILP with cuOpt — CLI only (MPS files, cuopt_cli). Use when the user is solving from MPS via command line.
2cuopt-user-rules
Base behavior rules for using NVIDIA cuOpt. Read this FIRST before any cuOpt user task (routing, LP/MILP, QP, installation, server). Covers handling incomplete questions, clarifying data requirements, verifying understanding, and running commands safely.
1cuopt-qp-api-c
Quadratic Programming (QP) with cuOpt — C API. Use when the user is embedding QP in C/C++.
1cuopt-developer
Contribute to NVIDIA cuOpt codebase including C++/CUDA, Python, server, docs, and CI. Use when the user wants to modify solver internals, add features, submit PRs, or understand the codebase architecture.
1cuopt-qp-api-cli
QP with cuOpt — CLI (e.g. cuopt_cli with QP-capable input). Use when the user is solving QP from the command line.
1skill-evolution
After solving a non-trivial problem, detect generalizable learnings and propose skill updates so future interactions benefit automatically. Always active — applies to every interaction.
1