cuOptCreateProblem fails on num_constraints=0 (zero-row problems)
I maintainer di solito rispondono entro 1 giorno
@aliceb-nv ci sta già lavorando.
Dal 29/9/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
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?
- Lingua principale
- Cuda
- Stelle
- 1.1k
- Fork
- 249
- Merge medio
- 1g 15h
- PR unite (30g)
- 126
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di NVIDIA/cuopt
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 32/100
I maintainer di solito rispondono entro 1 giorno
-
CI: nightly Cython build with bounds checking enabledForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 22/100
NVIDIA/cuopt#2255 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 Mezza giornata Idoneità per principianti 50/100
I maintainer di solito rispondono entro 1 giorno