dimod icon indicating copy to clipboard operation
dimod copied to clipboard

Allow single-variable BQM/QMs to be treated as variable labels

Open arcondello opened this issue 4 years ago • 1 comments

A frequent source of confusion in 0.10 is the distinction between x and 'x' in

>>> x = Binary('x')

The former is a dimod.BinaryQuadraticModel object, the latter is a string label of a variable. This leads to confusing behavior like https://github.com/dwavesystems/dimod/issues/921.

Would likely require https://github.com/dwavesystems/dimod/issues/966 and https://github.com/dwavesystems/dimod/issues/923.

The biggest challenge will be hunting down all of the locations that take a variable label and updating them. Though updating dimod.Variables would be an obvious place to start.

A good first step would be to raise a better error in some of the most common places it happens.

arcondello avatar Sep 14 '21 16:09 arcondello

Another approach would be to make a Spin, Binary, Integer full subclasses that promote themselves to QM and BQM. I think that might also lead to lots of confusing behavior.

arcondello avatar Sep 14 '21 16:09 arcondello