dwavesystems / dwavesystems/dimod
Inconsistent handling of invalid variable values in SampleSet
Open
bug
- Dominant language
- Python
- Stars
- 143
- Forks
- 91
- Avg merge
- 1h 24m
- Merged PRs (30d)
- 3
Description
```
>>> import dimod
>>> dimod.__version__
'0.8.15'
>>>
>>> bqm = dimod.BQM.from_ising({}, {'ab': 1})
>>> ss = dimod.SampleSet.from_samples_bqm([{'a': 1, 'b': 1}, {'a': -1, 'b': -20}], bqm)
>>> print(ss)
a b energy num_oc.
0 +1 +1 1.0 1
1 -1 -1 20.0 1
['SPIN', 2 rows, 2 samples, 2 variables]
```
Note how `-20` for `b` in the second sample is out of allowed `{1, -1}` set, yet when printed it's rounded down to `-1`. Energy stays incorrect though (calculated for `b = -20`).
Contributor guide
Assessment
This issue has not been assessed yet.