Skip to content

[BUG] [python] Python API errors when solving LP with no constraint #927

@mtanneau

Description

@mtanneau

Describe the bug

Attempting to solve a linear program with no constraints (other than variable bounds) results in an error.

Steps/Code to reproduce bug

from cuopt.linear_programming.problem import Problem, CONTINUOUS, MINIMIZE
from cuopt.linear_programming.solver_settings import SolverSettings

problem = Problem("no_constraints")
x = problem.addVariable(lb=0.0, vtype=CONTINUOUS, name="x")

problem.setObjective(x, sense=MINIMIZE)

settings = SolverSettings()

# This will error
problem.solve(settings)

on my machine, this produces the following log (note the first line)

Error in solve_lp: {"CUOPT_ERROR_TYPE": "ValidationError", "msg": "A_offsets must be set before calling the solver."}
cuOpt version: 26.2.0, git hash: f73da24d, host arch: aarch64, device archs: 75-real,80-real,86-real,90a-real,100f-real,120a-real,120
CPU: Unknown, threads (physical/logical): 1/20, RAM: 108.74 GiB
CUDA 13.1, device: NVIDIA GB10 (ID 0), VRAM: 119.70 GiB
CUDA device UUID: 43bce240-d7d6-65e5-ca7a-e351bab5de7a

Expected behavior

The problem should be passed to the solver and solved correctly.

Environment details (please complete the following information):

  • Environment location: DGX Spark workstation
  • Method of cuOpt install: via pip in a python virtual environment. I am using cuopt v26.02 release.

Additional context

I tried this with a quadratic term in the objective, and obtained the same error.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions