[BUG] cuOptGetProblemStringArrayAttribute rejects a problem with no names instead of reporting it
维护者通常 1 天内回复
@aliceb-nv 已经在做这个了。
开始于 2026年8月25日。
评估
这个 Issue 还没有评估数据。
描述
Describe the bug
cuOptGetProblemStringArrayAttribute compares the stored name vector against the caller's count and fails if they differ:
const auto& names = (attribute == CUOPT_STRING_ARRAY_VARIABLE_NAMES) ? iface->get_variable_names()
: iface->get_row_names();
if (names.size() != count) { return CUOPT_INVALID_ARGUMENT; }
A problem built without names — which is legal, and is what cuOptCreateProblem produces — stores an empty vector. A caller that sizes its buffer from cuOptGetNumVariables, as the documentation implies, therefore passes count = numVariables against names.size() == 0 and gets CUOPT_INVALID_ARGUMENT.
The caller cannot distinguish that from a genuine size mismatch, and there is no attribute reporting how many names are stored, so it cannot pre-check either.
Steps/Code to reproduce bug
cuOptCreateProblem(...)with 2 variables and no names.cuOptGetProblemStringArrayAttribute(problem, CUOPT_STRING_ARRAY_VARIABLE_NAMES, 2, out).- Returns
CUOPT_INVALID_ARGUMENTrather than indicating that the problem has no names.
Expected behavior
"This problem has no names" should be reportable rather than indistinguishable from a caller error. Either return the generated default names so the count always matches numVariables, or add a count attribute the caller can query first, or define a distinct status for the empty case.
Additional context
Found while reviewing the Java bindings (#1524), where this is one of the reasons cuopt_jni.cpp still reads names through the internal header instead of the C API. Raised by @chris-maes in review: https://github.com/NVIDIA/cuopt/pull/1524#discussion_r3854928177
Related: #1703 covers the broader set of problem-model accessors the C API is missing.
- 主要语言
- Cuda
- 星标
- 1.1k
- 派生
- 255
- 平均合并
- 1 天 11 小时
- 30 天内合并 PR
- 123
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
NVIDIA/cuopt 的其他 Issue
-
[BUG] Constraint validation reports CSR offset count as the number of rows可能已有人在做 @0z5a 于 1 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
ci: pr-test-summary job shows red when the GitHub API returns persistent 5xx errors可能已有人在做 @0z5a 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 82/100
维护者通常 1 天内回复
-
[BUG] Dataset downloader reports success and replaces data after a failed download可能已有人在做 @0z5a 今天认领。 未关闭
难度 3/5 1-2 天 新手友好度 75/100
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 48/100
维护者通常 1 天内回复