[BUG] Constraint validation reports CSR offset count as the number of rows

Abierto Apto para principiantes
#2,274 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@0z5a ya está trabajando en esto.

Desde el 4/11/2026.

  • #2275 de @0z5a — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
78/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python

Línea de trabajo

Lee cpp/src/pdlp/utilities/problem_checking.cu alrededor de la comprobación de RHS en las líneas 201–208 y, después, examina las dos comprobaciones de límites mencionadas en el informe. Compara el número de filas usado en cada mensaje de error con el cálculo offsets.size() - 1 de la validación. El trabajo estará listo cuando los vectores RHS y de límites mal formados indiquen el número real de filas de la matriz; ejecuta las pruebas de validación pertinentes.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Bug

When the length of a constraint vector does not match the CSR matrix, the solver rejects the model, but the validation message reports the length of the CSR offsets array as the number of matrix rows. For a two-row matrix, a three-element RHS can therefore produce the contradictory message:

The right hand side vector has size 3 and the number of rows (constraints) in the matrix is 3.

The actual matrix has two rows (offsets = [0, 1, 2]). The lower/upper-bound representation has the same diagnostic issue. The validation itself rejected the malformed models in the cases checked; this report does not assert an out-of-bounds access.

Reproducer

import numpy as np
from cuopt.linear_programming.data_model import DataModel
from cuopt.linear_programming.solver import Solve
from cuopt.linear_programming.solver_settings import SolverMethod, SolverSettings

model = DataModel()
model.set_csr_constraint_matrix(
    np.array([1.0, 1.0]),
    np.array([0, 0], dtype=np.int32),
    np.array([0, 1, 2], dtype=np.int32),
)
model.set_objective_coefficients(np.array([1.0]))
model.set_variable_lower_bounds(np.array([0.0]))
model.set_variable_upper_bounds(np.array([np.inf]))
model.set_variable_types(np.array(["C"], dtype="S1"))
model.set_constraint_bounds(np.array([1.0, 2.0, 3.0]))
model.set_row_types(np.array(["G", "G", "G"]))

settings = SolverSettings()
settings.set_parameter("method", SolverMethod.PDLP)
settings.set_parameter("time_limit", 10.0)
settings.set_parameter("log_to_console", False)
solution = Solve(model, settings)
print(solution.get_error_status(), solution.get_error_message())

Expected: a validation error reporting 2 matrix rows. Observed with cuOpt 26.12.00a62 (52d14b4c), CUDA 13, B300: a validation error reporting 3 rows. A valid two-element RHS/row-types control solves to Optimal.

At 52d14b4c, the RHS check compares against offsets.size() - 1 but formats offsets.size(); the two bounds checks use the same pattern. Related: #2254.

Lenguaje dominante
Cuda
Estrellas
1.1k
Forks
255
Merge medio
1 d 11 h
PR fusionados (30 d)
123

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de NVIDIA/cuopt

Todos los issues de NVIDIA/cuopt

Issues similares

Más issues de Backend & API Design

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.