dimod icon indicating copy to clipboard operation
dimod copied to clipboard

It is allowed to build CQM object with quadratic interaction between real variables without any error raised

Open alexzucca90 opened this issue 2 years ago • 0 comments

Quadratic interactions between continuous variables are not supported. However, it is possible to build a CQM object with quadratic interaction between two real variables by "bypassing" some checks. This happens if we build a model from iterable

To reproduce

import dimod

cqm = dimod.CQM()

cqm.add_variable('REAL', 'x')
cqm.add_variable('REAL', 'y')
cqm.add_constraint([('x', 'y', 1)], ">=", -1, label="c")
print(cqm.constraints['c'].lhs)

We expect to have an error like ValueError: REAL variables (e.g. 'x') cannot have interactions.

alexzucca90 avatar Dec 14 '22 23:12 alexzucca90