cuOptCreateProblem fails on num_constraints=0 (zero-row problems)
Los mantenedores suelen responder en 1 día
@aliceb-nv ya está trabajando en esto.
Desde el 29/9/2026.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
Summary
cuOptCreateProblem fails with CUOPT_INVALID_ARGUMENT for any problem with zero linear constraints — including pure bound-constrained LPs and QCQP-style problems (quadratic constraints only, no linear rows).
Repro (Java, but this is a C API issue)
try (Problem problem = new Problem("no-constraint")) {
Variable x = problem.addVariable(0.0, 10.0, 1.0, VariableType.CONTINUOUS, "x");
problem.setObjective(x, ObjectiveSense.MINIMIZE);
try (Solution solution = problem.solve()) { // throws here
System.out.println(solution.getTerminationStatus());
}
}
Exception in thread "main" com.nvidia.cuopt.mathematicaloptimization.CuOptException: cuOptCreateProblem failed with status 1
at com.nvidia.cuopt.mathematicaloptimization.NativeCuOpt.createProblem(Native Method)
...
Same failure with any zero-linear-constraint problem, e.g. a QuadraticExpression constraint with no linear rows, or a single SEMI_CONTINUOUS variable with no addConstraint calls at all.
Root cause (traced, not fixed)
cuOptCreateProblem (cpp/src/pdlp/cuopt_c.cpp:338) has no explicit num_constraints <= 0 check itself — unlike sibling functions such as cuOptSetInitialDualSolution, which does. The failure comes from a raft::exception thrown somewhere inside problem->set_csr_constraint_matrix(...) (or a related setter) on a zero-row CSR matrix, caught and converted to CUOPT_INVALID_ARGUMENT. Not traced further than that.
Why this looks unintentional
- No explicit validation rejects it at the API boundary (contrast with the
num_constraints <= 0check present elsewhere in the same file). - Pure bound-constrained LPs and quadratic-only-constrained problems are mathematically valid; other solvers support them.
Impact
Found while writing/testing Java doc examples for #1999 — had to add an artificial non-binding linear constraint to two examples (quadratic-constraint-only, and a semi-continuous variable with no other constraints) purely to work around this.
Ask
Could someone with more context on the CSR/problem construction path confirm whether zero-row problems are meant to be supported, and if so where the fix belongs?
- Lenguaje dominante
- Cuda
- Estrellas
- 1.1k
- Forks
- 249
- Merge medio
- 1 d 15 h
- PR fusionados (30 d)
- 126
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de NVIDIA/cuopt
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 32/100
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 22/100
NVIDIA/cuopt#2255 · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 Medio día Aptitud para principiantes 50/100
Los mantenedores suelen responder en 1 día