dimod
dimod copied to clipboard
It is allowed to build CQM object with quadratic interaction between real variables without any error raised
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
.