dwavesystems / dwavesystems/dimod

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

Open
#1,305 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
143
Forks
91
Avg merge
1h 24m
Merged PRs (30d)
3

Description

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`.

Contributor guide

Open the contributing guide

Research direction

Start by running the reproduction in the issue and tracing the CQM.add_constraint path that accepts the iterable interaction. Check where REAL-variable interaction validation is performed; done means the example raises the expected ValueError instead of building the constraint.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend-api-design
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.