Skip to content

[BUG] [python] Cannot build objective x + x*x #928

@mtanneau

Description

@mtanneau

Describe the bug

Forming a quadratic expression starting with a unitary variable term errors in the python API.

Steps/Code to reproduce bug

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

problem = Problem("qp")

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

problem.setObjective(x + x*x, sense=MINIMIZE)  # errors

produces the following output:

Cannot add type QuadraticExpression to variable

Expected behavior

I expected the problem to be formed as expected

Environment details (please complete the following information):

  • Environment location: DGX Spark
  • Method of cuOpt install: via pip in a python virtual environment, using cuOpt v26.02

Additional context

Probably linked to #926 and how unitary variable terms are handled in conjunction with linear/quadratic expressions.

Metadata

Metadata

Labels

awaiting responseThis expects a response from maintainer or contributor depending on who requested in last comment.bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions