[BUG] cuOptGetProblemStringArrayAttribute rejects a problem with no names instead of reporting it

オープン
#1,796 コメント 1 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 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

  1. cuOptCreateProblem(...) with 2 variables and no names.
  2. cuOptGetProblemStringArrayAttribute(problem, CUOPT_STRING_ARRAY_VARIABLE_NAMES, 2, out).
  3. Returns CUOPT_INVALID_ARGUMENT rather 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日 22時間
マージ済み PR(30日)
102

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

NVIDIA/cuopt のほかの issue

NVIDIA/cuopt の issue をすべて見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。